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

@@ -155,8 +155,8 @@ void HandlerOcData::onSendOcDataReply(const Core::FunctionReplyObject &reply)
void HandlerOcData::onRegisterParticipantReply(const ParticipantManagement::RegisterReply &reply)
{
if (reply.errorString().size())
ERROR_LOG(m_logger) << "Modify Participant data could not be send: " << reply.errorString();
if (reply.errorString.size())
ERROR_LOG(m_logger) << "Modify Participant data could not be send: " << reply.errorString;
else
DEBUG_LOG(m_logger) << "Modify Participant data send successfully to ppm!";
}
@@ -166,8 +166,8 @@ void HandlerOcData::onEvaluationSchemaChanged(const Evaluations::EvaluationSchem
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
if (data.sendToTa())
m_currentActiveEvaluationSchemaId = data.id();
if (data.sendToTa)
m_currentActiveEvaluationSchemaId = data.id;
}
void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataModification modType)
@@ -175,10 +175,10 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
if ((modType != DataModification::eAdded) && (modType != DataModification::eModified))
return;
if (data.sampleTime() < QDateTime::currentMSecsSinceEpoch() - 1000 * 60 * 10) // older than 10 mins -> ignore
if (data.sampleTime < QDateTime::currentMSecsSinceEpoch() - 1000 * 60 * 10) // older than 10 mins -> ignore
return;
const QByteArray payload = LtsUtils::toQByteArray(data.payload());
const QByteArray payload = LtsUtils::toQByteArray(data.payload);
unsigned int telegramId;
LtsUtils::get1Byte(payload, telegramId);
@@ -195,7 +195,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
}
case OcSituation::TelegramId::DemandEvaluationSchema:
{
handleDemandEvaluationSchema(payload, data.equipmentNumber());
handleDemandEvaluationSchema(payload, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::Evaluation:
@@ -205,7 +205,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
}
case OcSituation::TelegramId::DemandSituation:
{
handleDemandSituation(payload, data.equipmentNumber());
handleDemandSituation(payload, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::DemandAesItems:
@@ -213,7 +213,7 @@ void HandlerOcData::onOcDataChanged(const TrainingAreaBase::OcData &data, DataMo
OcSituation::AesType aesType;
size_t pos = 1;
LtsUtils::get1Byte(payload, pos, aesType);
m_handlerOcAesData->demandAesItems(aesType, data.equipmentNumber());
m_handlerOcAesData->demandAesItems(aesType, data.equipmentNumber);
break;
}
case OcSituation::TelegramId::EquipmentErrorRegistration:
@@ -248,7 +248,7 @@ void HandlerOcData::sendStateInformation()
LtsUtils::set2Byte(m_handlerOcAesData->iedResetCnt(), payload);
TrainingAreaBase::SendOcDataRequest out;
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
/*!
* \details Only if Tetra is connected, the OcData telegram will be send
* If we not check = A bunch of telegrams will be queued/stored until Tetra is connected, than Tetra is in Overload
@@ -257,9 +257,9 @@ void HandlerOcData::sendStateInformation()
while (conIt.hasNext())
{
conIt.next();
for (TrainingAreaBase::ConnectionState conState : conIt.value().connections())
for (TrainingAreaBase::ConnectionState conState : conIt.value().connections)
{
if (conState.name() == "TETRA" && conState.state() == false)
if (conState.name == "TETRA" && conState.state == false)
return;
}
}
@@ -297,39 +297,39 @@ void HandlerOcData::onSendEquipmentMessageOcRequest(const rti::core::SampleIdent
LtsUtils::set1Byte(OcSituation::TelegramId::Message, preparedPayload);
LtsUtils::set2Byte(0, preparedPayload); // dummy receiverId is individually set for each eqId in list
LtsUtils::set1Byte(Messaging::AddressType::ObserverController, preparedPayload);
LtsUtils::set2Byte(request.sender(), preparedPayload);
LtsUtils::set1Byte(request.senderType().underlying(), preparedPayload);
LtsUtils::set2Byte(request.sender, preparedPayload);
LtsUtils::set1Byte(request.senderType, preparedPayload);
LtsUtils::set2Byte(m_mainHandler->exerciseId(), preparedPayload);
preparedPayload.append(QByteArray::fromStdString(request.subject()));
preparedPayload.append(QByteArray::fromStdString(request.subject));
preparedPayload.append('\n'); // separating subject from message
preparedPayload.append(QByteArray::fromStdString(request.message()));
preparedPayload.append(QByteArray::fromStdString(request.message));
for (const auto equipmentNumber : request.equipmentNumbers())
for (const auto equipmentNumber : request.equipmentNumbers)
{
TrainingAreaBase::SendOcDataRequest out;
out.equipmentNumber(equipmentNumber);
out.equipmentNumber = equipmentNumber;
// replace 2 bytes with current receiver
QByteArray receiverId;
LtsUtils::set2Byte(equipmentNumber, receiverId);
QByteArray payload = preparedPayload.replace(1, 2, receiverId);
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
onSendOcData(out);
}
m_fts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId()));
m_fts->sendEquipmentMessageOcReply(cookie, Core::FunctionReplyObject(request.requestId));
}
void HandlerOcData::onEquipmentErrorRequest(const rti::core::SampleIdentity &cookie, const EquipmentErrorRequest &request)
{
ERROR_LOG(m_logger) << "onEquipmentErrorRequest" << request.equipmentNumber();
ERROR_LOG(m_logger) << "onEquipmentErrorRequest" << request.equipmentNumber;
EquipmentErrorRegistration out;
// out.id(request.requestId());
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
out.participant(QString::number(request.equipmentNumber()).toStdString());
out.device(request.device());
out.text(request.text());
out.sampleTime = QDateTime::currentMSecsSinceEpoch();
out.participant = QString::number(request.equipmentNumber).toStdString();
out.device = request.device;
out.text = request.text;
m_dts->publish(out);
m_fts->equipmentErrorReply(cookie, Core::FunctionReplyObject(request.requestId()));
m_fts->equipmentErrorReply(cookie, Core::FunctionReplyObject(request.requestId));
}
void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentId)
@@ -337,8 +337,8 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
OcSituation::SituationCenterType centerType;
int centerEquipmentId = 0, radius = 0;
Core::GeoPosition2D position;
position.lon(std::nan(""));
position.lat(std::nan(""));
position.lon = std::nan("");
position.lat = std::nan("");
bool initial = false;
size_t pos = 1;
@@ -355,9 +355,9 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
{
double tmp;
LtsUtils::get8Byte(data, pos, tmp);
position.lon(tmp);
position.lon = tmp;
LtsUtils::get8Byte(data, pos, tmp);
position.lat(tmp);
position.lat = tmp;
LtsUtils::get2Byte(data, pos, radius);
DEBUG_LOG(m_logger) << "Request from O/C-Laptop-Id: " << equipmentId
@@ -367,7 +367,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
LtsUtils::get1Byte(data, pos, initial);
LtsUtils::get1Byte(data, pos, filterActive);
QSet<ParticipantManagement::TypeClass::type> typeClassList{};
QSet<ParticipantManagement::TypeClass> typeClassList{};
QSet<int> partyList{};
if (filterActive)
{
@@ -387,7 +387,7 @@ void HandlerOcData::handleDemandSituation(const QByteArray &data, int equipmentI
{
int typClass;
LtsUtils::get1Byte(data, pos, typClass);
typeClassList.insert((ParticipantManagement::TypeClass::type)typClass);
typeClassList.insert((ParticipantManagement::TypeClass)typClass);
}
}
@@ -444,14 +444,14 @@ void HandlerOcData::handleDemandEvaluationSchema(const QByteArray &data, int equ
DEBUG_LOG(m_logger) << "Sending to equipmentnumber: " << equipmentNumber << " evaluation schmema: " << m_currentActiveEvaluationSchemaId;
TrainingAreaBase::SendOcDataRequest out;
out.equipmentNumber(equipmentNumber);
out.equipmentNumber = equipmentNumber;
QByteArray payload;
LtsUtils::set1Byte(OcSituation::TelegramId::EvaluationSchema, payload);
LtsUtils::set2Byte(schema.id(), payload);
QByteArray compressed = qCompress(QByteArray::fromStdString(schema.schemadata()));
LtsUtils::set2Byte(schema.id, payload);
QByteArray compressed = qCompress(QByteArray::fromStdString(schema.schemadata));
payload.append(compressed);
out.payload(LtsUtils::convert<std::vector<uint8_t>>(payload));
out.payload = LtsUtils::convert<std::vector<uint8_t>>(payload);
onSendOcData(out);
}
@@ -464,27 +464,27 @@ void HandlerOcData::handleEvaluation(const QByteArray &data)
// get schema id
LtsUtils::get2Byte(data, pos, tmp);
out.schemaId(tmp);
out.schemaId = tmp;
// get sender operator id
LtsUtils::get4Byte(data, pos, tmp);
out.senderOperatorId(tmp);
out.senderOperatorId = tmp;
// get receiver operator id
LtsUtils::get4Byte(data, pos, tmp);
if (tmp > 0)
out.receiverOperatorId(dds::core::optional<int32_t>(tmp));
out.receiverOperatorId = dds::core::optional<int32_t>(tmp);
// get timeStamp
int64_t timeStamp;
LtsUtils::get8Byte(data, pos, timeStamp);
out.ts(timeStamp);
out.ts = timeStamp;
// get hierarchy string
unsigned int hierarchyLength;
LtsUtils::get2Byte(data, pos, hierarchyLength);
out.hierarchy(QByteArray(data.mid(pos, hierarchyLength)).toStdString());
out.hierarchy = QByteArray(data.mid(pos, hierarchyLength)).toStdString();
pos += hierarchyLength;
// get text string
unsigned int textLength;
LtsUtils::get2Byte(data, pos, textLength);
out.text(QByteArray(data.mid(pos, textLength)).toStdString());
out.text = QByteArray(data.mid(pos, textLength)).toStdString();
DEBUG_LOG(m_logger) << "Got new evl comment: " << out;
@@ -504,9 +504,9 @@ void HandlerOcData::handleMessage(const QByteArray &data)
recipientIds.push_back(tmp);
// get address type
LtsUtils::get1Byte(data, pos, addressType);
out.recipientType(static_cast<Messaging::AddressType::inner_enum>(addressType));
out.recipientType = static_cast<Messaging::AddressType>(addressType);
if (addressType == Messaging::AddressType::ObserverController)
if (addressType == static_cast<int>(Messaging::AddressType::ObserverController))
{
int participantId = m_ppmDtc->participantIdByEquipmentNumber(tmp);
if (participantId > 0)
@@ -517,48 +517,48 @@ void HandlerOcData::handleMessage(const QByteArray &data)
return;
}
}
out.recipientIds(recipientIds);
out.recipientIds = recipientIds;
// get sender
LtsUtils::get2Byte(data, pos, tmp);
LtsUtils::get1Byte(data, pos, addressType);
out.senderType(static_cast<Messaging::AddressType::inner_enum>(addressType));
if (addressType == Messaging::AddressType::ObserverController)
out.senderType = static_cast<Messaging::AddressType>(addressType);
if (addressType == static_cast<int>(Messaging::AddressType::ObserverController))
{
int participantId = m_ppmDtc->participantIdByEquipmentNumber(tmp);
if (participantId > 0)
out.senderId(participantId);
out.senderId = participantId;
else
{
WARNING_LOG(m_logger) << "Sender equipment number: " << tmp << " is unknown. Setting senderId to 0.";
out.senderId(0);
out.senderType(Messaging::AddressType::ObserverController);
out.senderId = 0;
out.senderType = Messaging::AddressType::ObserverController;
}
}
else
{
// no need to check if operator still exists, there is no harm if not
out.senderId(tmp);
out.senderId = tmp;
}
// get exerciseId
LtsUtils::get2Byte(data, pos, tmp);
if (tmp == 0)
WARNING_LOG(m_logger) << "Could'n set ExerciseId" << " " << tmp << " set to 0";
out.exerciseId(tmp);
out.exerciseId = tmp;
// get address type
const QByteArray msg(data.right(data.size() - pos));
int idx = msg.indexOf('\n');
if (idx < 0)
{
out.subject((tr("Message from %1").arg(out.senderId())).toStdString());
out.message(msg.constData());
out.subject = (tr("Message from %1").arg(out.senderId)).toStdString();
out.message = msg.constData();
}
else
{
out.subject(msg.left(idx).constData());
out.message(msg.mid(idx + 1).constData());
out.subject = msg.left(idx).constData();
out.message = msg.mid(idx + 1).constData();
}
DEBUG_LOG(m_logger) << "Got new message: " << out;
@@ -573,19 +573,19 @@ void HandlerOcData::handleEquipmentErrorRegistration(const QByteArray &data)
// equipmentNumber
LtsUtils::get2Byte(data, pos, tmp);
out.equipmentNumber(tmp);
out.equipmentNumber = tmp;
// participant
out.participant(data.mid(pos, 36).toStdString());
out.participant = data.mid(pos, 36).toStdString();
pos += 36;
// device
out.device(data.mid(pos, 36).toStdString());
out.device = data.mid(pos, 36).toStdString();
pos += 36;
// length
LtsUtils::get1Byte(data, pos, tmp);
// text
out.text(data.mid(pos, tmp).toStdString());
out.text = data.mid(pos, tmp).toStdString();
out.sampleTime(QDateTime::currentMSecsSinceEpoch());
out.sampleTime = QDateTime::currentMSecsSinceEpoch();
DEBUG_LOG(m_logger) << "Got new error registration: " << out;
m_dts->publish(out);
@@ -605,28 +605,28 @@ void HandlerOcData::handleEquipmentRegistration(const QByteArray &data)
ParticipantManagement::Participant part = m_ppmDtc->participant(participantId);
if (part.equipmentNumber().is_set() && equipmentNumber > 0)
if (part.equipmentNumber.is_set() && equipmentNumber > 0)
{
// we need a deregistration first!
ParticipantManagement::RegisterParticipantRequest dereq;
dereq.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
dereq.equipmentNumber(0);
dereq.participantId(participantId);
dereq.info(part.info());
dereq.identification(part.identification());
dereq.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
dereq.equipmentNumber = 0;
dereq.participantId = participantId;
dereq.info = part.info;
dereq.identification = part.identification;
m_ppmFtc->registerParticipantRequest(dereq, this);
}
ParticipantManagement::RegisterParticipantRequest req;
if (equipmentNumber > 0)
req.assignState(ParticipantManagement::ParticipantAssignState::HandoutExcon);
req.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
else
req.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
req.equipmentNumber(equipmentNumber);
req.participantId(participantId);
req.info(part.info());
req.identification(part.identification());
DEBUG_LOG(m_logger) << "Try to register part with id: " << req.participantId() << " and eqNumeber " << req.equipmentNumber();
req.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
req.equipmentNumber = equipmentNumber;
req.participantId = participantId;
req.info = part.info;
req.identification = part.identification;
DEBUG_LOG(m_logger) << "Try to register part with id: " << req.participantId << " and eqNumeber " << req.equipmentNumber;
m_ppmFtc->registerParticipantRequest(req, this);
}