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
@@ -16,6 +16,7 @@ namespace WarehouseManagement
|
||||
|
||||
ClientMessageFactory::ClientMessageFactory(DataManager *dataManager)
|
||||
: LtsWebSocket::AbstractClientMessageFactory(getLogger("ClientMessageFactory"))
|
||||
, m_logger(getLogger("ClientMessageFactory"))
|
||||
, m_dataManager(dataManager)
|
||||
{}
|
||||
|
||||
@@ -265,7 +266,7 @@ ParticipantRegisterInExconReply::ParticipantRegisterInExconReply(int exerciseId,
|
||||
QJsonObject obj;
|
||||
obj[::WebSocketInterface::JsonKeys::EXERCISE_ID()] = exerciseId;
|
||||
obj[::WebSocketInterface::JsonKeys::PARTICIPANT_ID()] = participantId;
|
||||
obj[::WebSocketInterface::JsonKeys::REGISTRATION_RETURN_VALUE()] = (int) retValue.underlying();
|
||||
obj[::WebSocketInterface::JsonKeys::REGISTRATION_RETURN_VALUE()] = static_cast<int>(retValue);
|
||||
m_jsonRepresentation.insert(LtsWebSocket::JsonKeys::DATA(), obj);
|
||||
}
|
||||
|
||||
@@ -275,21 +276,21 @@ void DataManager::handleEquipmentTypes(const ::EquipmentTypes &eTypes)
|
||||
|
||||
INFO_LOG(m_logger) << "equipTypeMap size: " << equipTypeMap.size();
|
||||
ParticipantManagement::ModifyEquipmentTypeDataRequest request;
|
||||
request.deleteAll(true);
|
||||
auto &dataVec = request.data();
|
||||
request.deleteAll = true;
|
||||
auto &dataVec = request.data;
|
||||
dataVec.reserve(equipTypeMap.size());
|
||||
for (const IWMS2ECC::EquipmentType &et : equipTypeMap)
|
||||
{
|
||||
ParticipantManagement::EquipmentType pEt;
|
||||
pEt.id(et.id);
|
||||
pEt.name(et.name.toStdString());
|
||||
pEt.minEquipNo(et.minEquipNo);
|
||||
pEt.maxEquipNo(et.maxEquipNo);
|
||||
pEt.traPlayerTypeId(et.taPlayerTypeId);
|
||||
pEt.deletedInWms(et.deletedInWMS);
|
||||
pEt.traVulnerabilityModelId(et.taVulnerabilityModelId);
|
||||
ParticipantManagement::WmsTypeClass wmsTypeClass = static_cast<ParticipantManagement::WmsTypeClass_def::type>(et.specialType);
|
||||
pEt.wmsTypeClass(wmsTypeClass);
|
||||
pEt.id = et.id;
|
||||
pEt.name = et.name.toStdString();
|
||||
pEt.minEquipNo = et.minEquipNo;
|
||||
pEt.maxEquipNo = et.maxEquipNo;
|
||||
pEt.traPlayerTypeId = et.taPlayerTypeId;
|
||||
pEt.deletedInWms = et.deletedInWMS;
|
||||
pEt.traVulnerabilityModelId = et.taVulnerabilityModelId;
|
||||
ParticipantManagement::WmsTypeClass wmsTypeClass = static_cast<ParticipantManagement::WmsTypeClass>(et.specialType);
|
||||
pEt.wmsTypeClass = wmsTypeClass;
|
||||
dataVec.push_back(std::move(pEt));
|
||||
}
|
||||
|
||||
@@ -331,7 +332,7 @@ void DataManager::onParticipantChanged(const ParticipantManagement::Participant
|
||||
if (!m_clientConnection || !m_wms2ecc)
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "partyId: " << data.partyId() << "participantId: " << data.id();
|
||||
DEBUG_LOG(m_logger) << "partyId: " << data.partyId << "participantId: " << data.id;
|
||||
IWMS2ECC::PlayerInfo pl = m_wms2ecc->convert(data, exerciseId);
|
||||
pl.playerId = (exerciseId* 1000000) + pl.playerId;
|
||||
m_clientConnection->addReply(new ParticipantUpdate(pl, modType));
|
||||
@@ -342,7 +343,7 @@ void DataManager::onExerciseChanged(const ExerciseManagement::Exercise &data, Da
|
||||
if (!m_clientConnection)
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "IN onExerciseChanged: ExerciseUpdate: id = " << data.id();
|
||||
INFO_LOG(m_logger) << "IN onExerciseChanged: ExerciseUpdate: id = " << data.id;
|
||||
IWMS2ECC::Exercise exeData = IWMS2ECC_Impl::convert(data);
|
||||
|
||||
m_clientConnection->addReply(new ExerciseUpdate(exeData, modType));
|
||||
|
||||
@@ -45,7 +45,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ppmFtc = ParticipantManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
bRet &= m_ppmFtc->enableModifyEquipmentTypeData();
|
||||
|
||||
m_pacemaker->setNewState(Core::RunningState::inner_enum::Starting);
|
||||
m_pacemaker->setNewState(Core::RunningState::Starting);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
+44
-44
@@ -77,25 +77,25 @@ void ExerciseParticipantHandler::registerParticipant(qint32 participantId,
|
||||
const dds::core::optional<QString> &info)
|
||||
{
|
||||
ParticipantManagement::RegisterParticipantRequest req;
|
||||
req.assignState(assignState);
|
||||
req.assignState = assignState;
|
||||
|
||||
if (equipNo.is_set())
|
||||
req.equipmentNumber(equipNo.get());
|
||||
req.equipmentNumber = equipNo.get();
|
||||
if (identification.is_set())
|
||||
req.identification(identification.get().toStdString());
|
||||
req.identification = identification.get().toStdString();
|
||||
if (info.is_set())
|
||||
req.info(info.get().toStdString());
|
||||
req.info = info.get().toStdString();
|
||||
if (!equipNo.is_set() || !info.is_set() || !identification.is_set())
|
||||
{
|
||||
const auto participant = m_ddsHandlerExercise->ppmDtc()->participant(participantId);
|
||||
if (!equipNo.is_set() && participant.equipmentNumber().is_set())
|
||||
req.equipmentNumber(participant.equipmentNumber().get());
|
||||
if (!equipNo.is_set() && participant.equipmentNumber.is_set())
|
||||
req.equipmentNumber = participant.equipmentNumber.get();
|
||||
if (!info.is_set())
|
||||
req.info(participant.info());
|
||||
req.info = participant.info;
|
||||
if (!identification.is_set())
|
||||
req.identification(participant.identification());
|
||||
req.identification = participant.identification;
|
||||
}
|
||||
req.participantId(participantId);
|
||||
req.participantId = participantId;
|
||||
|
||||
INFO_LOG(m_logger) << "IN ::registerParticipant, ParticipantId: " << participantId
|
||||
<< ", equipNo: " << equipNo << ", assignState: " << assignState;
|
||||
@@ -105,18 +105,18 @@ void ExerciseParticipantHandler::registerParticipant(qint32 participantId,
|
||||
|
||||
void ExerciseParticipantHandler::onRegisterParticipantReply(const ParticipantManagement::RegisterReply &reply)
|
||||
{
|
||||
INFO_LOG(m_logger) << "RegisterReply id " << reply.id()
|
||||
<< " - registerReturnValue: " << reply.registerReturnValue()
|
||||
<< " for exercise " << reply.exerciseId();
|
||||
INFO_LOG(m_logger) << "RegisterReply id " << reply.id
|
||||
<< " - registerReturnValue: " << reply.registerReturnValue
|
||||
<< " for exercise " << reply.exerciseId;
|
||||
|
||||
|
||||
|
||||
Core::FunctionReplyObject fro;
|
||||
fro.setStr(reply.errorString().c_str());
|
||||
for (const auto &arg : reply.errorParams())
|
||||
fro.setStr(reply.errorString.c_str());
|
||||
for (const auto &arg : reply.errorParams)
|
||||
fro = fro.arg(arg);
|
||||
|
||||
|
||||
emit registrationReturnValue(reply.exerciseId(), reply.id(), reply.registerReturnValue());
|
||||
|
||||
emit registrationReturnValue(reply.exerciseId, reply.id, reply.registerReturnValue);
|
||||
|
||||
if (fro.error())
|
||||
ERROR_LOG(m_logger) << "Error: " << fro();
|
||||
@@ -125,13 +125,13 @@ void ExerciseParticipantHandler::onRegisterParticipantReply(const ParticipantMan
|
||||
void ExerciseParticipantHandler::participantAdded(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
|
||||
if (!participant.equipmentNumber().is_set() || participant.equipmentNumber().get() == 0)
|
||||
if (!participant.equipmentNumber.is_set() || participant.equipmentNumber.get() == 0)
|
||||
{
|
||||
|
||||
|
||||
INFO_LOG(m_logger) << "New participant but no equipment number - ignoring";
|
||||
return;
|
||||
}
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
addParticipant(participant.id, participant.equipmentNumber.get());
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::participantModified(const ParticipantManagement::Participant &participant)
|
||||
@@ -145,50 +145,50 @@ void ExerciseParticipantHandler::participantModified(const ParticipantManagement
|
||||
|
||||
|
||||
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.constFind(participant.id());
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.constFind(participant.id);
|
||||
if (itEquipNumber == m_participantId2EquipmentNumber.constEnd())
|
||||
{
|
||||
|
||||
|
||||
if (!participant.equipmentNumber().is_set() || participant.equipmentNumber() == 0)
|
||||
|
||||
|
||||
if (!participant.equipmentNumber.is_set() || participant.equipmentNumber.get() == 0)
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
|
||||
addParticipant(participant.id, participant.equipmentNumber.get());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (itEquipNumber.value() == participant.equipmentNumber())
|
||||
|
||||
if (participant.equipmentNumber.is_set() && itEquipNumber.value() == participant.equipmentNumber.get())
|
||||
{
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
if (participant.equipmentNumber().is_set())
|
||||
if (participant.equipmentNumber.is_set())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Participant with id " << participant.id() << " changed its equipment number from "
|
||||
<< itEquipNumber.value() << " to " << participant.equipmentNumber().get();
|
||||
INFO_LOG(m_logger) << "Participant with id " << participant.id << " changed its equipment number from "
|
||||
<< itEquipNumber.value() << " to " << participant.equipmentNumber.get();
|
||||
}
|
||||
|
||||
if (participant.equipmentNumber() == 0)
|
||||
if (participant.equipmentNumber.is_set() && participant.equipmentNumber.get() == 0)
|
||||
{
|
||||
|
||||
removeParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
|
||||
removeParticipant(participant.id, participant.equipmentNumber.get());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
removeParticipant(itEquipNumber.key(), itEquipNumber.value());
|
||||
if (participant.equipmentNumber().is_set())
|
||||
addParticipant(participant.id(), participant.equipmentNumber().get());
|
||||
if (participant.equipmentNumber.is_set())
|
||||
addParticipant(participant.id, participant.equipmentNumber.get());
|
||||
}
|
||||
|
||||
void ExerciseParticipantHandler::participantRemoved(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.find(participant.id());
|
||||
const auto itEquipNumber = m_participantId2EquipmentNumber.find(participant.id);
|
||||
if (itEquipNumber == m_participantId2EquipmentNumber.end())
|
||||
{
|
||||
|
||||
@@ -200,10 +200,10 @@ void ExerciseParticipantHandler::participantRemoved(const ParticipantManagement:
|
||||
|
||||
void ExerciseParticipantHandler::emitChangedForInferiors(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
for (const int inferior : participant.inferiorIds())
|
||||
for (const int inferior : participant.inferiorIds)
|
||||
{
|
||||
const auto inf = m_ddsHandlerExercise->ppmDtc()->participant(inferior);
|
||||
if (inf.id() != 0)
|
||||
if (inf.id != 0)
|
||||
emit participantChanged(inf, DataModification::eModified, m_exerciseId);
|
||||
emitChangedForInferiors(inf);
|
||||
}
|
||||
@@ -258,10 +258,10 @@ void ExerciseParticipantHandler::onPartyChanged(const ParticipantManagement::Par
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_partyMap[data.id()] = data;
|
||||
m_partyMap[data.id] = data;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_partyMap.remove(data.id());
|
||||
m_partyMap.remove(data.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
+13
-12
@@ -8,7 +8,8 @@ namespace WarehouseManagement
|
||||
{
|
||||
|
||||
ExercisesHandler::ExercisesHandler(const std::shared_ptr<DdsHandler> &ddsHandler)
|
||||
: m_ddsHandler(ddsHandler)
|
||||
: m_logger(getLogger("ExercisesHandler"))
|
||||
, m_ddsHandler(ddsHandler)
|
||||
{}
|
||||
|
||||
ExercisesHandler::~ExercisesHandler()
|
||||
@@ -23,7 +24,7 @@ bool ExercisesHandler::init()
|
||||
|
||||
auto cb = [this](const ExerciseManagement::Exercise &exercise)
|
||||
{
|
||||
exerciseAdded(exercise.id());
|
||||
exerciseAdded(exercise.id);
|
||||
};
|
||||
m_ddsHandler->exmDtc()->exercises(cb);
|
||||
|
||||
@@ -50,9 +51,9 @@ ParticipantManagement::TypeClass ExercisesHandler::typeClassIdFromEquipmentTypeI
|
||||
std::function<bool(const ParticipantManagement::Type &data)> cb =
|
||||
[equipTypeId, &ret](const ParticipantManagement::Type &t) -> bool
|
||||
{
|
||||
if (t.equipmentTypeId() != equipTypeId)
|
||||
if (t.equipmentTypeId != equipTypeId)
|
||||
return false;
|
||||
ret = t.typeClass();
|
||||
ret = t.typeClass;
|
||||
return true;
|
||||
};
|
||||
m_ddsHandler->ppmDtc()->types(cb);
|
||||
@@ -132,7 +133,7 @@ bool ExercisesHandler::unregisterParticipant(int exerciseId, qint32 equipNo)
|
||||
return false;
|
||||
|
||||
|
||||
ParticipantManagement::ParticipantAssignState assignState = ParticipantManagement::ParticipantAssignState_def::NotAssigned;
|
||||
ParticipantManagement::ParticipantAssignState assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
|
||||
m_exerciseHandler.value(exerciseId)->registerParticipant(participantId, assignState, 0, {}, {});
|
||||
return true;
|
||||
@@ -142,8 +143,8 @@ bool ExercisesHandler::modifyEquipmentTypes(const std::vector<ParticipantManagem
|
||||
{
|
||||
ParticipantManagement::ModifyEquipmentTypeDataRequest req;
|
||||
|
||||
req.data(vectorEquipTypes);
|
||||
req.deleteAll(true);
|
||||
req.data = vectorEquipTypes;
|
||||
req.deleteAll = true;
|
||||
return m_ddsHandler->ppmFtc()->modifyEquipmentTypeDataRequest(req, this);
|
||||
}
|
||||
|
||||
@@ -254,19 +255,19 @@ QMultiHash<int, ParticipantInfoStruct>::iterator ExercisesHandler::findParticipa
|
||||
|
||||
void ExercisesHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
|
||||
{
|
||||
if (!data.sendToWMS())
|
||||
if (!data.sendToWMS)
|
||||
{
|
||||
if (m_exerciseHandler.contains(data.id()))
|
||||
exerciseRemoved(data.id());
|
||||
if (m_exerciseHandler.contains(data.id))
|
||||
exerciseRemoved(data.id);
|
||||
|
||||
emit exerciseChanged(data, DataModification::eRemoved);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_exerciseHandler.contains(data.id()))
|
||||
if (!m_exerciseHandler.contains(data.id))
|
||||
{
|
||||
modType = DataModification::eAdded;
|
||||
exerciseAdded(data.id());
|
||||
exerciseAdded(data.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+106
-105
@@ -16,7 +16,8 @@ namespace WarehouseManagement
|
||||
{
|
||||
|
||||
IWMS2ECC_Impl::IWMS2ECC_Impl(const std::shared_ptr<ExercisesHandler> &exercisesHandler)
|
||||
: m_exercisesHandler(exercisesHandler)
|
||||
: m_logger(getLogger("Wms2Ecc"))
|
||||
, m_exercisesHandler(exercisesHandler)
|
||||
{
|
||||
connect(m_exercisesHandler.get(), &ExercisesHandler::registrationReturnValue,
|
||||
this, &IWMS2ECC_Impl::onRegistrationReturnValue);
|
||||
@@ -25,17 +26,17 @@ IWMS2ECC_Impl::IWMS2ECC_Impl(const std::shared_ptr<ExercisesHandler> &exercisesH
|
||||
IWMS2ECC::Exercise IWMS2ECC_Impl::convert(const ExerciseManagement::Exercise &ex)
|
||||
{
|
||||
IWMS2ECC::Exercise ret;
|
||||
ret.id = ex.id();
|
||||
ret.name = QString::fromStdString(ex.name());
|
||||
if (ex.state() == ExerciseManagement::ExerciseState_def::Started ||
|
||||
ex.state() == ExerciseManagement::ExerciseState_def::Paused)
|
||||
ret.id = ex.id;
|
||||
ret.name = QString::fromStdString(ex.name);
|
||||
if (ex.state == ExerciseManagement::ExerciseState::Started ||
|
||||
ex.state == ExerciseManagement::ExerciseState::Paused)
|
||||
ret.actExercise = 1;
|
||||
else
|
||||
ret.actExercise = 0;
|
||||
|
||||
ret.start = ex.beginTime() / 1000;
|
||||
ret.end = ex.endTime() / 1000;
|
||||
ret.stateAsString = ExerciseManagement::toString(ex.state());
|
||||
ret.start = ex.beginTime / 1000;
|
||||
ret.end = ex.endTime / 1000;
|
||||
ret.stateAsString = ExerciseManagement::toString(ex.state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -43,42 +44,42 @@ IWMS2ECC::PlayerInfo IWMS2ECC_Impl::convert(const ParticipantManagement::Partici
|
||||
{
|
||||
IWMS2ECC::PlayerInfo pi;
|
||||
|
||||
pi.alias = QString::fromStdString(part.identification());
|
||||
pi.assignState = convert(part.assignState());
|
||||
pi.designator = QString::fromStdString(part.designator());
|
||||
if (part.equipmentNumber().is_set())
|
||||
pi.equipNo = part.equipmentNumber().get();
|
||||
else if (part.assignState() == ParticipantManagement::ParticipantAssignState_def::HandoutExcon)
|
||||
pi.alias = QString::fromStdString(part.identification);
|
||||
pi.assignState = convert(part.assignState);
|
||||
pi.designator = QString::fromStdString(part.designator);
|
||||
if (part.equipmentNumber.is_set())
|
||||
pi.equipNo = part.equipmentNumber.get();
|
||||
else if (part.assignState == ParticipantManagement::ParticipantAssignState::HandoutExcon)
|
||||
pi.equipNo = 0;
|
||||
|
||||
pi.exerciseId = exerciseId;
|
||||
pi.forceId = part.partyId();
|
||||
pi.forceId = part.partyId;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Force Id = " << pi.forceId;
|
||||
|
||||
pi.info = QString::fromStdString(part.info());
|
||||
pi.parentPlayerId = part.superiorId();
|
||||
pi.playerId = part.id();
|
||||
pi.playerState = part.isDeleted() ? IWMS2ECC::PlayerState::DELETED : IWMS2ECC::PlayerState::FOUND;
|
||||
pi.info = QString::fromStdString(part.info);
|
||||
pi.parentPlayerId = part.superiorId;
|
||||
pi.playerId = part.id;
|
||||
pi.playerState = part.isDeleted ? IWMS2ECC::PlayerState::DELETED : IWMS2ECC::PlayerState::FOUND;
|
||||
|
||||
pi.tactIdent = QString::fromStdString(part.tacticalIdentifier());
|
||||
const ParticipantManagement::Type partType = m_exercisesHandler->participantType(part.typeId());
|
||||
if (partType.id() == part.typeId())
|
||||
pi.tactIdent = QString::fromStdString(part.tacticalIdentifier);
|
||||
const ParticipantManagement::Type partType = m_exercisesHandler->participantType(part.typeId);
|
||||
if (partType.id == part.typeId)
|
||||
{
|
||||
pi.equipTypeId = partType.equipmentTypeId();
|
||||
pi.typeClassId = convert(partType.typeClass());
|
||||
TRACE_LOG(m_logger) << "Found participant type with id " << part.typeId() << ", " << pi.typeClassId << ", " << pi.equipTypeId;
|
||||
pi.equipTypeId = partType.equipmentTypeId;
|
||||
pi.typeClassId = convert(partType.typeClass);
|
||||
TRACE_LOG(m_logger) << "Found participant type with id " << part.typeId << ", " << pi.typeClassId << ", " << pi.equipTypeId;
|
||||
}
|
||||
else
|
||||
WARNING_LOG(m_logger) << "Can not find participant type with id " << part.typeId();
|
||||
pi.typeId = part.typeId();
|
||||
pi.isDeleted = part.isDeleted();
|
||||
WARNING_LOG(m_logger) << "Can not find participant type with id " << part.typeId;
|
||||
pi.typeId = part.typeId;
|
||||
pi.isDeleted = part.isDeleted;
|
||||
|
||||
pi.hierarchy = m_exercisesHandler->getHierarchyFromParticipant(part.id(), exerciseId, allParticipants);
|
||||
const ParticipantManagement::Party party = m_exercisesHandler->getParty(part.partyId(), exerciseId);
|
||||
pi.forceName = QString::fromStdString(party.name());
|
||||
pi.hierarchy = m_exercisesHandler->getHierarchyFromParticipant(part.id, exerciseId, allParticipants);
|
||||
const ParticipantManagement::Party party = m_exercisesHandler->getParty(part.partyId, exerciseId);
|
||||
pi.forceName = QString::fromStdString(party.name);
|
||||
|
||||
pi.symbolColor = party.color();
|
||||
pi.symbolColor = party.color;
|
||||
|
||||
DEBUG_LOG(m_logger) << "party.name: " << pi.forceName;
|
||||
DEBUG_LOG(m_logger) << "symbolColor: " << pi.symbolColor << ", playerId: " << pi.playerId << ", exerciseId: " << exerciseId;
|
||||
@@ -93,8 +94,8 @@ IWMS2ECC::exerciseMap IWMS2ECC_Impl::getExercises() const
|
||||
IWMS2ECC::exerciseMap retMap;
|
||||
for (const ExerciseManagement::Exercise &ex : exMap)
|
||||
{
|
||||
if (ex.sendToWMS())
|
||||
retMap.insert(ex.id(), convert(ex));
|
||||
if (ex.sendToWMS)
|
||||
retMap.insert(ex.id, convert(ex));
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "IN getExercises, exMap.size(): " << exMap.size()
|
||||
@@ -204,7 +205,7 @@ IWMS2ECC::PlayerInfo IWMS2ECC_Impl::getPlayerInfo(int playerId, int exerciseId)
|
||||
ParticipantManagement::Participant part = m_exercisesHandler->getParticipant(playerId, exerciseId);
|
||||
|
||||
IWMS2ECC::PlayerInfo pi;
|
||||
if (part.assignState() == ParticipantManagement::ParticipantAssignState_def::HandoutExcon)
|
||||
if (part.assignState == ParticipantManagement::ParticipantAssignState::HandoutExcon)
|
||||
{
|
||||
pi.playerState = NOT_FOUND;
|
||||
return pi;
|
||||
@@ -212,7 +213,7 @@ IWMS2ECC::PlayerInfo IWMS2ECC_Impl::getPlayerInfo(int playerId, int exerciseId)
|
||||
|
||||
pi = convert(part, exerciseId);
|
||||
|
||||
pi.forceName = QString::fromStdString(m_exercisesHandler->getParty(part.partyId(), exerciseId).name());
|
||||
pi.forceName = QString::fromStdString(m_exercisesHandler->getParty(part.partyId, exerciseId).name);
|
||||
|
||||
|
||||
pi.playerState = FOUND;
|
||||
@@ -236,10 +237,10 @@ QMap<int, int> IWMS2ECC_Impl::getEquipRequirements(int exerciseId) const
|
||||
|
||||
for (const ParticipantManagement::Participant &part : map)
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
continue;
|
||||
|
||||
reqPartTypes[part.typeId()]++;
|
||||
reqPartTypes[part.typeId]++;
|
||||
}
|
||||
|
||||
QMap<int, int> reqEquipTypes;
|
||||
@@ -248,12 +249,12 @@ QMap<int, int> IWMS2ECC_Impl::getEquipRequirements(int exerciseId) const
|
||||
{
|
||||
const int typeId = cIt.key();
|
||||
const ParticipantManagement::Type partType = m_exercisesHandler->participantType(typeId);
|
||||
if (partType.id() == typeId)
|
||||
if (partType.id == typeId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Key: " << typeId;
|
||||
ParticipantManagement::TypeClass typeClass = partType.typeClass();
|
||||
int equipTypeId = partType.equipmentTypeId();
|
||||
if (typeClass != ParticipantManagement::TypeClass_def::Unit && typeClass != ParticipantManagement::TypeClass_def::SupportUnit)
|
||||
ParticipantManagement::TypeClass typeClass = partType.typeClass;
|
||||
int equipTypeId = partType.equipmentTypeId;
|
||||
if (typeClass != ParticipantManagement::TypeClass::Unit && typeClass != ParticipantManagement::TypeClass::SupportUnit)
|
||||
{
|
||||
reqEquipTypes[equipTypeId] = cIt.value();
|
||||
DEBUG_LOG(m_logger) << "equipTypeId: " << equipTypeId << ", amount: " << cIt.value();
|
||||
@@ -287,29 +288,29 @@ QByteArray IWMS2ECC_Impl::getSymbol(int symbolId, int exerciseId, const QColor &
|
||||
IWMS2ECC::EquipmentType IWMS2ECC_Impl::convert(const ParticipantManagement::EquipmentType &et)
|
||||
{
|
||||
IWMS2ECC::EquipmentType ret;
|
||||
ret.id = et.id();
|
||||
ret.name = QString::fromStdString(et.name());
|
||||
ret.minEquipNo = et.minEquipNo();
|
||||
ret.maxEquipNo = et.maxEquipNo();
|
||||
ret.specialType = int(et.wmsTypeClass().underlying());
|
||||
ret.taVulnerabilityModelId = et.traVulnerabilityModelId();
|
||||
ret.taPlayerTypeId = et.traPlayerTypeId();
|
||||
ret.deletedInWMS = et.deletedInWms();
|
||||
ret.id = et.id;
|
||||
ret.name = QString::fromStdString(et.name);
|
||||
ret.minEquipNo = et.minEquipNo;
|
||||
ret.maxEquipNo = et.maxEquipNo;
|
||||
ret.specialType = static_cast<int>(et.wmsTypeClass);
|
||||
ret.taVulnerabilityModelId = et.traVulnerabilityModelId;
|
||||
ret.taPlayerTypeId = et.traPlayerTypeId;
|
||||
ret.deletedInWMS = et.deletedInWms;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ParticipantManagement::EquipmentType IWMS2ECC_Impl::convert(const IWMS2ECC::EquipmentType &et)
|
||||
{
|
||||
ParticipantManagement::EquipmentType ret;
|
||||
ret.id(et.id);
|
||||
ret.name(et.name.toStdString());
|
||||
ret.minEquipNo(et.minEquipNo);
|
||||
ret.maxEquipNo(et.maxEquipNo);
|
||||
ret.id = et.id;
|
||||
ret.name = et.name.toStdString();
|
||||
ret.minEquipNo = et.minEquipNo;
|
||||
ret.maxEquipNo = et.maxEquipNo;
|
||||
ParticipantManagement::WmsTypeClass wmsTypeClass = convert(et.specialType);
|
||||
ret.wmsTypeClass(wmsTypeClass);
|
||||
ret.traVulnerabilityModelId(et.taVulnerabilityModelId);
|
||||
ret.traPlayerTypeId(et.taPlayerTypeId);
|
||||
ret.deletedInWms(et.deletedInWMS);
|
||||
ret.wmsTypeClass = wmsTypeClass;
|
||||
ret.traVulnerabilityModelId = et.taVulnerabilityModelId;
|
||||
ret.traPlayerTypeId = et.taPlayerTypeId;
|
||||
ret.deletedInWms = et.deletedInWMS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -318,26 +319,26 @@ ParticipantManagement::WmsTypeClass IWMS2ECC_Impl::convert(int specialType)
|
||||
switch (specialType)
|
||||
{
|
||||
case 0:
|
||||
return ParticipantManagement::WmsTypeClass_def::None;
|
||||
return ParticipantManagement::WmsTypeClass::None;
|
||||
case 1:
|
||||
return ParticipantManagement::WmsTypeClass_def::Building;
|
||||
return ParticipantManagement::WmsTypeClass::Building;
|
||||
case 2:
|
||||
return ParticipantManagement::WmsTypeClass_def::Vehicle;
|
||||
return ParticipantManagement::WmsTypeClass::Vehicle;
|
||||
case 3:
|
||||
return ParticipantManagement::WmsTypeClass_def::Human;
|
||||
return ParticipantManagement::WmsTypeClass::Human;
|
||||
case 4:
|
||||
return ParticipantManagement::WmsTypeClass_def::TargetVehicle;
|
||||
return ParticipantManagement::WmsTypeClass::TargetVehicle;
|
||||
case 5:
|
||||
return ParticipantManagement::WmsTypeClass_def::TargetHuman;
|
||||
return ParticipantManagement::WmsTypeClass::TargetHuman;
|
||||
case 6:
|
||||
return ParticipantManagement::WmsTypeClass_def::Airborne;
|
||||
return ParticipantManagement::WmsTypeClass::Airborne;
|
||||
case 7:
|
||||
return ParticipantManagement::WmsTypeClass_def::VehicleMarker;
|
||||
return ParticipantManagement::WmsTypeClass::VehicleMarker;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
return ParticipantManagement::WmsTypeClass_def::None;
|
||||
return ParticipantManagement::WmsTypeClass::None;
|
||||
}
|
||||
|
||||
ParticipantManagement::TypeClass IWMS2ECC_Impl::convertTypeClass(int typeClass)
|
||||
@@ -345,49 +346,49 @@ ParticipantManagement::TypeClass IWMS2ECC_Impl::convertTypeClass(int typeClass)
|
||||
switch (typeClass)
|
||||
{
|
||||
case 1:
|
||||
return ParticipantManagement::TypeClass_def::Unit;
|
||||
return ParticipantManagement::TypeClass::Unit;
|
||||
case 2:
|
||||
return ParticipantManagement::TypeClass_def::VehicleWithGear;
|
||||
return ParticipantManagement::TypeClass::VehicleWithGear;
|
||||
case 3:
|
||||
case 4:
|
||||
return ParticipantManagement::TypeClass_def::GroundVehicle;
|
||||
return ParticipantManagement::TypeClass::GroundVehicle;
|
||||
case 5:
|
||||
return ParticipantManagement::TypeClass_def::Human;
|
||||
return ParticipantManagement::TypeClass::Human;
|
||||
case 6:
|
||||
case 7:
|
||||
return ParticipantManagement::TypeClass_def::SupportEntity;
|
||||
return ParticipantManagement::TypeClass::SupportEntity;
|
||||
case 8:
|
||||
return ParticipantManagement::TypeClass_def::Aircraft;
|
||||
return ParticipantManagement::TypeClass::Aircraft;
|
||||
case 10:
|
||||
return ParticipantManagement::TypeClass_def::SupportUnit;
|
||||
return ParticipantManagement::TypeClass::SupportUnit;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
return ParticipantManagement::TypeClass_def::Unit;
|
||||
return ParticipantManagement::TypeClass::Unit;
|
||||
|
||||
}
|
||||
|
||||
int IWMS2ECC_Impl::convert(ParticipantManagement::TypeClass typeClass)
|
||||
{
|
||||
switch (typeClass.underlying())
|
||||
switch (typeClass)
|
||||
{
|
||||
case ParticipantManagement::TypeClass_def::Unknown:
|
||||
case ParticipantManagement::TypeClass::Unknown:
|
||||
return 0;
|
||||
case ParticipantManagement::TypeClass_def::Unit:
|
||||
case ParticipantManagement::TypeClass::Unit:
|
||||
return 1;
|
||||
case ParticipantManagement::TypeClass_def::Human:
|
||||
case ParticipantManagement::TypeClass::Human:
|
||||
return 5;
|
||||
case ParticipantManagement::TypeClass_def::VehicleWithGear:
|
||||
case ParticipantManagement::TypeClass_def::WeaponSystem:
|
||||
case ParticipantManagement::TypeClass::VehicleWithGear:
|
||||
case ParticipantManagement::TypeClass::WeaponSystem:
|
||||
return 2;
|
||||
case ParticipantManagement::TypeClass_def::GroundVehicle:
|
||||
case ParticipantManagement::TypeClass::GroundVehicle:
|
||||
return 3;
|
||||
case ParticipantManagement::TypeClass_def::SupportUnit:
|
||||
case ParticipantManagement::TypeClass::SupportUnit:
|
||||
return 10;
|
||||
case ParticipantManagement::TypeClass_def::SupportEntity:
|
||||
case ParticipantManagement::TypeClass::SupportEntity:
|
||||
return 7;
|
||||
case ParticipantManagement::TypeClass_def::Aircraft:
|
||||
case ParticipantManagement::TypeClass::Aircraft:
|
||||
return 8;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
@@ -420,17 +421,17 @@ bool IWMS2ECC_Impl::setEquipmentTypes(const equipTypeMap &map)
|
||||
|
||||
IWMS2ECC::PlayerAssignState IWMS2ECC_Impl::convert(const ParticipantManagement::ParticipantAssignState &state)
|
||||
{
|
||||
switch (state.underlying())
|
||||
switch (state)
|
||||
{
|
||||
case ParticipantManagement::ParticipantAssignState_def::NotAssigned:
|
||||
case ParticipantManagement::ParticipantAssignState::NotAssigned:
|
||||
return IWMS2ECC::NOT_ASSIGNED;
|
||||
case ParticipantManagement::ParticipantAssignState_def::AssignedWms:
|
||||
case ParticipantManagement::ParticipantAssignState::AssignedWms:
|
||||
return IWMS2ECC::ASSIGNED;
|
||||
case ParticipantManagement::ParticipantAssignState_def::HandoutWms:
|
||||
case ParticipantManagement::ParticipantAssignState::HandoutWms:
|
||||
return IWMS2ECC::HANDOUT_WMS;
|
||||
case ParticipantManagement::ParticipantAssignState_def::HandoutExcon:
|
||||
case ParticipantManagement::ParticipantAssignState::HandoutExcon:
|
||||
return IWMS2ECC::HANDOUT_EXCON;
|
||||
case ParticipantManagement::ParticipantAssignState_def::ExconWmsOverruled:
|
||||
case ParticipantManagement::ParticipantAssignState::ExconWmsOverruled:
|
||||
return IWMS2ECC::HANDOUT_EXCON_OVERRULED_WMS;
|
||||
}
|
||||
|
||||
@@ -443,38 +444,38 @@ ParticipantManagement::ParticipantAssignState IWMS2ECC_Impl::convert(const IWMS2
|
||||
switch (state)
|
||||
{
|
||||
case IWMS2ECC::UNDEFINED:
|
||||
return ParticipantManagement::ParticipantAssignState_def::NotAssigned;
|
||||
return ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
case IWMS2ECC::NOT_ASSIGNED:
|
||||
return ParticipantManagement::ParticipantAssignState_def::NotAssigned;
|
||||
return ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
case IWMS2ECC::ASSIGNED:
|
||||
return ParticipantManagement::ParticipantAssignState_def::AssignedWms;
|
||||
return ParticipantManagement::ParticipantAssignState::AssignedWms;
|
||||
case IWMS2ECC::HANDOUT_WMS:
|
||||
return ParticipantManagement::ParticipantAssignState_def::HandoutWms;
|
||||
return ParticipantManagement::ParticipantAssignState::HandoutWms;
|
||||
case IWMS2ECC::HANDOUT_EXCON:
|
||||
return ParticipantManagement::ParticipantAssignState_def::HandoutExcon;
|
||||
return ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
case IWMS2ECC::HANDOUT_EXCON_OVERRULED_WMS:
|
||||
return ParticipantManagement::ParticipantAssignState_def::ExconWmsOverruled;
|
||||
return ParticipantManagement::ParticipantAssignState::ExconWmsOverruled;
|
||||
}
|
||||
|
||||
Q_ASSERT(false);
|
||||
return ParticipantManagement::ParticipantAssignState_def::NotAssigned;
|
||||
return ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
}
|
||||
|
||||
IWMS2ECC::RegisterReturnValue IWMS2ECC_Impl::convert(const ParticipantManagement::RegisterReturnValue retValue)
|
||||
{
|
||||
switch (retValue.underlying())
|
||||
switch (retValue)
|
||||
{
|
||||
case ParticipantManagement::RegisterReturnValue_def::AssignmentIncorrect:
|
||||
case ParticipantManagement::RegisterReturnValue::AssignmentIncorrect:
|
||||
return IWMS2ECC::AssignmentIncorrect;
|
||||
case ParticipantManagement::RegisterReturnValue_def::PlayerDeleted:
|
||||
case ParticipantManagement::RegisterReturnValue::PlayerDeleted:
|
||||
return IWMS2ECC::PlayerDeleted;
|
||||
case ParticipantManagement::RegisterReturnValue_def::PlayerNotFound:
|
||||
case ParticipantManagement::RegisterReturnValue::PlayerNotFound:
|
||||
return IWMS2ECC::PlayerNotFound;
|
||||
case ParticipantManagement::RegisterReturnValue_def::RegistrationFailed:
|
||||
case ParticipantManagement::RegisterReturnValue::RegistrationFailed:
|
||||
return IWMS2ECC::RegistrationFailed;
|
||||
case ParticipantManagement::RegisterReturnValue_def::RegistrationOk:
|
||||
case ParticipantManagement::RegisterReturnValue::RegistrationOk:
|
||||
return IWMS2ECC::RegistrationOk;
|
||||
case ParticipantManagement::RegisterReturnValue_def::EquipNoAlreadyAssigned:
|
||||
case ParticipantManagement::RegisterReturnValue::EquipNoAlreadyAssigned:
|
||||
return IWMS2ECC::EquipNoAlreadyAssigned;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ bool MainHandler::init(int domainId)
|
||||
connect(m_exercisesHandler.get(), &ExercisesHandler::registrationReturnValue, m_dataManager,
|
||||
&DataManager::onRegistrationReturnValue);
|
||||
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::inner_enum::Running);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user