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
+30
-30
@@ -122,14 +122,14 @@ void TgtTests::tryCreateShootbackArea()
|
||||
{
|
||||
ShootbackAreaModifyRequest request;
|
||||
|
||||
request.id(0); // force create
|
||||
request.name("Test ShootbackArea");
|
||||
request.id = 0; // force create
|
||||
request.name = "Test ShootbackArea";
|
||||
double lon = 0.15530364;
|
||||
double lat = 0.92601523;
|
||||
request.position().lon(lon);
|
||||
request.position().lat(lat);
|
||||
request.width(100);
|
||||
request.height(100);
|
||||
request.position.lon = lon;
|
||||
request.position.lat = lat;
|
||||
request.width = 100;
|
||||
request.height = 100;
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaModifyRequest(request, this))
|
||||
{
|
||||
@@ -144,8 +144,8 @@ void TgtTests::tryUpdateShootbackArea()
|
||||
{
|
||||
ShootbackAreaModifyRequest request;
|
||||
|
||||
request.id(m_shootbackAreaId); // update specific id
|
||||
request.name("Test ShootbackArea Updated");
|
||||
request.id = m_shootbackAreaId; // update specific id
|
||||
request.name = "Test ShootbackArea Updated";
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaModifyRequest(request, this))
|
||||
{
|
||||
@@ -160,7 +160,7 @@ void TgtTests::tryRemoveShootbackArea()
|
||||
{
|
||||
ShootbackAreaRemoveRequest request;
|
||||
|
||||
request.id(m_shootbackAreaId); // remove specific id
|
||||
request.id = m_shootbackAreaId; // remove specific id
|
||||
|
||||
if (!m_ftcTgt->shootbackAreaRemoveRequest(request, this))
|
||||
{
|
||||
@@ -177,9 +177,9 @@ void TgtTests::tryRequestTechnicalState()
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
request.id(0);
|
||||
request.participantId(5);
|
||||
request.tgtCommand(TargetManagement::TgtCommand_def::RequestTechnicalState);
|
||||
request.id = 0;
|
||||
request.participantId = 5;
|
||||
request.tgtCommand = TargetManagement::TgtCommand::RequestTechnicalState;
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
{
|
||||
@@ -195,11 +195,11 @@ void TgtTests::tryConfigureTargetMode()
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
request.id(0);
|
||||
request.participantId(5);
|
||||
TargetManagement::Mode mode = TargetManagement::Mode_def::ShootBack;
|
||||
request.tgtCommand(TargetManagement::TgtCommand_def::SetMode);
|
||||
request.mode(mode);
|
||||
request.id = 0;
|
||||
request.participantId = 5;
|
||||
TargetManagement::Mode mode = TargetManagement::Mode::ShootBack;
|
||||
request.tgtCommand = TargetManagement::TgtCommand::SetMode;
|
||||
request.mode = mode;
|
||||
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
@@ -216,10 +216,10 @@ void TgtTests::tryConfigureTargetWeapon()
|
||||
|
||||
ConfigureTargetRequest request;
|
||||
|
||||
request.id(0);
|
||||
request.participantId(5);
|
||||
request.tgtCommand(TargetManagement::TgtCommand_def::SetWeapon);
|
||||
request.weapon(1); // AK47
|
||||
request.id = 0;
|
||||
request.participantId = 5;
|
||||
request.tgtCommand = TargetManagement::TgtCommand::SetWeapon;
|
||||
request.weapon = 1; // AK47
|
||||
|
||||
if (!m_ftcTgt->configureTargetRequest(request, this))
|
||||
{
|
||||
@@ -235,10 +235,10 @@ void TgtTests::tryCreateTargetData()
|
||||
{
|
||||
TrainingAreaBase::TargetData targetData;
|
||||
|
||||
targetData.equipmentNumber(1001);
|
||||
targetData.equipmentNumber = 1001;
|
||||
|
||||
// Shoot Back - AK 47
|
||||
targetData.payload() = {0x65, 0x01, 0x01, 0xae, 0xff, 0x00 };
|
||||
targetData.payload = {0x65, 0x01, 0x01, 0xae, 0xff, 0x00 };
|
||||
|
||||
if (!m_dtsTab->publish(targetData))
|
||||
{
|
||||
@@ -252,13 +252,13 @@ void TgtTests::tryCreateParticipant()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to create Participant index = " << m_participantIndex;
|
||||
ParticipantManagement::Participant participant;
|
||||
participant.id(5);
|
||||
participant.superiorId(0);
|
||||
participant.inferiorIds().resize(2);
|
||||
participant.inferiorIds().at(0) = 2;
|
||||
participant.inferiorIds().at(1) = 3;
|
||||
participant.partyId(5);
|
||||
participant.equipmentNumber(1001);
|
||||
participant.id = 5;
|
||||
participant.superiorId = 0;
|
||||
participant.inferiorIds.resize(2);
|
||||
participant.inferiorIds.at(0) = 2;
|
||||
participant.inferiorIds.at(1) = 3;
|
||||
participant.partyId = 5;
|
||||
participant.equipmentNumber = 1001;
|
||||
DEBUG_LOG(m_logger) << "Publishing Participant";
|
||||
if (!m_dtsPpm->publish(participant))
|
||||
{
|
||||
|
||||
@@ -84,13 +84,13 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Participant & participant)
|
||||
{
|
||||
if (participant.equipmentNumber().is_set())
|
||||
if (participant.equipmentNumber.is_set())
|
||||
{
|
||||
m_partId2EquipNoMap.insert(participant.id(), participant.equipmentNumber().get());
|
||||
m_equipNo2partIdMap.insert(participant.equipmentNumber().get(), participant.id());
|
||||
m_partId2EquipNoMap.insert(participant.id, participant.equipmentNumber.get());
|
||||
m_equipNo2partIdMap.insert(participant.equipmentNumber.get(), participant.id);
|
||||
}
|
||||
else
|
||||
m_partId2EquipNoMap.insert(participant.id(), 0);
|
||||
m_partId2EquipNoMap.insert(participant.id, 0);
|
||||
};
|
||||
m_dtcPpm->participants(cb);
|
||||
}
|
||||
@@ -124,12 +124,12 @@ void DdsHandler::onParticipantChanged(const ParticipantManagement::Participant &
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onParticipantChanged";
|
||||
if (modType == DataModification::eRemoved)
|
||||
m_partId2EquipNoMap.remove(data.id());
|
||||
m_partId2EquipNoMap.remove(data.id);
|
||||
else
|
||||
{
|
||||
m_partId2EquipNoMap[data.id()] = data.equipmentNumber().is_set() ? data.equipmentNumber().get() : 0;
|
||||
if (data.equipmentNumber().is_set())
|
||||
m_equipNo2partIdMap.insert(data.equipmentNumber().get(), data.id());
|
||||
m_partId2EquipNoMap[data.id] = data.equipmentNumber.is_set() ? data.equipmentNumber.get() : 0;
|
||||
if (data.equipmentNumber.is_set())
|
||||
m_equipNo2partIdMap.insert(data.equipmentNumber.get(), data.id);
|
||||
}
|
||||
|
||||
if (m_logger.isTraceEnabled())
|
||||
|
||||
+36
-36
@@ -41,20 +41,20 @@ void HandlerTargetConfig::onTargetDataChanged(const TrainingAreaBase::TargetData
|
||||
|
||||
uint8_t responseCmd = 100;
|
||||
TargetManagement::TargetConfig tgtTargetData;
|
||||
INFO_LOG(m_logger) << "onTargetDataChanged payload.size=" << targetData.payload().size();
|
||||
tgtTargetData.participantId(m_ddsHandler->equipNo2participantId(targetData.equipmentNumber()));
|
||||
for (size_t i = 0; i < targetData.payload().size(); i++)
|
||||
INFO_LOG(m_logger) << "payload[" << i << "]=" << targetData.payload()[i];
|
||||
INFO_LOG(m_logger) << "onTargetDataChanged payload.size=" << targetData.payload.size();
|
||||
tgtTargetData.participantId = m_ddsHandler->equipNo2participantId(targetData.equipmentNumber);
|
||||
for (size_t i = 0; i < targetData.payload.size(); i++)
|
||||
INFO_LOG(m_logger) << "payload[" << i << "]=" << targetData.payload[i];
|
||||
|
||||
if (targetData.payload().size() < 6)
|
||||
if (targetData.payload.size() < 6)
|
||||
return;
|
||||
tgtTargetData.id(0);
|
||||
tgtTargetData.tgtCommand(static_cast <TargetManagement::TgtCommand_def::type>(targetData.payload()[0] - responseCmd));
|
||||
tgtTargetData.mode(static_cast <TargetManagement::Mode_def::type>(targetData.payload()[1]));
|
||||
tgtTargetData.weapon(targetData.payload()[2]);
|
||||
INFO_LOG(m_logger) << "tgtTargetData.tgtCommand =" << tgtTargetData.tgtCommand()
|
||||
<< " mode=" << tgtTargetData.mode()
|
||||
<< " weapon=" << tgtTargetData.weapon();
|
||||
tgtTargetData.id = 0;
|
||||
tgtTargetData.tgtCommand = static_cast <TargetManagement::TgtCommand_def::type>(targetData.payload[0] - responseCmd);
|
||||
tgtTargetData.mode = static_cast <TargetManagement::Mode_def::type>(targetData.payload[1]);
|
||||
tgtTargetData.weapon = targetData.payload[2];
|
||||
INFO_LOG(m_logger) << "tgtTargetData.tgtCommand =" << tgtTargetData.tgtCommand
|
||||
<< " mode=" << tgtTargetData.mode
|
||||
<< " weapon=" << tgtTargetData.weapon;
|
||||
if (!m_dtsTgt->publish(tgtTargetData))
|
||||
ERROR_LOG(m_logger) << "Error publish targetData";
|
||||
} // end of onTargetDataChanged
|
||||
@@ -72,63 +72,63 @@ void HandlerTargetConfig::onConfigureTargetRequest(const rti::core::SampleIdenti
|
||||
const ConfigureTargetRequest &request)
|
||||
{
|
||||
INFO_LOG(m_logger) << "onConfigureTargetRequest";
|
||||
Core::FunctionReplyObject reply = Core::FunctionReplyObject(request.id());
|
||||
Core::FunctionReplyObject reply = Core::FunctionReplyObject(request.id);
|
||||
|
||||
DEBUG_LOG(m_logger) << "HandlerTargetConfig onTargetConfigChanged participantId=" << request.participantId();
|
||||
DEBUG_LOG(m_logger) << "HandlerTargetConfig onTargetConfigChanged participantId=" << request.participantId;
|
||||
|
||||
TrainingAreaBase::SendTargetDataRequest tgt;
|
||||
const int participantId = request.participantId();
|
||||
tgt.equipmentNumber(m_ddsHandler->participantId2EquipNo(participantId));
|
||||
tgt.participantId(request.participantId());
|
||||
const int participantId = request.participantId;
|
||||
tgt.equipmentNumber = m_ddsHandler->participantId2EquipNo(participantId);
|
||||
tgt.participantId = request.participantId;
|
||||
|
||||
tgt.payload().push_back(request.tgtCommand().underlying());
|
||||
tgt.payload.push_back(request.tgtCommand);
|
||||
|
||||
switch (request.tgtCommand().underlying())
|
||||
switch (request.tgtCommand)
|
||||
{
|
||||
case TargetManagement::TgtCommand_def::Unknown:
|
||||
case TargetManagement::TgtCommand_def::PlaySound:
|
||||
case TargetManagement::TgtCommand::Unknown:
|
||||
case TargetManagement::TgtCommand::PlaySound:
|
||||
{
|
||||
WARNING_LOG(m_logger) << "onTargetConfigChanged Command =" << request.tgtCommand() << " not handled.";
|
||||
WARNING_LOG(m_logger) << "onTargetConfigChanged Command =" << request.tgtCommand << " not handled.";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, reply);
|
||||
return;
|
||||
}
|
||||
case TargetManagement::TgtCommand_def::RequestTechnicalState:
|
||||
case TargetManagement::TgtCommand_def::RequestParameter:
|
||||
case TargetManagement::TgtCommand::RequestTechnicalState:
|
||||
case TargetManagement::TgtCommand::RequestParameter:
|
||||
{
|
||||
// No specific data to add to payload
|
||||
break;
|
||||
}
|
||||
case TargetManagement::TgtCommand_def::SetMode:
|
||||
case TargetManagement::TgtCommand::SetMode:
|
||||
{
|
||||
if (!request.mode().is_set())
|
||||
if (!request.mode.is_set())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Set mode requested, but mode ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set mode requested, but mode is not set")));
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId, tr_lts("dds", "Set mode requested, but mode is not set")));
|
||||
return;
|
||||
}
|
||||
tgt.payload().push_back(request.mode().get().underlying());
|
||||
tgt.payload.push_back(request.mode.get());
|
||||
break;
|
||||
}
|
||||
case TargetManagement::TgtCommand_def::SetWeapon:
|
||||
case TargetManagement::TgtCommand::SetWeapon:
|
||||
{
|
||||
if (!request.weapon().is_set())
|
||||
if (!request.weapon.is_set())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Set weapon requested, but weapon ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set weapon requested, but weapon is not set")));
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId, tr_lts("dds", "Set weapon requested, but weapon is not set")));
|
||||
return;
|
||||
}
|
||||
tgt.payload().push_back(request.weapon().get());
|
||||
tgt.payload.push_back(request.weapon.get());
|
||||
break;
|
||||
}
|
||||
case TargetManagement::TgtCommand_def::SetParameter:
|
||||
case TargetManagement::TgtCommand::SetParameter:
|
||||
{
|
||||
if (!request.parameterSet().is_set())
|
||||
if (!request.parameterSet.is_set())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Set parameterset requested, but parameterset ist not set";
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId(), tr_lts("dds", "Set parameterset requested, but parameterset is not set")));
|
||||
m_ddsHandler->ftsTgt()->configureTargetReply(cookie, Core::FunctionReplyObject(request.participantId, tr_lts("dds", "Set parameterset requested, but parameterset is not set")));
|
||||
return;
|
||||
}
|
||||
tgt.payload().push_back(request.parameterSet().get());
|
||||
tgt.payload.push_back(request.parameterSet.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user