Migrates OcSituation and ServiceManagement to generated rtiddsgen API

Converts accessor calls to plain member access in osc, oss and obd services.
This commit is contained in:
berrux-dev committed 2026-09-21 02:46:47 +02:00
1 parent 95071993f5
commit 3ec4208139
30 files changed
+1000 -1007

No files matched your search

@@ -98,11 +98,11 @@ bool DataTopicTests::write(const ServiceManagement::ServiceInformation &data)
{
INFO_LOG(m_logger) << "Publish topic ServiceInformation ";
DEBUG_LOG(m_logger) << "Id: " << data.id()
<< ", Name: " << data.name()
<< ", State: " << data.state()
<< ", Timestamp: " << data.timestamp()
<< ", ErrorString: " << data.errorString()
DEBUG_LOG(m_logger) << "Id: " << data.id
<< ", Name: " << data.name
<< ", State: " << data.state
<< ", Timestamp: " << data.timestamp
<< ", ErrorString: " << data.errorString
;
return m_dtsServiceInformation->write(data);
@@ -116,7 +116,7 @@ bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
{
QString services;
for(int serviceId : data.services())
for(int serviceId : data.services)
{
services.append(QString::number(serviceId));
services.append(QLatin1Char(','));
@@ -125,12 +125,12 @@ bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
if(services.endsWith(QLatin1Char(',')))
services.chop(1);
DEBUG_LOG(m_logger) << "Type: " << data.type()
<< ", Domain: " << data.domainId()
<< ", Partition: " << data.exercisePartitionId()
<< ", Partition: " << data.replayPartitionId()
DEBUG_LOG(m_logger) << "Type: " << data.type
<< ", Domain: " << data.domainId
<< ", Partition: " << data.exercisePartitionId
<< ", Partition: " << data.replayPartitionId
<< ", Services: " << services
<< ", Timestamp: " << data.timestamp();
<< ", Timestamp: " << data.timestamp;
}
return m_dtsGroupInformation->write(data);
@@ -151,11 +151,11 @@ void DataTopicTests::processData(const ServiceManagement::ServiceInformation &in
Q_UNUSED(modType);
INFO_LOG(m_logger) << "process Lts_ServiceInformation";
DEBUG_LOG(m_logger) << "Id: " << instance.id();
DEBUG_LOG(m_logger) << "Name: " << instance.name();
DEBUG_LOG(m_logger) << "State: " << instance.state();
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
DEBUG_LOG(m_logger) << "ErrorString: " << instance.errorString();
DEBUG_LOG(m_logger) << "Id: " << instance.id;
DEBUG_LOG(m_logger) << "Name: " << instance.name;
DEBUG_LOG(m_logger) << "State: " << instance.state;
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp;
DEBUG_LOG(m_logger) << "ErrorString: " << instance.errorString;
m_receivedServiceInformationData = instance;
@@ -173,7 +173,7 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
{
QString services;
for(int serviceId : instance.services())
for(int serviceId : instance.services)
{
services.append(QString::number(serviceId));
services.append(QLatin1Char(','));
@@ -182,12 +182,12 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
if(services.endsWith(QLatin1Char(',')))
services.chop(1);
DEBUG_LOG(m_logger) << "Type: " << instance.type();
DEBUG_LOG(m_logger) << "Domain: " << instance.domainId();
DEBUG_LOG(m_logger) << "Partition: " << instance.exercisePartitionId();
DEBUG_LOG(m_logger) << "Replay Partition: " << instance.replayPartitionId();
DEBUG_LOG(m_logger) << "Type: " << instance.type;
DEBUG_LOG(m_logger) << "Domain: " << instance.domainId;
DEBUG_LOG(m_logger) << "Partition: " << instance.exercisePartitionId;
DEBUG_LOG(m_logger) << "Replay Partition: " << instance.replayPartitionId;
DEBUG_LOG(m_logger) << "Services: " << services;
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp;
}
m_receivedGroupInformationData = instance;
@@ -55,11 +55,11 @@ void DataTopicTestsMain::publishServiceInformationTestCase()
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ServiceInformation data";
// Topic ServiceInformation
m_sentServiceInformationData.id(13);
m_sentServiceInformationData.name("UnitTest dummy Service");
m_sentServiceInformationData.state(Core::RunningState::inner_enum::NotYetStarted);
m_sentServiceInformationData.timestamp(QDateTime::currentMSecsSinceEpoch());
m_sentServiceInformationData.errorString(QStringLiteral("UnitTest dummy Error").toStdString());
m_sentServiceInformationData.id = 13;
m_sentServiceInformationData.name = "UnitTest dummy Service";
m_sentServiceInformationData.state = Core::RunningState::NotYetStarted;
m_sentServiceInformationData.timestamp = QDateTime::currentMSecsSinceEpoch();
m_sentServiceInformationData.errorString = QStringLiteral("UnitTest dummy Error").toStdString();
QVERIFY2(m_dtTest->write(m_sentServiceInformationData), "Publishing Topic ServiceInformation failed");
}
@@ -72,11 +72,11 @@ void DataTopicTestsMain::subscribeServiceInformationTestCase()
ServiceManagement::ServiceInformation recvServiceInformation = m_dtTest->getReceivedServiceInformationData();
QCOMPARE(recvServiceInformation.id(), m_sentServiceInformationData.id());
QCOMPARE(recvServiceInformation.name(), m_sentServiceInformationData.name());
QCOMPARE(recvServiceInformation.state(), m_sentServiceInformationData.state());
QCOMPARE(recvServiceInformation.timestamp(), m_sentServiceInformationData.timestamp());
QCOMPARE(recvServiceInformation.errorString(), m_sentServiceInformationData.errorString());
QCOMPARE(recvServiceInformation.id, m_sentServiceInformationData.id);
QCOMPARE(recvServiceInformation.name, m_sentServiceInformationData.name);
QCOMPARE(recvServiceInformation.state, m_sentServiceInformationData.state);
QCOMPARE(recvServiceInformation.timestamp, m_sentServiceInformationData.timestamp);
QCOMPARE(recvServiceInformation.errorString, m_sentServiceInformationData.errorString);
}
void DataTopicTestsMain::publishGroupInformationTestCase()
@@ -86,11 +86,11 @@ void DataTopicTestsMain::publishGroupInformationTestCase()
std::vector<int> services = {1, 3, 5, 7, 11, 13, 17, 19, 23, 42};
// Topic GroupInformation
m_sentGroupInformationData.type(Core::ServiceGroupType::inner_enum::Master);
m_sentGroupInformationData.exercisePartitionId(113);
m_sentGroupInformationData.domainId(42);
m_sentGroupInformationData.services(services);
m_sentGroupInformationData.timestamp(QDateTime::currentMSecsSinceEpoch());
m_sentGroupInformationData.type = Core::ServiceGroupType::Master;
m_sentGroupInformationData.exercisePartitionId = 113;
m_sentGroupInformationData.domainId = 42;
m_sentGroupInformationData.services = services;
m_sentGroupInformationData.timestamp = QDateTime::currentMSecsSinceEpoch();
QVERIFY2(m_dtTest->write(m_sentGroupInformationData), "Publishing Topic GroupInformation failed");
}
@@ -103,11 +103,11 @@ void DataTopicTestsMain::subscribeGroupInformationTestCase()
ServiceManagement::GroupInformation recvGroupInformation = m_dtTest->getReceivedGroupInformationData();
QCOMPARE(recvGroupInformation.type(), m_sentGroupInformationData.type());
QCOMPARE(recvGroupInformation.exercisePartitionId(), m_sentGroupInformationData.exercisePartitionId());
QCOMPARE(recvGroupInformation.domainId(), m_sentGroupInformationData.domainId());
QCOMPARE(recvGroupInformation.services(), m_sentGroupInformationData.services());
QCOMPARE(recvGroupInformation.timestamp(), m_sentGroupInformationData.timestamp());
QCOMPARE(recvGroupInformation.type, m_sentGroupInformationData.type);
QCOMPARE(recvGroupInformation.exercisePartitionId, m_sentGroupInformationData.exercisePartitionId);
QCOMPARE(recvGroupInformation.domainId, m_sentGroupInformationData.domainId);
QCOMPARE(recvGroupInformation.services, m_sentGroupInformationData.services);
QCOMPARE(recvGroupInformation.timestamp, m_sentGroupInformationData.timestamp);
}
void DataTopicTestsMain::cleanupTestCase()
@@ -59,7 +59,7 @@ LtsWebSocket::ReplyMessage *DataManager::servicesInformation(const QString &uuid
const auto ports = service->ports().get();
for (const auto &port : ports)
serviceInfo.ports.append(ServicePortsInformationMessage::PortInformation({port.number(), port.type().underlying(), QString::fromStdString(port.properties())}));
serviceInfo.ports.append(ServicePortsInformationMessage::PortInformation{port.number, static_cast<int32_t>(port.type), QString::fromStdString(port.properties)});
exerciseInfo.services.append(serviceInfo);
}
@@ -80,13 +80,13 @@ bool Group::setRunningState(Core::RunningState newState)
INFO_LOG(m_logger) << "Setting RunningState of group "
<< m_scheme->groupType
<< " in exercisePartition "
<< m_groupData.exercisePartitionId()
<< m_groupData.exercisePartitionId
<< ", replayPartition "
<< m_groupData.replayPartitionId()
<< m_groupData.replayPartitionId
<< " to "
<< newState;
switch (newState.underlying())
switch (newState)
{
case Core::RunningState::Running:
case Core::RunningState::Starting:
@@ -275,9 +275,9 @@ void Group::onNewServiceInfo()
GroupInformation info(m_groupId,
lastHeartbeatMSec(),
m_scheme->groupType,
m_groupData.domainId(),
m_groupData.exercisePartitionId(),
m_groupData.replayPartitionId(),
m_groupData.domainId,
m_groupData.exercisePartitionId,
m_groupData.replayPartitionId,
serviceIds);
TRACE_LOG(m_logger) << "Publishing new GroupInformation: " << info;
@@ -350,11 +350,11 @@ void Group::onCompleteCoreTick()
QTimer::singleShot(1000, this, &Group::onCompleteCoreTick);
}
ServiceProcess *Group::procFromPid(Q_PID pid)
ServiceProcess *Group::procFromPid(qint64 pid)
{
for (ServiceProcess *proc :qAsConst(m_serviceProcs))
{
if (proc->pid() == pid)
if (proc->processId() == pid)
return proc;
}
DEBUG_LOG(m_logger) << "Searched for not existing process with PID "
@@ -51,9 +51,9 @@ public:
bool allProcsStopped() const;
Core::ServiceGroupType type() const;
int32_t domainId() const { return m_groupData.domainId(); }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId(); }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId(); }
int32_t domainId() const { return m_groupData.domainId; }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId; }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId; }
int32_t id() const { return m_groupId; }
qint64 lastHeartbeatMSec() const;
@@ -65,7 +65,7 @@ private Q_SLOTS:
private: // methods
void init();
ServiceProcess *procFromPid(Q_PID pid);
ServiceProcess *procFromPid(qint64 pid);
private: // attributes
std::shared_ptr<DdsHandler> m_ddsHandler;
@@ -73,13 +73,13 @@ GroupScheme *GroupHandler::groupSchemeFromType(Core::ServiceGroupType type)
// TODO: make generic ...
QMap<Core::ServiceGroupType, QString> groupNameMapping;
groupNameMapping.insert(Core::ServiceGroupType_def::Master, QLatin1String("Master"));
groupNameMapping.insert(Core::ServiceGroupType_def::Core, QLatin1String("Core"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExercisePreparation, QLatin1String("ExercisePreparation"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExerciseExecution, QLatin1String("ExerciseExecution"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExercisePaused, QLatin1String("ExercisePaused"));
groupNameMapping.insert(Core::ServiceGroupType_def::ExerciseAfterActionReview, QLatin1String("ExerciseAfterActionReview"));
groupNameMapping.insert(Core::ServiceGroupType_def::Playback, QLatin1String("Playback"));
groupNameMapping.insert(Core::ServiceGroupType::Master, QLatin1String("Master"));
groupNameMapping.insert(Core::ServiceGroupType::Core, QLatin1String("Core"));
groupNameMapping.insert(Core::ServiceGroupType::ExercisePreparation, QLatin1String("ExercisePreparation"));
groupNameMapping.insert(Core::ServiceGroupType::ExerciseExecution, QLatin1String("ExerciseExecution"));
groupNameMapping.insert(Core::ServiceGroupType::ExercisePaused, QLatin1String("ExercisePaused"));
groupNameMapping.insert(Core::ServiceGroupType::ExerciseAfterActionReview, QLatin1String("ExerciseAfterActionReview"));
groupNameMapping.insert(Core::ServiceGroupType::Playback, QLatin1String("Playback"));
// if no scheme with type type exists, it will be newly generated and added
GroupScheme *newScheme = new GroupScheme(type, groupNameMapping.value(type));
@@ -92,10 +92,10 @@ Group *GroupHandler::getGroup(const GroupRequest &groupToFind) const
{
for (Group *group : m_groups)
{
if (group->type() == groupToFind.type() &&
group->exercisePartitionId() == groupToFind.exercisePartitionId() &&
group->domainId() == groupToFind.domainId() &&
group->replayPartitionId() == groupToFind.replayPartitionId())
if (group->type() == groupToFind.type &&
group->exercisePartitionId() == groupToFind.exercisePartitionId &&
group->domainId() == groupToFind.domainId &&
group->replayPartitionId() == groupToFind.replayPartitionId)
return group;
}
return nullptr;
@@ -110,7 +110,7 @@ Group *GroupHandler::getSimilarGroup(const GroupRequest &groupToFind) const
bool bSimilar = false;
for (const auto &type : possibleTypes)
{
if (type != groupToFind.type())
if (type != groupToFind.type)
continue;
bSimilar = true;
break;
@@ -121,10 +121,10 @@ Group *GroupHandler::getSimilarGroup(const GroupRequest &groupToFind) const
for(auto type : possibleTypes)
{
// don't find ourself ...
if (type == groupToFind.type())
if (type == groupToFind.type)
continue;
GroupRequest similarGroup(groupToFind);
similarGroup.type(type);
similarGroup.type = type;
Group *groupFound = getGroup(similarGroup);
if (groupFound)
return groupFound;
@@ -147,13 +147,13 @@ bool GroupHandler::startGroupCore(int32_t domainId)
DEBUG_LOG(m_logger) << "Starting core group ...";
GroupRequest groupToSearch;
groupToSearch.type(Core::ServiceGroupType::Core);
groupToSearch.domainId(domainId);
groupToSearch.type = Core::ServiceGroupType::Core;
groupToSearch.domainId = domainId;
Group *coreGroup = getGroup(groupToSearch);
if (coreGroup == nullptr)
{
GroupScheme *coreScheme = groupSchemeFromType(groupToSearch.type());
GroupScheme *coreScheme = groupSchemeFromType(groupToSearch.type);
if (coreScheme == nullptr)
{
@@ -190,15 +190,15 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
{
DEBUG_LOG(m_logger) << "New StartGroupRequest: " << request;
if (request.domainId() != m_ddsHandler->connector()->getDomainId())
return Core::FunctionReplyObject(request.requestId(),
if (request.domainId != m_ddsHandler->connector()->getDomainId())
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "This instance of ServiceManagement only allows to start a group in domain %1. Domain %2 was provided"))
.arg(m_ddsHandler->connector()->getDomainId())
.arg(request.domainId());
.arg(request.domainId);
// special case: request.type == Master, ExerciseId != 0 -> stopp all
if (request.type() == Core::ServiceGroupType::Master && request.exercisePartitionId() != 0)
return onStopAllForExercise(request.domainId(), request.exercisePartitionId());
if (request.type == Core::ServiceGroupType::Master && request.exercisePartitionId != 0)
return onStopAllForExercise(request.domainId, request.exercisePartitionId);
Group *existingGroup = getGroup(request);
// check if it's a Exercise group and search a group with the same exercise/domain -id
@@ -206,10 +206,10 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
// if the group does not exist, it is newly created (normal case)
if (existingGroup == nullptr)
{
GroupScheme *scheme = groupSchemeFromType(request.type());
GroupScheme *scheme = groupSchemeFromType(request.type);
if (scheme == nullptr)
return Core::FunctionReplyObject(request.requestId(),
tr_lts("dds", "Starting attempt of non existing group: %1")).arg(request.type().underlying());
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "Starting attempt of non existing group: %1")).arg(static_cast<int>(request.type));
existingGroup = new Group(m_ddsHandler, m_serviceDonator, request, scheme, this);
m_groups.append(existingGroup);
@@ -230,7 +230,7 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
existingGroup->start();
return Core::FunctionReplyObject(request.requestId());
return Core::FunctionReplyObject(request.requestId);
}
Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int exercisePartitionId)
@@ -286,7 +286,7 @@ Core::FunctionReplyObject GroupHandler::onStopGroup(const GroupRequest &request)
Group *existingGroup = getGroup(request);
if (existingGroup == nullptr)
return Core::FunctionReplyObject(request.requestId(),
return Core::FunctionReplyObject(request.requestId,
tr_lts("dds", "Could not stop Group, because it does not exist"));
existingGroup->stop();
@@ -295,7 +295,7 @@ Core::FunctionReplyObject GroupHandler::onStopGroup(const GroupRequest &request)
m_groups.removeAll(existingGroup);
delete existingGroup;
return Core::FunctionReplyObject(request.requestId());
return Core::FunctionReplyObject(request.requestId);
}
void GroupHandler::onRestartGroupRequest(const rti::core::SampleIdentity &cookie,
@@ -64,9 +64,9 @@ bool LicenceHandler::isServiceLicensed(const QString &licenceName) const
void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie,
const LicenceRequest &request)
{
INFO_LOG(m_logger) << "Try to getLicence (from DDS) for '" << request.name() << "' ...";
INFO_LOG(m_logger) << "Try to getLicence (from DDS) for '" << request.name << "' ...";
Core::FunctionReplyObject ret = getLicenceInternal(QString::fromStdString(request.name()));
Core::FunctionReplyObject ret = getLicenceInternal(QString::fromStdString(request.name));
m_ddsHandler->fts()->getLicenceReply(cookie, ret);
return;
@@ -76,9 +76,9 @@ void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie
void LicenceHandler::onFreeLicenceRequest(const rti::core::SampleIdentity &cookie,
const LicenceRequest &request)
{
INFO_LOG(m_logger) << "Try to freeLicence (from DDS) for '" << request.name() << "' ...";
INFO_LOG(m_logger) << "Try to freeLicence (from DDS) for '" << request.name << "' ...";
Core::FunctionReplyObject ret = freeLicenceInternal(QString::fromStdString(request.name()));
Core::FunctionReplyObject ret = freeLicenceInternal(QString::fromStdString(request.name));
m_ddsHandler->fts()->freeLicenceReply(cookie, ret);
return;
@@ -327,12 +327,12 @@ ServiceManagement::LicenceInformation LicenceHandler::toDdsData(const LtsLicence
{
ServiceManagement::LicenceInformation ddsData;
ddsData.name(data.name.toStdString());
ddsData.ignoreMaxCount(data.ignoreMaxCount);
ddsData.maxCount(data.maxCount);
ddsData.ignoreExpiration(data.ignoreExpiration);
ddsData.expiration(data.expiration.toMSecsSinceEpoch());
ddsData.refCount(data.licenceRefCount);
ddsData.name = data.name.toStdString();
ddsData.ignoreMaxCount = data.ignoreMaxCount;
ddsData.maxCount = data.maxCount;
ddsData.ignoreExpiration = data.ignoreExpiration;
ddsData.expiration = data.expiration.toMSecsSinceEpoch();
ddsData.refCount = data.licenceRefCount;
return ddsData;
} // end of toDdsData()
@@ -107,14 +107,14 @@ bool MainHandler::readServices()
int serviceCount = 0;
// TODO: make generic ... will be implemented in a future core library
QMap<QString, Core::ServiceGroupType_def::type> groupNameMapping;
groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType_def::Master);
groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType_def::Core);
groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType_def::ExercisePreparation);
groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType_def::ExerciseExecution);
groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType_def::ExercisePaused);
groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType_def::ExerciseAfterActionReview);
groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType_def::Playback);
QMap<QString, Core::ServiceGroupType> groupNameMapping;
groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType::Master);
groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType::Core);
groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType::ExercisePreparation);
groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType::ExerciseExecution);
groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType::ExercisePaused);
groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType::ExerciseAfterActionReview);
groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType::Playback);
while (directoryIterator.hasNext())
{
@@ -80,14 +80,14 @@ void ServiceManagement::ServiceHandler::onRestartServiceRequest(const rti::core:
{
DEBUG_LOG(m_logger) << "onRestartServiceRequest " << request;
ServiceProcess *proc = serviceProcessFromServiceProcId(request.id());
ServiceProcess *proc = serviceProcessFromServiceProcId(request.id);
Core::FunctionReplyObject ret(request.id());
Core::FunctionReplyObject ret(request.id);
if (proc == nullptr)
{
INFO_LOG(m_logger) << "Got restart request for non existing service ID "
<< request.id();
ret.setStr(tr_lts("dds", "There is no ServiceProcess with id %1")).arg(request.id());
<< request.id;
ret.setStr(tr_lts("dds", "There is no ServiceProcess with id %1")).arg(request.id);
m_ddsHandler->fts()->restartServiceReply(cookie, ret);
return;
}
@@ -125,7 +125,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromProc(const ServiceIn
m_ddsHandler->dts()->publish(info);
m_unknownPidsWarned.remove(info.pid());
m_unknownPidsWarned.remove(info.pid);
}
void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::CurrentRunningState &data, DataModification type)
@@ -135,13 +135,13 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
TRACE_LOG(m_logger) << "Got new CurrentRunningState: " << data;
if (!data.pid())
if (!data.pid)
{
INFO_LOG(m_logger) << "PID 0 is not allowed.";
return;
}
ServiceProcess *proc = serviceProcessFromPid(data.pid());
ServiceProcess *proc = serviceProcessFromPid(data.pid);
Core::CurrentRunningState retData = data;
if (proc == nullptr)
@@ -151,11 +151,11 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
{
for (ServiceProcess *currentProc : qAsConst(currentService->allProcs()))
{
if (currentProc->remotePid() == data.pid())
if (currentProc->remotePid() == data.pid)
{
DEBUG_LOG(m_logger) << "Found my prog " << data.pid() << " to "<< currentProc->pid() << " " << currentProc->serviceName();
DEBUG_LOG(m_logger) << "Found my prog " << data.pid << " to "<< currentProc->processId() << " " << currentProc->serviceName();
proc = currentProc;
retData.pid() = proc->processId();
retData.pid = proc->processId();
found = true;
break;
}
@@ -168,11 +168,11 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
if (proc == nullptr)
{
if (!m_unknownPidsWarned.contains(data.pid()))
if (!m_unknownPidsWarned.contains(data.pid))
{
ERROR_LOG(m_logger) << "Got CurrentRunningState for non existing process with PID "
<< data.pid();
m_unknownPidsWarned += data.pid();
<< data.pid;
m_unknownPidsWarned += data.pid;
}
return;
}
@@ -232,7 +232,7 @@ void ServiceManagement::ServiceHandler::onHeartBeatObserverTimerTimeout()
if (currentProc->failedStartingAttempts() > 3)
continue;
const qint64 minAge = (currentProc->runningState() == Core::RunningState_def::Starting)
const qint64 minAge = (currentProc->runningState() == Core::RunningState::Starting)
? minHeartbeatAgeStartup
: minHeartbeatAge;
@@ -36,8 +36,8 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
, m_pidProc(new QProcess(this))
, m_logger(getLogger("ServiceProcess"))
{
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
bool isInReplayGroup = false;
for(const QString &currentGroup : parentService->groups())
@@ -50,9 +50,9 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
}
if (isInReplayGroup)
args << QStringLiteral("-r") << QString::number(m_groupData.replayPartitionId());
args.reserve(args.size() + m_groupData.additionalStartParameter().size());
for (const std::string &arg : m_groupData.additionalStartParameter())
args << QStringLiteral("-r") << QString::number(m_groupData.replayPartitionId);
args.reserve(args.size() + m_groupData.additionalStartParameter.size());
for (const std::string &arg : m_groupData.additionalStartParameter)
args << QString::fromStdString(arg);
setArguments(args);
@@ -146,8 +146,8 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
m_pidProc->kill();
m_pidProc->setProgram(QStringLiteral("ssh"));
//DEBUG_LOG(m_logger) << sshCmd;
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
setProgram(QStringLiteral("ssh"));
QStringList remoteCommand2;
remoteCommand2.append(Settings::hlaRemoteServer());
@@ -190,8 +190,8 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
m_pidProc->kill();
m_pidProc->setProgram(QStringLiteral("ssh"));
//DEBUG_LOG(m_logger) << sshCmd;
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
setProgram(QStringLiteral("ssh"));
QStringList remoteCommand2;
remoteCommand2.append(Settings::hlaRemoteServer());
@@ -245,15 +245,15 @@ int ServiceManagement::ServiceProcess::serviceProcessId() const
void ServiceManagement::ServiceProcess::setNewStateFromHeartbeat(const Core::CurrentRunningState &data)
{
DEBUG_LOG(m_logger) << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState();
DEBUG_LOG(m_logger) << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState;
m_failedStartAttemptCounter = 0;
m_lastHeartbeatMSec = QDateTime::currentMSecsSinceEpoch();
m_runningState = data.runningState();
m_ports = data.ports();
m_runningState = data.runningState;
m_ports = data.ports;
std::string es;
if (data.errorString().is_set())
es = data.errorString().get();
if (data.errorString.is_set())
es = data.errorString.get();
ServiceInformation info(m_serviceProcessId,
m_lastHeartbeatMSec,
@@ -267,8 +267,8 @@ void ServiceManagement::ServiceProcess::setNewStateFromHeartbeat(const Core::Cur
void ServiceManagement::ServiceProcess::killallRemote()
{
QStringList arg({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
QStringList arg({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId),
QStringLiteral("-d"), QString::number(m_groupData.domainId)});
QProcess sh;
sh.setProgram(QStringLiteral("ssh"));
QStringList args;
@@ -401,7 +401,7 @@ void ServiceManagement::ServiceProcess::setNewStateFromChangeRequest(const Core:
{
if (m_runningState != newState)
{
switch (newState.underlying())
switch (newState)
{
case Core::RunningState::Running:
case Core::RunningState::Starting:
@@ -31,10 +31,10 @@ public:
int serviceProcessId() const;
qint64 lastHeartbeatMSec() const;
void setLastHeartbeatMSec(qint64 lastHeartbeatMSec);
int32_t domainId() const { return m_groupData.domainId(); }
int32_t domainId() const { return m_groupData.domainId; }
int32_t prio() const { return m_prio; }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId(); }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId(); }
int32_t exercisePartitionId() const { return m_groupData.exercisePartitionId; }
int32_t replayPartitionId() const { return m_groupData.replayPartitionId; }
QString serviceName() const;
QString abbreviation() const;
dds::core::optional<std::vector<Core::PortInformation>> ports() const;
@@ -46,14 +46,7 @@ public:
void killallRemote();
qint64 usablePid() const
{
#ifdef WIN32
auto myPid = pid();
if (!myPid)
return 0;
return myPid->dwProcessId;
#else
return pid();
#endif
return processId();
}
void restart();