Migrates remaining services and plugins to generated rtiddsgen API
Converts accessor calls to plain member access across the residual service set.
This commit is contained in:
104 files changed
+2424
-2430
No files matched your search
+6
-6
@@ -86,7 +86,7 @@ void SrpDtTests::tryGetAllSituationReplays()
|
||||
INFO_LOG(m_logger) << "Amout of existing situation replays = " << map.size();
|
||||
m_situationReplayId = map.firstKey();
|
||||
for(auto it = map.begin(); it != map.end(); ++it)
|
||||
INFO_LOG(m_logger) << "situationReplay(" << it.key() << ") : " << it.value().replayPartitionId() ;
|
||||
INFO_LOG(m_logger) << "situationReplay(" << it.key() << ") : " << it.value().replayPartitionId ;
|
||||
}
|
||||
|
||||
QTimer::singleShot(10, this, &SrpDtTests::tryGetSituationReplay);
|
||||
@@ -98,15 +98,15 @@ void SrpDtTests::tryGetSituationReplay()
|
||||
INFO_LOG(m_logger) << "trying get itemData for situationReplay " << m_situationReplayId;
|
||||
SituationReplay::SitReplay data = m_dtc->sitReplay(m_situationReplayId);
|
||||
|
||||
if (data.id() <= 0)
|
||||
if (data.id <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error receiving data for situation replay " << m_situationReplayId;
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "## SitReplay(" << data.id() << "), replayPartition: " << data.replayPartitionId()
|
||||
<< ", on exercise " << data.exerciseId();
|
||||
INFO_LOG(m_logger) << "## SitReplay(" << data.id << "), replayPartition: " << data.replayPartitionId
|
||||
<< ", on exercise " << data.exerciseId;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
}
|
||||
@@ -114,8 +114,8 @@ void SrpDtTests::tryGetSituationReplay()
|
||||
//---------------------------------------------------------------------------------
|
||||
void SrpDtTests::onReceiveSituationReplayData(const SituationReplay::SitReplay &data)
|
||||
{
|
||||
if (m_situationReplayId == data.id())
|
||||
INFO_LOG(m_logger) << "##################### Data for id = " << data.id() << " received";
|
||||
if (m_situationReplayId == data.id)
|
||||
INFO_LOG(m_logger) << "##################### Data for id = " << data.id << " received";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
+9
-9
@@ -91,12 +91,12 @@ void SrpFtTests::tryStart()
|
||||
double pace = 2.0;
|
||||
|
||||
ChangeReplayStateRequest req;
|
||||
req.id(0);
|
||||
req.replayPartitionId(m_replayPartitionId);
|
||||
req.state(SrpState::Started);
|
||||
req.beginTime(beginTime);
|
||||
req.endTime(endTime); // infinite
|
||||
req.pace(pace);
|
||||
req.id = 0;
|
||||
req.replayPartitionId = m_replayPartitionId;
|
||||
req.state = SrpState::Started;
|
||||
req.beginTime = beginTime;
|
||||
req.endTime = endTime; // infinite
|
||||
req.pace = pace;
|
||||
|
||||
if (!m_ftc->changeReplayStateRequest(req, this))
|
||||
{
|
||||
@@ -208,9 +208,9 @@ void SrpFtTests::failExit()
|
||||
void SrpFtTests::switchToState(SrpState state)
|
||||
{
|
||||
ChangeReplayStateRequest req;
|
||||
req.id(m_situationReplayId);
|
||||
req.replayPartitionId(m_replayPartitionId);
|
||||
req.state(state);
|
||||
req.id = m_situationReplayId;
|
||||
req.replayPartitionId = m_replayPartitionId;
|
||||
req.state = state;
|
||||
|
||||
if (!m_ftc->changeReplayStateRequest(req, this))
|
||||
{
|
||||
|
||||
@@ -94,13 +94,13 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
void DdsHandler::publishPartitionTime(const Core::PartitionTime &partitionTime)
|
||||
{
|
||||
INFO_LOG(m_logger) << "publish partitionTime: " << partitionTime.timeStamp();
|
||||
INFO_LOG(m_logger) << "publish partitionTime: " << partitionTime.timeStamp;
|
||||
m_dtsPartitionTime->write(partitionTime);
|
||||
}
|
||||
|
||||
bool DdsHandler::parseOptions(const QString &opts, ConnectionParams ¶ms)
|
||||
{
|
||||
QVector<QStringRef> parts = opts.splitRef(QLatin1Char(','));
|
||||
const QStringList parts = opts.split(QLatin1Char(','));
|
||||
if (parts.size() < 2 || parts.size() > 3)
|
||||
return false;
|
||||
bool bOk;
|
||||
@@ -112,7 +112,7 @@ bool DdsHandler::parseOptions(const QString &opts, ConnectionParams ¶ms)
|
||||
return false;
|
||||
if (parts.size() == 3)
|
||||
{
|
||||
QString str = parts.at(2).toString();
|
||||
QString str = parts.at(2);
|
||||
// '_' is not allowed in a scheme, but rti needs it ...
|
||||
str.replace(QLatin1String("tcpv4_lan"), QLatin1String("tcpv4lan"));
|
||||
QUrl url = QUrl::fromUserInput(str);
|
||||
|
||||
+29
-29
@@ -77,17 +77,17 @@ Core::FunctionReplyObject HandlerSituationReplay::startReplayRequest(const Situa
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onStartReplayRequest: " << request;
|
||||
// Start only own replay
|
||||
if (request.replayPartitionId() != m_partitionId)
|
||||
return Core::FunctionReplyObject(request.replayPartitionId(),tr_lts("dds", "Wrong replay partition"));
|
||||
if (request.replayPartitionId != m_partitionId)
|
||||
return Core::FunctionReplyObject(request.replayPartitionId,tr_lts("dds", "Wrong replay partition"));
|
||||
if (m_objSrp && m_objSrp->srpState() != SrpState::Stopped)
|
||||
return Core::FunctionReplyObject(request.replayPartitionId(), tr_lts("dds", "Replay is not yet stopped"));
|
||||
return Core::FunctionReplyObject(request.replayPartitionId, tr_lts("dds", "Replay is not yet stopped"));
|
||||
|
||||
Database::SrpSituationReplay newData;
|
||||
newData.srpStateId = SrpState::Started;
|
||||
newData.replayPartitionId = m_partitionId;
|
||||
newData.beginTime = request.beginTime();
|
||||
newData.endTime = request.endTime();
|
||||
newData.pace = request.pace().is_set() ? request.pace().get() : 1;
|
||||
newData.beginTime = request.beginTime;
|
||||
newData.endTime = request.endTime;
|
||||
newData.pace = request.pace.is_set() ? request.pace.get() : 1;
|
||||
|
||||
// round to sec
|
||||
newData.beginTime = (newData.beginTime / 1000) * 1000;
|
||||
@@ -95,7 +95,7 @@ Core::FunctionReplyObject HandlerSituationReplay::startReplayRequest(const Situa
|
||||
newData.endTime = ((newData.endTime / 1000) + 1) * 1000;
|
||||
|
||||
if (!m_objSrp && !createObject(newData))
|
||||
return Core::FunctionReplyObject(request.replayPartitionId(),tr_lts("dds", "Internal error"));
|
||||
return Core::FunctionReplyObject(request.replayPartitionId,tr_lts("dds", "Internal error"));
|
||||
|
||||
m_objSrp->setSrpData(newData);
|
||||
return Core::FunctionReplyObject(m_objSrp->getId());
|
||||
@@ -106,10 +106,10 @@ Core::FunctionReplyObject HandlerSituationReplay::stopReplayRequest(const Situat
|
||||
DEBUG_LOG(m_logger) << "onStopReplayRequest: " << request;
|
||||
|
||||
if (m_objSrp == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "SituationReplay for replayPartitionId %1 not found")).arg(request.replayPartitionId());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "SituationReplay for replayPartitionId %1 not found")).arg(request.replayPartitionId);
|
||||
|
||||
if (m_objSrp && (m_objSrp->getId() != request.id() || m_objSrp->getReplayPartitionId() != request.replayPartitionId()))
|
||||
return Core::FunctionReplyObject(request.id(),tr_lts("dds", "Given request id %1 not equal object id %2")).arg(request.id()).arg(m_objSrp->getId());
|
||||
if (m_objSrp && (m_objSrp->getId() != request.id || m_objSrp->getReplayPartitionId() != request.replayPartitionId))
|
||||
return Core::FunctionReplyObject(request.id,tr_lts("dds", "Given request id %1 not equal object id %2")).arg(request.id).arg(m_objSrp->getId());
|
||||
|
||||
Core::FunctionReplyObject ret = m_objSrp->switchToState(SrpState::Stopped);
|
||||
if (!ret.error())
|
||||
@@ -123,42 +123,42 @@ Core::FunctionReplyObject HandlerSituationReplay::stopReplayRequest(const Situat
|
||||
|
||||
Core::FunctionReplyObject HandlerSituationReplay::changeReplayStateRequest(const SituationReplay::ChangeReplayStateRequest &request)
|
||||
{
|
||||
if (request.state() != SrpState_def::Started)
|
||||
if (request.state != SrpState::Started)
|
||||
{
|
||||
if (m_objSrp == nullptr)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "SituationReplay for replayPartitionId %1 not found")).arg(request.replayPartitionId());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "SituationReplay for replayPartitionId %1 not found")).arg(request.replayPartitionId);
|
||||
|
||||
if (m_objSrp && (m_objSrp->getId() != request.id() || m_objSrp->getReplayPartitionId() != request.replayPartitionId()))
|
||||
return Core::FunctionReplyObject(request.id(),tr_lts("dds", "Given request id %1 not equal object id %2")).arg(request.id()).arg(m_objSrp->getId());
|
||||
if (m_objSrp && (m_objSrp->getId() != request.id || m_objSrp->getReplayPartitionId() != request.replayPartitionId))
|
||||
return Core::FunctionReplyObject(request.id,tr_lts("dds", "Given request id %1 not equal object id %2")).arg(request.id).arg(m_objSrp->getId());
|
||||
}
|
||||
|
||||
if (request.pace().is_set())
|
||||
m_objSrp->setPace(request.pace().get());
|
||||
if (request.pace.is_set())
|
||||
m_objSrp->setPace(request.pace.get());
|
||||
|
||||
switch (request.state().underlying())
|
||||
switch (request.state)
|
||||
{
|
||||
case SrpState_def::Unknown:
|
||||
if (request.pace().is_set())
|
||||
return Core::FunctionReplyObject(request.id());
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Can not handle command 'Unknown' in changeReplayStateRequest"));
|
||||
case SrpState_def::Started:
|
||||
case SrpState::Unknown:
|
||||
if (request.pace.is_set())
|
||||
return Core::FunctionReplyObject(request.id);
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Can not handle command 'Unknown' in changeReplayStateRequest"));
|
||||
case SrpState::Started:
|
||||
return startReplayRequest(request);
|
||||
case SrpState_def::Resumed:
|
||||
case SrpState::Resumed:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Resume request: " << request.beginTime() << ", cur playback time: " << m_objSrp->currentReplayTime();
|
||||
if (request.beginTime() != 0 && request.beginTime() != m_objSrp->currentReplayTime())
|
||||
DEBUG_LOG(m_logger) << "Resume request: " << request.beginTime << ", cur playback time: " << m_objSrp->currentReplayTime();
|
||||
if (request.beginTime != 0 && request.beginTime != m_objSrp->currentReplayTime())
|
||||
{
|
||||
stopReplayRequest(request);
|
||||
return startReplayRequest(request);
|
||||
}
|
||||
Q_FALLTHROUGH();
|
||||
case SrpState_def::Paused:
|
||||
return m_objSrp->switchToState(request.state());
|
||||
case SrpState::Paused:
|
||||
return m_objSrp->switchToState(request.state);
|
||||
}
|
||||
case SrpState_def::Stopped:
|
||||
case SrpState::Stopped:
|
||||
return stopReplayRequest(request);
|
||||
}
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Unhandled request state %1")).arg(request.state().underlying());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Unhandled request state %1")).arg(static_cast<int>(request.state));
|
||||
}
|
||||
|
||||
void HandlerSituationReplay::onChangeReplayStateRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
+12
-12
@@ -40,13 +40,13 @@ ObjectSituationReplay::~ObjectSituationReplay()
|
||||
|
||||
bool ObjectSituationReplay::isStopped() const
|
||||
{
|
||||
return (m_data.srpStateId == SituationReplay::SrpState_def::Stopped);
|
||||
return (m_data.srpStateId == SituationReplay::SrpState::Stopped);
|
||||
}
|
||||
|
||||
bool ObjectSituationReplay::isRunning() const
|
||||
{
|
||||
return (m_data.srpStateId == SituationReplay::SrpState_def::Started ||
|
||||
m_data.srpStateId == SituationReplay::SrpState_def::Resumed);
|
||||
return (m_data.srpStateId == SituationReplay::SrpState::Started ||
|
||||
m_data.srpStateId == SituationReplay::SrpState::Resumed);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectSituationReplay::createObject(const Database::SrpSituationReplay &data)
|
||||
@@ -55,7 +55,7 @@ Core::FunctionReplyObject ObjectSituationReplay::createObject(const Database::Sr
|
||||
m_data = data;
|
||||
setPace(m_data.pace);
|
||||
m_data.id = 0;
|
||||
m_data.srpStateId = SituationReplay::SrpState_def::Unknown;
|
||||
m_data.srpStateId = SituationReplay::SrpState::Unknown;
|
||||
m_currentReplayTime = m_data.beginTime;
|
||||
if (m_db)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ Core::FunctionReplyObject ObjectSituationReplay::createObject(const Database::Sr
|
||||
// Id is serial -> will be generated by db => inside m_data after db-insert
|
||||
DEBUG_LOG(m_logger) << "New srpId: " << m_data.id;
|
||||
|
||||
switchToState(SituationReplay::SrpState_def::Stopped);
|
||||
switchToState(SituationReplay::SrpState::Stopped);
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ bool ObjectSituationReplay::checkPublishData()
|
||||
onPublishReplayTime();
|
||||
if (m_data.endTime != 0 && m_data.endTime < m_currentReplayTime)
|
||||
{
|
||||
if (switchToState(SrpState_def::Stopped).error())
|
||||
if (switchToState(SrpState::Stopped).error())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -234,7 +234,7 @@ bool ObjectSituationReplay::checkPublishData()
|
||||
QElapsedTimer timerReadData; if (m_logger.isInfoEnabled()) timerReadData.start();
|
||||
|
||||
m_dbReader->waitForAsyncOperations(m_data.endTime);
|
||||
if (switchToState(SrpState_def::Stopped).error())
|
||||
if (switchToState(SrpState::Stopped).error())
|
||||
return false;
|
||||
|
||||
if (m_logger.isInfoEnabled()) INFO_LOG(m_logger) << "m_dbReader->waitForAsyncOperations took " << timerReadData.elapsed() << " [ms]";
|
||||
@@ -262,21 +262,21 @@ Core::FunctionReplyObject ObjectSituationReplay::switchToState(SrpState newSrpSt
|
||||
<< ", current: " << m_data.srpStateId;
|
||||
if (m_data.srpStateId != newSrpState)
|
||||
{
|
||||
switch (newSrpState.underlying())
|
||||
switch (newSrpState)
|
||||
{
|
||||
case SrpState_def::Paused:
|
||||
case SrpState::Paused:
|
||||
if (!pause())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Could not pause replay"));
|
||||
break;
|
||||
case SrpState_def::Resumed:
|
||||
case SrpState::Resumed:
|
||||
if (!resume())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Could not resume replay"));
|
||||
break;
|
||||
case SrpState_def::Started:
|
||||
case SrpState::Started:
|
||||
if (!start())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Could not start replay"));
|
||||
break;
|
||||
case SrpState_def::Stopped:
|
||||
case SrpState::Stopped:
|
||||
if (!stop())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Could not stop replay"));
|
||||
break;
|
||||
|
||||
@@ -231,7 +231,7 @@ void StaticPublisher::publishTranslationBlob(const std::shared_ptr<ProjectDataMa
|
||||
return;
|
||||
|
||||
const QJsonObject jObj{ {QStringLiteral("translations"), arr} };
|
||||
const QByteArray data = QJsonDocument(jObj).toBinaryData();
|
||||
const QByteArray data = QJsonDocument(jObj).toJson(QJsonDocument::Compact);
|
||||
const QByteArray compressed = qCompress(data, 9);
|
||||
const QByteArray md5Sum = QCryptographicHash::hash(compressed, QCryptographicHash::Md5).toHex();
|
||||
|
||||
|
||||
Reference in new issue
Block a user