Migrates residual Lts sources to generated rtiddsgen API
Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
1 parent
5485a90385
commit
881d44f4dd
512 files changed
+6887
-6426
No files matched your search
@@ -26,6 +26,7 @@ BuildingControlHandler::BuildingControlHandler(MainHandler *mainHandler)
|
||||
, Interface::Fts::TriggerBsmFlashRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, Interface::Fts::SwitchRelayRequestHandler(mainHandler->ddsHandler()->fts())
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_logger(getLogger("BuildingControlHandler"))
|
||||
{}
|
||||
|
||||
BuildingControlHandler::~BuildingControlHandler()
|
||||
@@ -66,12 +67,12 @@ bool BuildingControlHandler::init()
|
||||
for (auto it = latestStates.begin(); it != latestStates.end(); ++it)
|
||||
{
|
||||
const Buildings::HistoryState &historyState = it.value();
|
||||
if (!m_mainHandler->ismHandler()->isElementAssignedToExercise(historyState.mseId(),m_mainHandler->exerciseId() ))
|
||||
if (!m_mainHandler->ismHandler()->isElementAssignedToExercise(historyState.mseId,m_mainHandler->exerciseId() ))
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId() << " not in execise";
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> mseId=" << historyState.mseId << " not in execise";
|
||||
continue;
|
||||
}
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
m_historyStates.insert(historyState.mseId, historyState);
|
||||
DEBUG_LOG(m_logger)<<"[INIT] [recordReplay]>>>>>>> "<<historyState;
|
||||
}
|
||||
}
|
||||
@@ -118,17 +119,17 @@ void BuildingControlHandler::onBuildingChanged(const BuildingInfo &buildingInfo,
|
||||
if ( m_historyStates.contains(buildingInfo.mseId))
|
||||
{
|
||||
historyState = m_historyStates.value(buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState contains historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
}
|
||||
else
|
||||
{
|
||||
historyState.mseId (buildingInfo.mseId);
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId()
|
||||
historyState.mseId = buildingInfo.mseId;
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState insert historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
m_historyStates.insert(historyState.mseId(), historyState);
|
||||
m_historyStates.insert(historyState.mseId, historyState);
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId()
|
||||
DEBUG_LOG(m_logger) << "onBuildingChanged setHistoryState historyState.mseId=" << historyState.mseId
|
||||
<< " buildingInfo.mseId=" << buildingInfo.mseId;
|
||||
bldg->setHistoryState(m_historyStates.value(buildingInfo.mseId));
|
||||
}
|
||||
@@ -196,13 +197,13 @@ void BuildingControlHandler::onTriggerBsmFlashRequest(const rti::core::SampleIde
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetBuildingContaminationStateRequestInternal(const SetBuildingContaminationStateRequest &data)
|
||||
{
|
||||
|
||||
const auto it = m_buildings.find(data.buildingId());
|
||||
const auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->setContaminationState(data.buildingId(), data.contaminationState()))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send contamination state to building control process."));
|
||||
if (!bldg->setContaminationState(data.buildingId, data.contaminationState))
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send contamination state to building control process."));
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
@@ -210,45 +211,45 @@ Core::FunctionReplyObject BuildingControlHandler::onSetBuildingContaminationStat
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetBuildingStatesRequestInternal(const SetBuildingStatesRequest &data)
|
||||
{
|
||||
std::vector<int> roomIds;
|
||||
for (const auto &building : data.buildings())
|
||||
for (const auto &building : data.buildings)
|
||||
{
|
||||
const auto it = m_buildings.find(building.buildingId());
|
||||
const auto it = m_buildings.find(building.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId());
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
|
||||
if (data.resetContamination().is_set())
|
||||
if (data.resetContamination.is_set())
|
||||
{
|
||||
if (data.resetContamination().get() && !bldg->resetContaminationState())
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "reset contamination of building with id %1 failed.")).arg(building.buildingId());
|
||||
if (data.resetContamination.get() && !bldg->resetContaminationState())
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "reset contamination of building with id %1 failed.")).arg(building.buildingId);
|
||||
}
|
||||
|
||||
if (data.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::NoChange)
|
||||
if (data.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange)
|
||||
continue;
|
||||
|
||||
if (data.vulnerabilityState() != ProjectDataManagement::VulnerabilityState::CatastrophicKill &&
|
||||
data.vulnerabilityState() != ProjectDataManagement::VulnerabilityState::CombatReady )
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId());
|
||||
if (data.vulnerabilityState != ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill &&
|
||||
data.vulnerabilityState != ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady )
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(building.buildingId);
|
||||
|
||||
if (building.roomIds().is_set())
|
||||
roomIds = building.roomIds().get();
|
||||
if (building.roomIds.is_set())
|
||||
roomIds = building.roomIds.get();
|
||||
|
||||
if (!bldg->setVulnerabilityState(data.vulnerabilityState(), roomIds))
|
||||
return Core::FunctionReplyObject(building.buildingId(), tr_lts("dds", "Can not send vulnerability state to building control process."));
|
||||
if (!bldg->setVulnerabilityState(data.vulnerabilityState, roomIds))
|
||||
return Core::FunctionReplyObject(building.buildingId, tr_lts("dds", "Can not send vulnerability state to building control process."));
|
||||
}
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSetFortifyFactorRequestInternal(const SetFortifyFactorRequest &data)
|
||||
{
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->setFortifyFactors(data.fortifyFactors()))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send fortify factors to building control process."));
|
||||
if (!bldg->setFortifyFactors(data.fortifyFactors))
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send fortify factors to building control process."));
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
@@ -271,9 +272,9 @@ void BuildingControlHandler::setEffectStates(const int buildingId, const int ass
|
||||
void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo &info, const DataModification mod)
|
||||
{
|
||||
if (mod != DataModification::eRemoved)
|
||||
m_relayInfos.insert(info.id(), info);
|
||||
m_relayInfos.insert(info.id, info);
|
||||
else
|
||||
m_relayInfos.remove(info.id());
|
||||
m_relayInfos.remove(info.id);
|
||||
|
||||
for(auto *bldg : std::as_const(m_buildings))
|
||||
bldg->newRelayInfos(m_relayInfos);
|
||||
@@ -283,20 +284,20 @@ void BuildingControlHandler::onRelayInfoChanged(const AssetManagement::RelayInfo
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSendCesHitOnBuildingRequestInternal(const SendCesHitOnBuildingRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
}
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->sendCesHitOnBuilding(data.effectTime(), data.chargeTypeId(), data.destructiveFactor(), data.penetrationFactor(),
|
||||
data.aesId(), data.impactPosition(),
|
||||
QString::fromStdString(data.properties())))
|
||||
if (!bldg->sendCesHitOnBuilding(data.effectTime, data.chargeTypeId, data.destructiveFactor, data.penetrationFactor,
|
||||
data.aesId, data.impactPosition,
|
||||
QString::fromStdString(data.properties)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHitOnBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
@@ -306,20 +307,20 @@ Core::FunctionReplyObject BuildingControlHandler::onSendCesHit3DonBuildingReques
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal";
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
}
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->sendCesHit3DonBuilding(data.effectTime(), data.chargeTypeId(), data.destructiveFactor(), data.penetrationFactor(),
|
||||
data.aesId(), data.impactPosition(), data.detonationLocation(), data.detonationDistance(),
|
||||
QString::fromStdString(data.properties())))
|
||||
if (!bldg->sendCesHit3DonBuilding(data.effectTime, data.chargeTypeId, data.destructiveFactor, data.penetrationFactor,
|
||||
data.aesId, data.impactPosition, data.detonationLocation, data.detonationDistance,
|
||||
QString::fromStdString(data.properties)))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSendCesHit3DonBuildingRequestInternal return Can not send ces hit to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send ces hit to building control process."));
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
return Core::FunctionReplyObject();
|
||||
@@ -332,22 +333,22 @@ Core::FunctionReplyObject BuildingControlHandler::onTriggerBsmFlashInternal(cons
|
||||
|
||||
{
|
||||
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
|
||||
BuildingProcess *bldg = it.value();
|
||||
BuildingInfo buildingInfo= bldg->buildingInfo();
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId());
|
||||
BsmInfo bsmInfo = buildingInfo.bsms.value(data.assetId);
|
||||
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId()
|
||||
DEBUG_LOG(m_logger) << " BuildingId=" << data.buildingId
|
||||
<< " assetId=" << bsmInfo.assetId
|
||||
<< " hostname=" << bsmInfo.hostname;
|
||||
|
||||
if (!bldg->triggerFlashlight(data))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onTriggerBsmFlashInternal return Can not send trigger flashlight to building control process";
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not send trigger flashlight to building control process"));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not send trigger flashlight to building control process"));
|
||||
}
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "FunctionReplyObject";
|
||||
@@ -368,12 +369,12 @@ void BuildingControlHandler::onSwitchRelayRequest(const rti::core::SampleIdentit
|
||||
Core::FunctionReplyObject BuildingControlHandler::onSwitchRelayInternal(const SwitchRelayRequest &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onSwitchRelayInternal " << data;
|
||||
auto it = m_buildings.find(data.buildingId());
|
||||
auto it = m_buildings.find(data.buildingId);
|
||||
if (it == m_buildings.end())
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId());
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Building with id %1 not found.")).arg(data.buildingId);
|
||||
BuildingProcess *bldg = it.value();
|
||||
if (!bldg->switchRelay(data))
|
||||
return Core::FunctionReplyObject(data.buildingId(), tr_lts("dds", "Can not set relay to building control process."));
|
||||
return Core::FunctionReplyObject(data.buildingId, tr_lts("dds", "Can not set relay to building control process."));
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user