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
+75
-75
@@ -20,17 +20,17 @@ namespace AlarmManagement
|
||||
static AlarmConfig toDds(const Database::AlmConfig &data)
|
||||
{
|
||||
AlarmConfig almConfig;
|
||||
almConfig.id(data.id);
|
||||
almConfig.operatorId(data.operatorId);
|
||||
almConfig.id = data.id;
|
||||
almConfig.operatorId = data.operatorId;
|
||||
if (data.participantId.isValid())
|
||||
almConfig.participantId(data.participantId.toInt());
|
||||
almConfig.participantId = data.participantId.toInt();
|
||||
else
|
||||
almConfig.participantId(0);
|
||||
almConfig.eventTypeId(data.eventTypeId);
|
||||
almConfig.messageWindow(data.messageWindow);
|
||||
almConfig.global(data.global);
|
||||
almConfig.vulnerabilityState(data.vulnerabilityState);
|
||||
almConfig.setMarker(data.setMarker);
|
||||
almConfig.participantId = 0;
|
||||
almConfig.eventTypeId = data.eventTypeId;
|
||||
almConfig.messageWindow = data.messageWindow;
|
||||
almConfig.global = data.global;
|
||||
almConfig.vulnerabilityState = data.vulnerabilityState;
|
||||
almConfig.setMarker = data.setMarker;
|
||||
return almConfig;
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ void HandlerConfigureAlarms::removeAlarmConfig(int operatorId,
|
||||
DEBUG_LOG(m_logger) << "key= " << i.key() << ": "
|
||||
<< " operatorId=" << i.value().operatorId
|
||||
<< " participantId=" << i.value().participantId.toInt()
|
||||
<< " eventTypeId=" << i.value().eventTypeId.underlying();
|
||||
<< " eventTypeId=" << i.value().eventTypeId;
|
||||
if ((operatorId == i.value().operatorId)
|
||||
&& (participantId == i.value().participantId)
|
||||
&& (eventTypeId == ProjectDataManagement::PdmEventType_def::Unknown || eventTypeId == i.value().eventTypeId.underlying()))
|
||||
&& (eventTypeId == static_cast<int>(ProjectDataManagement::PdmEventType::EventType_Unknown) || eventTypeId == static_cast<int>(i.value().eventTypeId)))
|
||||
{
|
||||
const int key = i.key();
|
||||
DEBUG_LOG(m_logger) << "found alarm to remove: " << key << ", eventTypeId: " << eventTypeId;
|
||||
@@ -142,69 +142,69 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
|
||||
const ConfigureAlarmsRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onConfigureAlarmsRequest " << request;
|
||||
if (request.participantIds().size() == 0)
|
||||
if (request.participantIds.size() == 0)
|
||||
{
|
||||
Core::FunctionReplyObject ret(0, tr_lts("dds", "Error adding ConfigureAlarms to database. There were no participants given."));
|
||||
m_mainHandler->dds()->ftsAlm()->configureAlarmsReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.remove())
|
||||
if (request.remove)
|
||||
{
|
||||
// remove only this one Alarm, not all types of the participant for operator
|
||||
// in DB,
|
||||
// from DDS
|
||||
DEBUG_LOG(m_logger) << "request.remove()";
|
||||
if (request.participantIds().size() > 0 &&
|
||||
request.alarms().size() > 0)
|
||||
if (request.participantIds.size() > 0 &&
|
||||
request.alarms.size() > 0)
|
||||
{
|
||||
int participantId = request.participantIds()[0];
|
||||
int eventTypeId = request.alarms()[0].eventTypeId().underlying();
|
||||
DEBUG_LOG(m_logger) << "removeAlarmConfig(request.operatorId()=" << request.operatorId()
|
||||
int participantId = request.participantIds[0];
|
||||
int eventTypeId = static_cast<int>(request.alarms[0].eventTypeId);
|
||||
DEBUG_LOG(m_logger) << "removeAlarmConfig(request.operatorId()=" << request.operatorId
|
||||
<< " participantId=" << participantId
|
||||
<< " eventTypeId=" << eventTypeId;
|
||||
removeAlarmConfig(request.operatorId(), participantId, eventTypeId);
|
||||
removeAlarmConfig(request.operatorId, participantId, eventTypeId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove old configuration
|
||||
for (int participantId : request.participantIds())
|
||||
for (int participantId : request.participantIds)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "remove old configuration participantId=" << participantId;
|
||||
removeAlarmConfig(request.operatorId(), participantId, 0);
|
||||
removeAlarmConfig(request.operatorId, participantId, 0);
|
||||
}
|
||||
if ( request.global())
|
||||
if ( request.global)
|
||||
{
|
||||
removeGlobalAlarmConfig(request.operatorId());
|
||||
removeGlobalAlarmConfig(request.operatorId);
|
||||
}
|
||||
|
||||
for (int participantId : request.participantIds())
|
||||
for (int participantId : request.participantIds)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "participantId: " << participantId;
|
||||
for (const AlarmManagement::AlarmAction &action : request.alarms())
|
||||
for (const AlarmManagement::AlarmAction &action : request.alarms)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "action: " << action;
|
||||
|
||||
AlarmManagement::AlarmConfig almConfig;
|
||||
almConfig.operatorId(request.operatorId());
|
||||
almConfig.participantId(participantId);
|
||||
almConfig.eventTypeId(action.eventTypeId());
|
||||
almConfig.messageWindow(action.messageWindow());
|
||||
almConfig.vulnerabilityState(action.vulnerabilityState());
|
||||
almConfig.setMarker(action.setMarker());
|
||||
almConfig.global(request.global());
|
||||
almConfig.operatorId = request.operatorId;
|
||||
almConfig.participantId = participantId;
|
||||
almConfig.eventTypeId = action.eventTypeId;
|
||||
almConfig.messageWindow = action.messageWindow;
|
||||
almConfig.vulnerabilityState = action.vulnerabilityState;
|
||||
almConfig.setMarker = action.setMarker;
|
||||
almConfig.global = request.global;
|
||||
|
||||
Database::AlmConfig newConfig;
|
||||
newConfig.operatorId = request.operatorId();
|
||||
newConfig.operatorId = request.operatorId;
|
||||
if (participantId != 0)
|
||||
newConfig.participantId = participantId;
|
||||
|
||||
newConfig.eventTypeId = action.eventTypeId();
|
||||
newConfig.messageWindow = action.messageWindow();
|
||||
newConfig.vulnerabilityState = action.vulnerabilityState();
|
||||
newConfig.setMarker = action.setMarker();
|
||||
newConfig.global = request.global();
|
||||
newConfig.eventTypeId = action.eventTypeId;
|
||||
newConfig.messageWindow = action.messageWindow;
|
||||
newConfig.vulnerabilityState = action.vulnerabilityState;
|
||||
newConfig.setMarker = action.setMarker;
|
||||
newConfig.global = request.global;
|
||||
if (!m_mainHandler->db()->insert(newConfig))
|
||||
{
|
||||
Core::FunctionReplyObject ret(0, tr_lts("dds", "Error adding ConfigureAlarms to database."));
|
||||
@@ -212,7 +212,7 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "m_dbAlmConfig.insert id=" << newConfig.id;
|
||||
|
||||
almConfig.id(newConfig.id);
|
||||
almConfig.id = newConfig.id;
|
||||
m_alarms.insert(newConfig.id, newConfig);
|
||||
m_mainHandler->dds()->dtsAlm()->publish(almConfig);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ void HandlerConfigureAlarms::onConfigureAlarmsRequest(const rti::core::SampleIde
|
||||
//-----------------------------------------------------------------------------
|
||||
void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event &eventData, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onParticipantEventChanged participantId=" << eventData.participantId();
|
||||
DEBUG_LOG(m_logger) << "onParticipantEventChanged participantId=" << eventData.participantId;
|
||||
if (modType == DataModification::eRemoved ||
|
||||
modType == DataModification::eModified)
|
||||
return;
|
||||
@@ -255,11 +255,11 @@ void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event
|
||||
<< " alarm.operatorId=" << alarm.operatorId
|
||||
<< " friendyFire =" << friendlyFireBool;*/
|
||||
|
||||
if ((alarm.eventTypeId == eventDatalocal.eventTypeId().underlying()) ||
|
||||
(alarm.eventTypeId == ProjectDataManagement::PdmEventType_def::FriendlyFire && friendlyFireBool))
|
||||
if ((alarm.eventTypeId == eventDatalocal.eventTypeId) ||
|
||||
(alarm.eventTypeId == ProjectDataManagement::PdmEventType::EventType_FriendlyFire && friendlyFireBool))
|
||||
{
|
||||
if (friendlyFireBool && eventDatalocal.eventTypeId() == ProjectDataManagement::PdmEventType_def::FireEvent)
|
||||
eventDatalocal.eventTypeId(ProjectDataManagement::PdmEventType_def::FriendlyFire);
|
||||
if (friendlyFireBool && eventDatalocal.eventTypeId == ProjectDataManagement::PdmEventType::EventType_FireEvent)
|
||||
eventDatalocal.eventTypeId = ProjectDataManagement::PdmEventType::EventType_FriendlyFire;
|
||||
|
||||
participants.clear();
|
||||
if (alarm.participantId.isValid())
|
||||
@@ -275,13 +275,13 @@ void HandlerConfigureAlarms::onEventChanged(const ExerciseEventManagement::Event
|
||||
DEBUG_LOG(m_logger) << " allVulnerabilityStates=" << allVulnerabilityStates
|
||||
<< " vulnerabilityCheck=" << vulnerabilityCheck
|
||||
<< " participantId=" << participantId
|
||||
<< " eventDatalocal.participantId()=" << eventDatalocal.participantId();
|
||||
<< " eventDatalocal.participantId=" << eventDatalocal.participantId;
|
||||
if (((allVulnerabilityStates || vulnerabilityCheck) &&
|
||||
(participantId == eventDatalocal.participantId())) || globalAlarm)
|
||||
(participantId == eventDatalocal.participantId)) || globalAlarm)
|
||||
{
|
||||
if (sentEventToOperator.contains(alarm.operatorId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Event " << eventDatalocal.eventTypeId() << " already handled for Operator:" << alarm.operatorId;
|
||||
DEBUG_LOG(m_logger) << "Event " << eventDatalocal.eventTypeId << " already handled for Operator:" << alarm.operatorId;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -311,13 +311,13 @@ void HandlerConfigureAlarms::sendWindow(const ExerciseEventManagement::Event &ev
|
||||
QJsonObject eventObject = getEventProperties(eventData);
|
||||
QJsonObject obj;
|
||||
|
||||
wi.id(m_windowIndex);
|
||||
wi.operatorId(config.operatorId);
|
||||
wi.time(eventData.sampleTime());
|
||||
wi.eventId(eventData.id());
|
||||
wi.id = m_windowIndex;
|
||||
wi.operatorId = config.operatorId;
|
||||
wi.time = eventData.sampleTime;
|
||||
wi.eventId = eventData.id;
|
||||
|
||||
if (eventData.eventTypeId() == ProjectDataManagement::PdmEventType_def::CrossGlobalBorderline
|
||||
|| eventData.eventTypeId() == ProjectDataManagement::PdmEventType_def::CrossLocalBorderline)
|
||||
if (eventData.eventTypeId == ProjectDataManagement::PdmEventType::EventType_CrossGlobalBorderline
|
||||
|| eventData.eventTypeId == ProjectDataManagement::PdmEventType::EventType_CrossLocalBorderline)
|
||||
{
|
||||
if (eventObject.contains(QStringLiteral("Global")))
|
||||
obj[QStringLiteral("Global")] = eventObject.value(QStringLiteral("Global"));
|
||||
@@ -325,23 +325,23 @@ void HandlerConfigureAlarms::sendWindow(const ExerciseEventManagement::Event &ev
|
||||
if (eventObject.contains(QStringLiteral("FriendlyFire")))
|
||||
obj[QStringLiteral("FriendlyFire")] = eventObject.value(QStringLiteral("FriendlyFire"));
|
||||
if (eventObject.contains(QStringLiteral("AesId")))
|
||||
wi.aesId(eventObject.value(QStringLiteral("AesId")).toInt());
|
||||
wi.aesId = eventObject.value(QStringLiteral("AesId")).toInt();
|
||||
// AesEvent from the radio:
|
||||
int originatorType = eventObject[QStringLiteral("OriginatorType")].toInt();
|
||||
if (originatorType == ProjectDataManagement::StateChangeOriginator_def::AreaEffectSimulation
|
||||
|| originatorType == ProjectDataManagement::StateChangeOriginator_def::FunctionalArea)
|
||||
if (originatorType == static_cast<int>(ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation)
|
||||
|| originatorType == static_cast<int>(ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea))
|
||||
obj[QStringLiteral("aesId")] = eventObject[QStringLiteral("OriginatorId")].toInt();
|
||||
|
||||
wi.equipmentNumber(eventData.equipmentNumber());
|
||||
wi.eventType(eventData.eventTypeId());
|
||||
wi.participantId(eventData.participantId());
|
||||
wi.position(eventData.position());
|
||||
wi.equipmentNumber = eventData.equipmentNumber;
|
||||
wi.eventType = eventData.eventTypeId;
|
||||
wi.participantId = eventData.participantId;
|
||||
wi.position = eventData.position;
|
||||
|
||||
const QByteArray propertiesStr = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
wi.properties() = propertiesStr.data();
|
||||
wi.properties = propertiesStr.data();
|
||||
m_mainHandler->dds()->dtsAlm()->publish(wi);
|
||||
// take data from dds-bus after 1 min
|
||||
const auto id = wi.id();
|
||||
const auto id = wi.id;
|
||||
QTimer::singleShot(1 * 60 * 1000, this, [id, this]() { m_mainHandler->dds()->dtsAlm()->removeNotificationByKey(id); });
|
||||
incrementWindowIndex(); // m_windowIndex++;
|
||||
|
||||
@@ -351,7 +351,7 @@ void HandlerConfigureAlarms::sendWindow(const ExerciseEventManagement::Event &ev
|
||||
|
||||
QJsonObject HandlerConfigureAlarms::getEventProperties(const ExerciseEventManagement::Event &eventData)
|
||||
{
|
||||
return LtsUtils::JsonObject::fromJson(eventData.properties());
|
||||
return LtsUtils::JsonObject::fromJson(eventData.properties.c_str());
|
||||
}
|
||||
|
||||
void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &eventData,
|
||||
@@ -359,17 +359,17 @@ void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &ev
|
||||
{
|
||||
int defaultOffset = 10000;
|
||||
|
||||
DEBUG_LOG(m_logger) << "eventProperties =" << eventData.properties();
|
||||
DEBUG_LOG(m_logger) << "eventProperties =" << eventData.properties;
|
||||
|
||||
QString contentStr;
|
||||
contentStr = QStringLiteral("Equip No.: ");
|
||||
const int participantId = eventData.participantId();
|
||||
const int participantId = eventData.participantId;
|
||||
const int equipNo = m_mainHandler->hdlParticipant()->participantId2EquipNo(participantId);
|
||||
QJsonObject eventObject = getEventProperties(eventData);
|
||||
|
||||
contentStr += QString::number(equipNo);
|
||||
contentStr += QStringLiteral(" ");
|
||||
contentStr += ProjectDataManagement::toString(eventData.eventTypeId());
|
||||
contentStr += ProjectDataManagement::toString(eventData.eventTypeId);
|
||||
if (eventObject.contains(QStringLiteral("AesName")))
|
||||
{
|
||||
contentStr += QStringLiteral(" (");
|
||||
@@ -381,17 +381,17 @@ void HandlerConfigureAlarms::sendMarker(const ExerciseEventManagement::Event &ev
|
||||
const QByteArray contentArr = contentStr.toUtf8();
|
||||
|
||||
MarkerManagement::MarkerDescription ma;
|
||||
ma.content(contentArr.data());
|
||||
ma.markerType(MarkerManagement::MarkerType_def::Situation);
|
||||
ma.content = contentArr.data();
|
||||
ma.markerType = MarkerManagement::MarkerType::Situation;
|
||||
|
||||
MarkerManagement::Marker mcr;
|
||||
mcr.operatorId(config.operatorId);
|
||||
mcr.note(ma.content()); // really?
|
||||
mcr.timeStamp(eventData.sampleTime());
|
||||
mcr.timeStampOffset(defaultOffset);
|
||||
mcr.descriptions().push_back(ma);
|
||||
mcr.position(eventData.position());
|
||||
mcr.fileContentId(0); // we cannot save an image here
|
||||
mcr.operatorId = config.operatorId;
|
||||
mcr.note = ma.content; // really?
|
||||
mcr.timeStamp = eventData.sampleTime;
|
||||
mcr.timeStampOffset = defaultOffset;
|
||||
mcr.descriptions.push_back(ma);
|
||||
mcr.position = eventData.position;
|
||||
mcr.fileContentId = 0; // we cannot save an image here
|
||||
m_mainHandler->dds()->ftcMrk()->markerModifyRequest(mcr, this);
|
||||
|
||||
} // end sendMarker
|
||||
|
||||
Reference in new issue
Block a user