Migrates Participant and OperatorManagement to generated rtiddsgen API
Converts accessor calls to plain member access in ppm and opm services and plugins.
This commit is contained in:
36 files changed
+513
-529
No files matched your search
-1
@@ -49,7 +49,6 @@ public:
|
||||
void onFolderModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
int createFolder(int parentFolderId, const QString &folderName, int userId, bool isHidden = false);
|
||||
|
||||
-2
@@ -36,7 +36,6 @@ public:
|
||||
~ParticipantEditItemWidgetBase();
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool init(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asb,
|
||||
@@ -57,7 +56,6 @@ protected Q_SLOTS:
|
||||
void onChangeSymbol(const QString &sidc);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
ParticipantManagement::TypeClass typeClassIdFromTypeId(int typeId) const;
|
||||
bool isUnitType(int typeId) const;
|
||||
|
||||
|
||||
-1
@@ -101,7 +101,6 @@ public:
|
||||
QString getHierarchyFromIndex(const QModelIndex &index) const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void gatherParticipants(QHash<int, ParticipantData> &tmap,
|
||||
QHash<int, QSet<int>> &parentId2id) const;
|
||||
|
||||
|
||||
-2
@@ -35,7 +35,6 @@ class PPMCOMMON_EXPORT ParticipantIconModelBase : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
ParticipantIconModelBase(const std::shared_ptr<Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc,
|
||||
const QStringList &hdr,
|
||||
@@ -54,7 +53,6 @@ protected:
|
||||
bool updateIcon(const QModelIndex ¤tIndex, NGLTreeItem *itemToUpdate, const QIcon &icon);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onTypeChanged(const ParticipantManagement::Type &data, DataModification modType);
|
||||
|
||||
protected:
|
||||
|
||||
-1
@@ -60,7 +60,6 @@ public:
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
void showIsSimulated();
|
||||
|
||||
-1
@@ -64,7 +64,6 @@ Q_SIGNALS:
|
||||
void modifyParticipantData(const QVector<ParticipantData> &participantData, const QString &originatorMimeType);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool moveFromPartyToPool(int rootParticipantId, const QString &mimeType);
|
||||
QVector<Participant> getSuperiorParticipants(int participantId);
|
||||
bool convertFromParticipantTemplateToParticipantData(const ParticipantManagement::TemplateParticipant &inputParticipant, ParticipantManagement::ParticipantData &outPutData);
|
||||
|
||||
-1
@@ -61,7 +61,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onModifyStateReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onInitParticipantReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void onSendMessageReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
-1
@@ -103,7 +103,6 @@ public:
|
||||
QString getHierarchyFromIndex(const QModelIndex &index) const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void gatherParticipants(QHash<int, ParticipantData> &tmap,
|
||||
QHash<int, QSet<int>> &parentId2id) const;
|
||||
|
||||
|
||||
-1
@@ -47,7 +47,6 @@ public:
|
||||
bool init(LtsSession::LtsSession *session, bool showAllOptions = false);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
bool apply() override final;
|
||||
void onSelectiveReammunitionReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
-2
@@ -78,7 +78,6 @@ public:
|
||||
~ParticipantSetInjuryDialog();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onModifyStateReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
void retranslate() override;
|
||||
|
||||
@@ -94,7 +93,6 @@ private slots:
|
||||
void resetRadioStates(bool onlySides = false);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool apply() override final;
|
||||
|
||||
private:
|
||||
|
||||
-1
@@ -46,7 +46,6 @@ public:
|
||||
private slots:
|
||||
void onQualificationChanged();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void fillCb();
|
||||
void setCbxName();
|
||||
qint64 getProcedures();
|
||||
|
||||
-1
@@ -61,7 +61,6 @@ public:
|
||||
bool loadTemplate(int templateRootId, bool isSupport = false);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
bool initButtons();
|
||||
QByteArray getMimeData(const Type &type, const QImage &image);
|
||||
|
||||
-1
@@ -95,7 +95,6 @@ public:
|
||||
QString getHierarchyFromIndex(const QModelIndex &index) const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void gatherParticipants(QHash<int, ParticipantData> &tmap,
|
||||
QHash<int, QSet<int>> &parentId2id) const;
|
||||
|
||||
|
||||
-1
@@ -55,7 +55,6 @@ public Q_SLOTS:
|
||||
bool apply() override final;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
QModelIndex selectedIndexView() const;
|
||||
bool isContainer(const QModelIndex &index);
|
||||
|
||||
-1
@@ -41,7 +41,6 @@ private slots:
|
||||
void onOperatorChanged(const OperatorManagement::User &data, DataModification modType);
|
||||
void onSelectionOperatorChanged(const int index);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
void onModifyPartyDataReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
+41
-41
@@ -153,7 +153,7 @@ void OpmTests::tryRemove()
|
||||
m_eTestStep = eRemove;
|
||||
OperatorRemoveRequest data;
|
||||
|
||||
data.id(m_operatorId);
|
||||
data.id = m_operatorId;
|
||||
|
||||
INFO_LOG(m_logger) << "trying to send remove request";
|
||||
if (!m_ftc->operatorRemoveRequest(data, this))
|
||||
@@ -172,23 +172,23 @@ void OpmTests::tryLogin()
|
||||
m_eTestStep = eLogin;
|
||||
OperatorLoginRequest data;
|
||||
|
||||
data.id(m_operatorId);
|
||||
data.id = m_operatorId;
|
||||
std::string pass("ctc");
|
||||
|
||||
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
|
||||
//pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
|
||||
|
||||
data.password(pass);
|
||||
data.workstationIp(-1);
|
||||
data.workstationId(301);
|
||||
data.force(false);
|
||||
data.password = pass;
|
||||
data.workstationIp = -1;
|
||||
data.workstationId = 301;
|
||||
data.force = false;
|
||||
|
||||
NOTICE_LOG(m_logger) << "trying to send OperatorLoginRequest"
|
||||
<< ", operatorId:" << m_operatorId
|
||||
<< ", pass:" << pass
|
||||
<< ", workstationIp:" << data.workstationIp()
|
||||
<< ", workstationId:" << data.workstationId()
|
||||
<< ", force:" << data.force();
|
||||
<< ", workstationIp:" << data.workstationIp
|
||||
<< ", workstationId:" << data.workstationId
|
||||
<< ", force:" << data.force;
|
||||
if (!m_ftc->operatorLoginRequest(data, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error login operator id " << m_operatorId << " on workstation 1";
|
||||
@@ -203,16 +203,16 @@ void OpmTests::tryLoginForce()
|
||||
m_eTestStep = eLogin;
|
||||
OperatorLoginRequest data;
|
||||
|
||||
data.id(m_operatorId);
|
||||
data.id = m_operatorId;
|
||||
std::string pass("password");
|
||||
|
||||
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
|
||||
pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
|
||||
|
||||
data.password(pass);
|
||||
data.workstationIp(-1);
|
||||
data.workstationId(4);
|
||||
data.force(true);
|
||||
data.password = pass;
|
||||
data.workstationIp = -1;
|
||||
data.workstationId = 4;
|
||||
data.force = true;
|
||||
|
||||
INFO_LOG(m_logger) << "trying to send OperatorLoginRequest";
|
||||
if (!m_ftc->operatorLoginRequest(data, this))
|
||||
@@ -229,7 +229,7 @@ void OpmTests::tryLogout()
|
||||
m_eTestStep = eLogout;
|
||||
OperatorLogoutRequest data;
|
||||
|
||||
data.id(m_operatorId);
|
||||
data.id = m_operatorId;
|
||||
|
||||
INFO_LOG(m_logger) << "trying to send OperatorLogoutRequest";
|
||||
if (!m_ftc->operatorLogoutRequest(data, this))
|
||||
@@ -283,7 +283,7 @@ void OpmTests::tryGetAllOperators()
|
||||
for(auto it = opMap.begin(); it != opMap.end(); ++it)
|
||||
{
|
||||
INFO_LOG(m_logger) << "opm(" << it.key() << ") :"
|
||||
<< " name:" << it.value().name()
|
||||
<< " name:" << it.value().name
|
||||
// << " password:" << it.value().password()
|
||||
// << " effectiveACLs:" << it.value().effectiveAcls()
|
||||
;
|
||||
@@ -311,15 +311,15 @@ void OpmTests::tryGetOperator()
|
||||
m_dtc->waitForHistoricalDataUser();
|
||||
OperatorManagement::User op = m_dtc->user(m_operatorId);
|
||||
|
||||
if(op.id() <= 0)
|
||||
if(op.id <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error receiving data for operatorId " << m_operatorId << " returnVal:" << op.id();
|
||||
ERROR_LOG(m_logger) << "Error receiving data for operatorId " << m_operatorId << " returnVal:" << op.id;
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "opm(" << op.id() << ") :"
|
||||
<< " name: " << op.name()
|
||||
INFO_LOG(m_logger) << "opm(" << op.id << ") :"
|
||||
<< " name: " << op.name
|
||||
// << " password: " << data.password()
|
||||
// << " effectiveACLs:" << it.value().effectiveAcls()
|
||||
;
|
||||
@@ -455,9 +455,9 @@ void OpmTests::onOperatorLogoutReply(const Core::FunctionReplyObject &replyObjec
|
||||
void OpmTests::onReceiveOperatorChanged(const User &data, DataModification modType)
|
||||
{
|
||||
// Check signal/slot connection
|
||||
if (m_operatorId == data.id())
|
||||
if (m_operatorId == data.id)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id() << " received";
|
||||
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id << " received";
|
||||
TRACE_LOG(m_logger) << "ModificationType: = " << (int)modType << " received";
|
||||
}
|
||||
} // end of onReceiveOperatorData()
|
||||
@@ -468,7 +468,7 @@ void OpmTests::onReceiveGroupChanged(const Group &data, DataModification modType
|
||||
// Check signal/slot connection
|
||||
// if (m_operatorId == data.id())
|
||||
// {
|
||||
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id() << " received";
|
||||
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id << " received";
|
||||
TRACE_LOG(m_logger) << "ModificationType: = " << (int)modType << " received";
|
||||
// }
|
||||
} // end of onReceiveOperatorData()
|
||||
@@ -480,20 +480,20 @@ void OpmTests::getOperatorCreateRequestData(OperatorCreateModifyRequest &data) c
|
||||
if(m_testId == 0)
|
||||
currentTime = currentTime/10;
|
||||
|
||||
data.name(std::string("TestOperatorCreate" + std::to_string(currentTime)));
|
||||
data.name = std::string("TestOperatorCreate" + std::to_string(currentTime));
|
||||
std::string pass("password");
|
||||
|
||||
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
|
||||
pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
|
||||
|
||||
data.password(pass);
|
||||
data.description(std::string("Description"));
|
||||
data.password = pass;
|
||||
data.description = std::string("Description");
|
||||
// Todo: test anpassen
|
||||
PartiesByExercise pbe;
|
||||
pbe.exerciseId(0);
|
||||
pbe.visibleParties().set({0,1,2,3,4,5,6,7,8,9,10,11,12});
|
||||
data.visiblePartiesByExercise().push_back(pbe);
|
||||
data.rolePresetId(1001);
|
||||
pbe.exerciseId = 0;
|
||||
pbe.visibleParties.set({0,1,2,3,4,5,6,7,8,9,10,11,12});
|
||||
data.visiblePartiesByExercise.push_back(pbe);
|
||||
data.rolePresetId = 1001;
|
||||
|
||||
} // end of getOperatorCreateRequestData()
|
||||
|
||||
@@ -504,32 +504,32 @@ void OpmTests::getOperatorModifyRequestData(OperatorCreateModifyRequest &data) c
|
||||
if(m_testId == 0)
|
||||
currentTime = currentTime/10;
|
||||
|
||||
data.id(m_operatorId);
|
||||
data.id = m_operatorId;
|
||||
// data.name(std::string("Operator"+std::to_string(m_operatorId)));
|
||||
// only changing the description
|
||||
data.description(std::string("Description" + std::to_string(m_operatorId)));
|
||||
data.description = std::string("Description" + std::to_string(m_operatorId));
|
||||
|
||||
} // end of getOperatorChangeNameRequestData()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool OpmTests::onCompareCreatedData(User &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id;
|
||||
|
||||
OperatorCreateModifyRequest createData;
|
||||
|
||||
getOperatorCreateRequestData(createData);
|
||||
|
||||
if (createData.name() != data.name())
|
||||
if (createData.name != data.name)
|
||||
return false;
|
||||
|
||||
// if(createData.password() != data.password())
|
||||
// return false;
|
||||
|
||||
if (data.description() != createData.description())
|
||||
if (data.description != createData.description)
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "successfull finished onCompareCreatedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "successfull finished onCompareCreatedData() for id :" << data.id;
|
||||
|
||||
return true;
|
||||
} // end of onCompareCreatedData()
|
||||
@@ -537,22 +537,22 @@ bool OpmTests::onCompareCreatedData(User &data)
|
||||
//-----------------------------------------------------------------------------
|
||||
bool OpmTests::onCompareModifiedData(User &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "start onCompareModifiedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "start onCompareModifiedData() for id :" << data.id;
|
||||
|
||||
OperatorCreateModifyRequest modifyData;
|
||||
|
||||
getOperatorModifyRequestData(modifyData);
|
||||
|
||||
if (modifyData.id() != data.id())
|
||||
if (modifyData.id != data.id)
|
||||
return false;
|
||||
|
||||
if (modifyData.name() != data.name())
|
||||
if (modifyData.name != data.name)
|
||||
return false;
|
||||
|
||||
if (data.description() != modifyData.description())
|
||||
if (data.description != modifyData.description)
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "successfully finished onCompareModifiedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "successfully finished onCompareModifiedData() for id :" << data.id;
|
||||
|
||||
return true;
|
||||
} // end of onCompareModifiedData()
|
||||
|
||||
+12
-12
@@ -53,10 +53,10 @@ void HandlerActiveApps::cleanupOperator(int operatorId)
|
||||
while (it != m_activeApps.end())
|
||||
{
|
||||
const ActiveApp &item = it.value();
|
||||
if (item.operatorId() == operatorId)
|
||||
if (item.operatorId == operatorId)
|
||||
{
|
||||
INFO_LOG(m_logger) << "cleanupOperator operatorId: " << operatorId << " ActiveApp=" << item;
|
||||
dtsPtr->removeActiveAppByKey(item.id());
|
||||
dtsPtr->removeActiveAppByKey(item.id);
|
||||
it = m_activeApps.erase(it);
|
||||
}
|
||||
else
|
||||
@@ -70,7 +70,7 @@ void HandlerActiveApps::cleanup()
|
||||
{
|
||||
auto dtsPtr = dts();
|
||||
for (const ActiveApp &item : qAsConst(m_activeApps))
|
||||
dtsPtr->removeActiveAppByKey(item.id());
|
||||
dtsPtr->removeActiveAppByKey(item.id);
|
||||
m_activeApps.clear();
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ void HandlerActiveApps::removeZombieEntry(const ActiveApp &request)
|
||||
for (auto it = m_activeApps.begin(); it != m_activeApps.end(); ++it)
|
||||
{
|
||||
const ActiveApp &item = it.value();
|
||||
if ((item.operatorId() == request.operatorId()) &&
|
||||
(item.screenId() == request.screenId()))
|
||||
if ((item.operatorId == request.operatorId) &&
|
||||
(item.screenId == request.screenId))
|
||||
{
|
||||
dts()->removeActiveAppByKey(item.id());
|
||||
dts()->removeActiveAppByKey(item.id);
|
||||
m_activeApps.erase(it);
|
||||
break;
|
||||
}
|
||||
@@ -102,13 +102,13 @@ void HandlerActiveApps::onActiveAppUpdateRequest(const rti::core::SampleIdentity
|
||||
|
||||
Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const ActiveApp &request)
|
||||
{
|
||||
const int reqId = request.id();
|
||||
const int reqId = request.id;
|
||||
|
||||
// handle 'remove' :
|
||||
if (request.appId() < 0) // LtsSession::App::Login is -1 but ok
|
||||
if (request.appId < 0) // LtsSession::App::Login is -1 but ok
|
||||
{
|
||||
Core::RemoveElementRequest removeRequest;
|
||||
removeRequest.id(reqId);
|
||||
removeRequest.id = reqId;
|
||||
return activeAppRemoveRequest(removeRequest);
|
||||
}
|
||||
// : handle 'remove'
|
||||
@@ -122,7 +122,7 @@ Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const Active
|
||||
removeZombieEntry(request);
|
||||
|
||||
it = m_activeApps.insert(++s_idCounter, request);
|
||||
it.value().id(s_idCounter);
|
||||
it.value().id = s_idCounter;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -137,7 +137,7 @@ Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const Active
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "onActiveAppUpdateRequest - publish new data: " << it.value();
|
||||
dts()->publish(it.value());
|
||||
return Core::FunctionReplyObject(it.value().id());
|
||||
return Core::FunctionReplyObject(it.value().id);
|
||||
}
|
||||
|
||||
void HandlerActiveApps::onActiveAppRemoveRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -152,7 +152,7 @@ void HandlerActiveApps::onActiveAppRemoveRequest(const rti::core::SampleIdentity
|
||||
|
||||
Core::FunctionReplyObject HandlerActiveApps::activeAppRemoveRequest(const Core::RemoveElementRequest &request)
|
||||
{
|
||||
const int reqId = request.id();
|
||||
const int reqId = request.id;
|
||||
if (m_activeApps.remove(reqId) <= 0)
|
||||
return Core::FunctionReplyObject(reqId, tr_lts("dds", "ActiveApp with id %1 not found")).arg(reqId);
|
||||
|
||||
|
||||
@@ -120,13 +120,13 @@ void HandlerGroup::updateRolePresetId(const int operatorId, const int rolePreset
|
||||
|
||||
Core::FunctionReplyObject HandlerGroup::changeMembership(const OperatorManagement::GroupChangeMembersRequest &request)
|
||||
{
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id());
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for changing memberships."));
|
||||
|
||||
Core::FunctionReplyObject fro;
|
||||
if (request.memberships().size() > 0)
|
||||
fro = ifs->updateMemberships(request.memberships());
|
||||
if (request.memberships.size() > 0)
|
||||
fro = ifs->updateMemberships(request.memberships);
|
||||
else
|
||||
fro = ifs->removeAllMemberships();
|
||||
|
||||
@@ -141,8 +141,8 @@ void HandlerGroup::onGroupChangeMembershipsRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onGroupChangeMembershipsRequest " << request;
|
||||
Core::FunctionReplyObject ret = changeMembership(request);
|
||||
if (request.operatorId().is_set() && request.rolePresetId().is_set())
|
||||
updateRolePresetId(request.operatorId().get(), request.rolePresetId().get());
|
||||
if (request.operatorId.is_set() && request.rolePresetId.is_set())
|
||||
updateRolePresetId(request.operatorId.get(), request.rolePresetId.get());
|
||||
if (ret.error())
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->fts()->groupChangeMembershipsReply(cookie, ret);
|
||||
@@ -151,18 +151,18 @@ void HandlerGroup::onGroupChangeMembershipsRequest(const rti::core::SampleIdenti
|
||||
Core::FunctionReplyObject HandlerGroup::create(const GroupCreateRequest &request)
|
||||
{
|
||||
Database::OpmGroup group;
|
||||
group.name = QString::fromStdString(request.name());
|
||||
group.name = QString::fromStdString(request.name);
|
||||
for (const ObjectGroup *g : qAsConst(m_groupObjMap))
|
||||
{
|
||||
if (g->name().compare(group.name, Qt::CaseInsensitive) == 0)
|
||||
return Core::FunctionReplyObject(-1, tr_lts("dds", "Name '%1' already exists")).arg(group.name);
|
||||
}
|
||||
group.description = QString::fromStdString(request.description());
|
||||
group.typeId = request.type();
|
||||
group.isHidden = request.isHidden().is_set() ? request.isHidden().get() : false;
|
||||
group.description = QString::fromStdString(request.description);
|
||||
group.typeId = request.type;
|
||||
group.isHidden = request.isHidden.is_set() ? request.isHidden.get() : false;
|
||||
|
||||
ObjectGroup *ifs(new ObjectGroup(m_mainHandler));
|
||||
Core::FunctionReplyObject ret = ifs->createObject(group, request.memberships().is_set() ? request.memberships().get() : std::vector<int32_t>());
|
||||
Core::FunctionReplyObject ret = ifs->createObject(group, request.memberships.is_set() ? request.memberships.get() : std::vector<int32_t>());
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
@@ -185,13 +185,13 @@ void HandlerGroup::onGroupCreateRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
Core::FunctionReplyObject HandlerGroup::changeName(const OperatorManagement::GroupChangeNameRequest &request)
|
||||
{
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id());
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for renaming."));
|
||||
|
||||
Database::OpmGroup group = ifs->data();
|
||||
group.name = QString::fromStdString(request.name());
|
||||
group.description = QString::fromStdString(request.description());
|
||||
group.name = QString::fromStdString(request.name);
|
||||
group.description = QString::fromStdString(request.description);
|
||||
|
||||
for (const ObjectGroup *g : qAsConst(m_groupObjMap))
|
||||
{
|
||||
@@ -210,7 +210,7 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
|
||||
DEBUG_LOG(m_logger) << "onGroupChangeNameRequest" << request;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id());
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
{
|
||||
ret = Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for renaming."));
|
||||
@@ -219,7 +219,7 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
|
||||
}
|
||||
|
||||
Database::OpmGroup group = ifs->data();
|
||||
if (group.typeId == GroupType_def::OperatorGroup && (group.name != QString::fromStdString(request.name())))
|
||||
if (group.typeId == GroupType::OperatorGroup && (group.name != QString::fromStdString(request.name)))
|
||||
{
|
||||
ret = Core::FunctionReplyObject(0, tr_lts("dds", "Operator group may not be renamed."));
|
||||
m_mainHandler->fts()->groupChangeNameReply(cookie, ret);
|
||||
@@ -231,23 +231,23 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
|
||||
|
||||
Core::FunctionReplyObject HandlerGroup::remove(const Core::RemoveElementRequest &request)
|
||||
{
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id());
|
||||
ObjectGroup *ifs = m_groupObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for deleting."));
|
||||
|
||||
OperatorManagement::Group ddsData;
|
||||
ddsData.id(request.id());
|
||||
ddsData.id = request.id;
|
||||
|
||||
if (m_mainHandler->dds()->topicLockMaster()->isLocked(ddsData, 0))
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Group '%1' is used by another user!")).arg(ifs->name());
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Group '%1' is used by another user!")).arg(ifs->name());
|
||||
|
||||
Core::FunctionReplyObject ret = ifs->removeObject();
|
||||
if (ret.error())
|
||||
return ret;
|
||||
m_groupObjMap.remove(request.id());
|
||||
m_groupGroupMap.remove(request.id());
|
||||
m_groupObjMap.remove(request.id);
|
||||
m_groupGroupMap.remove(request.id);
|
||||
for (auto it = m_groupGroupMap.begin(); it != m_groupGroupMap.end();)
|
||||
if (it.value() == request.id())
|
||||
if (it.value() == request.id)
|
||||
it = m_groupGroupMap.erase(it);
|
||||
else
|
||||
++it;
|
||||
|
||||
+21
-21
@@ -125,13 +125,13 @@ void HandlerLockedTopics::onTryLockEntityRequest(const rti::core::SampleIdentity
|
||||
dumpLockedTopics(__LINE__);
|
||||
|
||||
auto ret = tryLock(request);
|
||||
if (!ret.errorString().empty())
|
||||
if (!ret.errorString.empty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString(), ret.errorParams()).translated() << " - " << request;
|
||||
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString, ret.errorParams).translated() << " - " << request;
|
||||
}
|
||||
else if (ret.alreadyLocked())
|
||||
else if (ret.alreadyLocked)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "onTryLockEntityRequest failed because the topic was already locked by ws " << ret.alreadyLocked().get().workstationName() << " and op " << ret.alreadyLocked().get().operatorName() << " - " << request;
|
||||
WARNING_LOG(m_logger) << "onTryLockEntityRequest failed because the topic was already locked by ws " << ret.alreadyLocked.get().workstationName << " and op " << ret.alreadyLocked.get().operatorName << " - " << request;
|
||||
}
|
||||
m_ftsTryLockEntity->sendReply(cookie, ret);
|
||||
|
||||
@@ -158,9 +158,9 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "tryLock : " << request;
|
||||
|
||||
const auto topicId = request.entityId();
|
||||
const auto topicId = request.entityId;
|
||||
|
||||
const Core::key k(request.entityId(), request.exerciseId(), QString::fromStdString(request.entityTypeName()));
|
||||
const Core::key k(request.entityId, request.exerciseId, QString::fromStdString(request.entityTypeName));
|
||||
Database::OpmLockedTopics dbStruct(toDb(request));
|
||||
auto it = m_lockedTopics.constFind(k);
|
||||
if (it == m_lockedTopics.constEnd())
|
||||
@@ -173,9 +173,9 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
|
||||
}
|
||||
|
||||
m_lockedTopics.insert(k, dbStruct);
|
||||
Core::LockedEntity lckEntity(request.operatorId(), request.workstationId(),
|
||||
request.exerciseId(), request.entityId(),
|
||||
request.entityTypeName(), dbStruct.id);
|
||||
Core::LockedEntity lckEntity(request.operatorId, request.workstationId,
|
||||
request.exerciseId, request.entityId,
|
||||
request.entityTypeName, dbStruct.id);
|
||||
publishLockedEntity(lckEntity);
|
||||
return lockSuccessReply(dbStruct);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
|
||||
// already locked by another user
|
||||
const Database::OpmLockedTopics &data = *it;
|
||||
const auto opName = m_mainHandler.getHandlerOperator()->operatorNameById(data.operatorId);
|
||||
const auto wsName = m_mainHandler.dds()->dtcAsm()->asset(data.workstationId).name();
|
||||
const auto wsName = m_mainHandler.dds()->dtcAsm()->asset(data.workstationId).name;
|
||||
|
||||
return lockAlreadyLockedReply(wsName, opName);
|
||||
}
|
||||
@@ -304,9 +304,9 @@ void HandlerLockedTopics::onTryUnlockEntityRequest(const rti::core::SampleIdenti
|
||||
dumpLockedTopics(__LINE__);
|
||||
|
||||
auto ret = tryUnlock(request);
|
||||
if (!ret.errorString().empty())
|
||||
if (!ret.errorString.empty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString(), ret.errorParams()).translated() << " - " << request;
|
||||
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString, ret.errorParams).translated() << " - " << request;
|
||||
}
|
||||
m_ftsTryUnlockEntity->sendReply(cookie, ret);
|
||||
|
||||
@@ -318,7 +318,7 @@ Core::FunctionReply HandlerLockedTopics::tryUnlock(const Core::TryUnlockEntityRe
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "tryUnlock: " << request;
|
||||
|
||||
const auto lockEntityId = request.id();
|
||||
const auto lockEntityId = request.id;
|
||||
|
||||
auto lockedTopicIt = std::find_if(m_lockedTopics.constBegin(), m_lockedTopics.constEnd(),
|
||||
[lockEntityId](const Database::OpmLockedTopics &lockedTopic)
|
||||
@@ -352,11 +352,11 @@ Database::OpmLockedTopics HandlerLockedTopics::toDb(const Core::LockedEntityBase
|
||||
{
|
||||
Database::OpmLockedTopics ret;
|
||||
ret.locked = true;
|
||||
ret.entityId = request.entityId();
|
||||
ret.entityTypeName = QString::fromStdString(request.entityTypeName());
|
||||
ret.operatorId = request.operatorId();
|
||||
ret.workstationId = request.workstationId();
|
||||
ret.exerciseId = request.exerciseId() ? QVariant(request.exerciseId()) : QVariant();
|
||||
ret.entityId = request.entityId;
|
||||
ret.entityTypeName = QString::fromStdString(request.entityTypeName);
|
||||
ret.operatorId = request.operatorId;
|
||||
ret.workstationId = request.workstationId;
|
||||
ret.exerciseId = request.exerciseId ? QVariant(request.exerciseId) : QVariant();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -367,20 +367,20 @@ bool HandlerLockedTopics::publishLockedEntity(const Core::LockedEntity &entity)
|
||||
m_dtsLockedEntity->write(entity);
|
||||
return true;
|
||||
}
|
||||
ERROR_LOG(m_logger) << "Publishing LockedEntity " << entity.id() << " failed: DTS not available!";
|
||||
ERROR_LOG(m_logger) << "Publishing LockedEntity " << entity.id << " failed: DTS not available!";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HandlerLockedTopics::removeLockedEntity(int64_t id)
|
||||
{
|
||||
Core::LockedEntity entity;
|
||||
entity.id(id);
|
||||
entity.id = id;
|
||||
if (m_dtsLockedEntity)
|
||||
{
|
||||
m_dtsLockedEntity->remove(entity);
|
||||
return true;
|
||||
}
|
||||
ERROR_LOG(m_logger) << "Removing LockedEntity " << entity.id() << " failed: DTS not available!";
|
||||
ERROR_LOG(m_logger) << "Removing LockedEntity " << entity.id << " failed: DTS not available!";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+104
-104
@@ -74,7 +74,7 @@ bool HandlerOperator::init()
|
||||
INFO_LOG(m_logger) << "------- opMap size" << opMap.size();
|
||||
|
||||
OperatorManagement::OperatorWorkstationAlive alive;
|
||||
alive.lastAlive(QDateTime::currentMSecsSinceEpoch());
|
||||
alive.lastAlive = QDateTime::currentMSecsSinceEpoch();
|
||||
for (const Database::OpmOperator &op : qAsConst(dataVec))
|
||||
{
|
||||
ObjectOperator *ifs(new ObjectOperator(m_mainHandler));
|
||||
@@ -99,8 +99,8 @@ bool HandlerOperator::init()
|
||||
m_operatorObjMap.insert(ifs->getId(), ifs);
|
||||
if (!op.workstationId.isNull())
|
||||
{
|
||||
alive.operatorId(op.id);
|
||||
alive.workstationId(op.workstationId.toInt());
|
||||
alive.operatorId = op.id;
|
||||
alive.workstationId = op.workstationId.toInt();
|
||||
onOperatorWorkstationAliveChanged(alive, DataModification::eAdded);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void HandlerOperator::onOperatorChangePasswordRequest(const rti::core::SampleIde
|
||||
const OperatorChangePasswordRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onOperatorChangePasswordRequest()";
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->fts()->operatorChangePasswordReply(cookie,
|
||||
@@ -150,15 +150,15 @@ void HandlerOperator::onOperatorChangePasswordRequest(const rti::core::SampleIde
|
||||
Core::FunctionReplyObject ret;
|
||||
Database::OpmOperator op = ifs->data();
|
||||
|
||||
const auto &pw = request.oldPassword();
|
||||
const auto &pw = request.oldPassword;
|
||||
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
|
||||
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
|
||||
|
||||
const auto &pwNew = request.password();
|
||||
const auto &pwNew = request.password;
|
||||
const QByteArray baNew(QByteArray::fromRawData(pwNew.c_str(), pwNew.size()));
|
||||
const QString enteredPasswordNew(QString::fromLatin1(QCryptographicHash::hash(baNew, QCryptographicHash::Md5).toHex()));
|
||||
|
||||
if (request.forceSet() || op.password == enteredPassword)
|
||||
if (request.forceSet || op.password == enteredPassword)
|
||||
{
|
||||
if (enteredPassword == enteredPasswordNew)
|
||||
ret = Core::FunctionReplyObject(0, tr_lts("dds", "Password is identical to old password."));
|
||||
@@ -185,7 +185,7 @@ void HandlerOperator::onOperatorCreateModifyRequest(const rti::core::SampleIdent
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
DEBUG_LOG(m_logger) << "onOperatorCreateModifyRequest()";
|
||||
if (!request.id().is_set())
|
||||
if (!request.id.is_set())
|
||||
ret = operatorCreateRequest(request);
|
||||
else
|
||||
ret = operatorModifyRequest(request);
|
||||
@@ -197,15 +197,15 @@ void HandlerOperator::onOperatorCreateModifyRequest(const rti::core::SampleIdent
|
||||
|
||||
Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorCreateModifyRequest &request)
|
||||
{
|
||||
if (!request.name().is_set() ||
|
||||
!request.password().is_set())
|
||||
if (!request.name.is_set() ||
|
||||
!request.password.is_set())
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Can not create operator - name or password is empty."));
|
||||
|
||||
// Group anlegen
|
||||
GroupCreateRequest groupRequest;
|
||||
groupRequest.name(request.name().get());
|
||||
groupRequest.description(request.description().get());
|
||||
groupRequest.type(GroupType_def::OperatorGroup);
|
||||
groupRequest.name = request.name.get();
|
||||
groupRequest.description = request.description.get();
|
||||
groupRequest.type = GroupType::OperatorGroup;
|
||||
|
||||
const Core::FunctionReplyObject groupRet = m_mainHandler->getHandlerGroup()->create(groupRequest);
|
||||
if (groupRet.error())
|
||||
@@ -213,33 +213,33 @@ Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorC
|
||||
|
||||
// Operator anlegen
|
||||
Database::OpmOperator op;
|
||||
op.name = QString::fromStdString(request.name().get());
|
||||
if (request.description().is_set())
|
||||
op.description = QString::fromStdString(request.description().get());
|
||||
op.name = QString::fromStdString(request.name.get());
|
||||
if (request.description.is_set())
|
||||
op.description = QString::fromStdString(request.description.get());
|
||||
|
||||
|
||||
const auto &pw = request.password().get();
|
||||
const auto &pw = request.password.get();
|
||||
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
|
||||
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
|
||||
|
||||
op.password = enteredPassword;
|
||||
op.primaryGroupId = groupRet.id();
|
||||
if (request.image().is_set())
|
||||
op.image = LtsUtils::toQByteArray(request.image().get());
|
||||
const auto vpbe = request.visiblePartiesByExercise();
|
||||
if (request.image.is_set())
|
||||
op.image = LtsUtils::toQByteArray(request.image.get());
|
||||
const auto vpbe = request.visiblePartiesByExercise;
|
||||
for (const auto &pbe : vpbe)
|
||||
{
|
||||
if (!pbe.visibleParties().is_set() || pbe.exerciseId() != 0) //has_value not support on windows yet so we need depricated is_set
|
||||
if (!pbe.visibleParties.is_set() || pbe.exerciseId != 0) //has_value not support on windows yet so we need depricated is_set
|
||||
continue;
|
||||
|
||||
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties().get());
|
||||
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties.get());
|
||||
}
|
||||
if (request.rolePresetId().is_set())
|
||||
if (request.rolePresetId.is_set())
|
||||
{
|
||||
op.rolePresetId = request.rolePresetId().get();
|
||||
op.rolePresetId = request.rolePresetId.get();
|
||||
}
|
||||
op.projectionPriority = request.projectionPriority().is_set() ? request.projectionPriority().get() : 1;
|
||||
op.audioChannelPriority = request.audioChannelPriority().is_set() ? request.audioChannelPriority().get() : 1;
|
||||
op.projectionPriority = request.projectionPriority.is_set() ? request.projectionPriority.get() : 1;
|
||||
op.audioChannelPriority = request.audioChannelPriority.is_set() ? request.audioChannelPriority.get() : 1;
|
||||
|
||||
ObjectOperator *ifs(new ObjectOperator(m_mainHandler));
|
||||
const Core::FunctionReplyObject ret = ifs->createObject(op, {});
|
||||
@@ -250,14 +250,14 @@ Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorC
|
||||
delete ifs;
|
||||
return ret;
|
||||
}
|
||||
if (request.visibleExercises().is_set())
|
||||
ifs->updateExercises(request.visibleExercises().get());
|
||||
if (request.visibleExercises.is_set())
|
||||
ifs->updateExercises(request.visibleExercises.get());
|
||||
|
||||
if (request.operatorRights().is_set())
|
||||
if (request.operatorRights.is_set())
|
||||
{
|
||||
GroupChangeMembersRequest grChReq;
|
||||
grChReq.id(op.primaryGroupId);
|
||||
grChReq.memberships(request.operatorRights().get());
|
||||
grChReq.id = op.primaryGroupId;
|
||||
grChReq.memberships = request.operatorRights.get();
|
||||
// We don't actually care, if this fails...
|
||||
m_mainHandler->getHandlerGroup()->changeMembership(grChReq);
|
||||
ifs->reloadAcls(true);
|
||||
@@ -286,18 +286,18 @@ void HandlerOperator::operatorModifyRolePresetId( int operatorId, int rolePreset
|
||||
|
||||
Core::FunctionReplyObject HandlerOperator::operatorModifyRequest(const OperatorCreateModifyRequest &request)
|
||||
{
|
||||
if (request.password().is_set())
|
||||
if (request.password.is_set())
|
||||
return Core::FunctionReplyObject(tr_lts("dds", "Can not modify operator password with this function."));
|
||||
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id().get());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id.get());
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(request.id().get(), tr_lts("dds", "No valid operator id given."));
|
||||
return Core::FunctionReplyObject(request.id.get(), tr_lts("dds", "No valid operator id given."));
|
||||
|
||||
Database::OpmOperator op = ifs->data();
|
||||
|
||||
if (request.name().is_set())
|
||||
if (request.name.is_set())
|
||||
{
|
||||
op.name = QString::fromStdString(request.name().get());
|
||||
op.name = QString::fromStdString(request.name.get());
|
||||
|
||||
for (const ObjectOperator *o : qAsConst(m_operatorObjMap))
|
||||
{
|
||||
@@ -308,32 +308,32 @@ Core::FunctionReplyObject HandlerOperator::operatorModifyRequest(const OperatorC
|
||||
}
|
||||
}
|
||||
|
||||
if (request.description().is_set())
|
||||
op.description = QString::fromStdString(request.description().get());
|
||||
if (request.image().is_set())
|
||||
op.image = LtsUtils::toQByteArray(request.image().get());
|
||||
const auto vpbe = request.visiblePartiesByExercise();
|
||||
if (request.description.is_set())
|
||||
op.description = QString::fromStdString(request.description.get());
|
||||
if (request.image.is_set())
|
||||
op.image = LtsUtils::toQByteArray(request.image.get());
|
||||
const auto vpbe = request.visiblePartiesByExercise;
|
||||
for (const auto &pbe : vpbe)
|
||||
{
|
||||
// only ex0 updated
|
||||
if (!pbe.visibleParties().is_set() || pbe.exerciseId() != 0) //has_value not support on windows yet so we need depricated is_set
|
||||
if (!pbe.visibleParties.is_set() || pbe.exerciseId != 0) //has_value not support on windows yet so we need depricated is_set
|
||||
continue;
|
||||
|
||||
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties().get());
|
||||
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties.get());
|
||||
}
|
||||
|
||||
if (request.rolePresetId().is_set())
|
||||
if (request.rolePresetId.is_set())
|
||||
{
|
||||
op.rolePresetId = request.rolePresetId().get();
|
||||
op.rolePresetId = request.rolePresetId.get();
|
||||
}
|
||||
|
||||
if (request.visibleExercises().is_set())
|
||||
ifs->updateExercises(request.visibleExercises().get());
|
||||
if (request.projectionPriority().is_set())
|
||||
op.projectionPriority = request.projectionPriority().get();
|
||||
if (request.audioChannelPriority().is_set())
|
||||
op.audioChannelPriority = request.audioChannelPriority().get();
|
||||
op.properties = QString::fromStdString(request.properties());
|
||||
if (request.visibleExercises.is_set())
|
||||
ifs->updateExercises(request.visibleExercises.get());
|
||||
if (request.projectionPriority.is_set())
|
||||
op.projectionPriority = request.projectionPriority.get();
|
||||
if (request.audioChannelPriority.is_set())
|
||||
op.audioChannelPriority = request.audioChannelPriority.get();
|
||||
op.properties = QString::fromStdString(request.properties);
|
||||
|
||||
return ifs->updateObject(op);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void HandlerOperator::onOperatorRemoveRequest(const rti::core::SampleIdentity &c
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onOperatorRemoveRequest()" << request;
|
||||
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->fts()->operatorRemoveReply(cookie,
|
||||
@@ -359,12 +359,12 @@ void HandlerOperator::onOperatorRemoveRequest(const rti::core::SampleIdentity &c
|
||||
}
|
||||
|
||||
OperatorManagement::User ddsData;
|
||||
ddsData.id(request.id());
|
||||
ddsData.id = request.id;
|
||||
|
||||
if (m_mainHandler->dds()->topicLockMaster()->isLocked(ddsData, 0))
|
||||
{
|
||||
m_mainHandler->fts()->operatorRemoveReply(cookie,
|
||||
Core::FunctionReplyObject(request.id(), tr_lts("dds", "Operator '%1' is used by another user!")).arg(ifs->name()));
|
||||
Core::FunctionReplyObject(request.id, tr_lts("dds", "Operator '%1' is used by another user!")).arg(ifs->name()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "OperatorLoginRequest: " << request;
|
||||
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->fts()->operatorLoginReply(cookie,
|
||||
@@ -399,7 +399,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
return;
|
||||
}
|
||||
|
||||
const auto &pw = request.password();
|
||||
const auto &pw = request.password;
|
||||
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
|
||||
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
|
||||
if (enteredPassword != ifs->data().password)
|
||||
@@ -415,16 +415,16 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
if (!ifs->data().workstationId.isNull() && ifs->data().workstationId.toInt() > 0)
|
||||
// operator already logged in
|
||||
{
|
||||
if (ifs->data().workstationId == request.workstationId())
|
||||
if (ifs->data().workstationId == request.workstationId)
|
||||
{
|
||||
// do nothing if same operator claims same workstation
|
||||
}
|
||||
else if (!request.force())
|
||||
else if (!request.force)
|
||||
{
|
||||
// Already claimed: Return WSid as ID
|
||||
const auto ws = m_mainHandler->dds()->dtcAsm()->asset(ifs->data().workstationId.toInt());
|
||||
ret = Core::FunctionReplyObject(ifs->data().workstationId.toInt(),
|
||||
tr_lts("dds", "Operator already logged in on workstation %1.")).arg(QString::fromStdString(ws.name()));
|
||||
tr_lts("dds", "Operator already logged in on workstation %1.")).arg(QString::fromStdString(ws.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -436,13 +436,13 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
if (other)
|
||||
{
|
||||
OperatorLogoutRequest req;
|
||||
req.id(otherOperatorId);
|
||||
req.id = otherOperatorId;
|
||||
onOperatorLogoutRequest(cookie, req);
|
||||
}
|
||||
}
|
||||
Database::OpmOperator op = ifs->data();
|
||||
op.workstationIp = request.workstationIp();
|
||||
op.workstationId = request.workstationId();
|
||||
op.workstationIp = request.workstationIp;
|
||||
op.workstationId = request.workstationId;
|
||||
ret = ifs->updateObject(op);
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
// operator not logged in on any workstation
|
||||
{
|
||||
// if other operator is logged in on same WS -> logout other operator and login our operator
|
||||
int otherOperatorId = getLoggedOperatorId(request.workstationId());
|
||||
int otherOperatorId = getLoggedOperatorId(request.workstationId);
|
||||
|
||||
if (otherOperatorId != 0 && otherOperatorId != ifs->data().id)
|
||||
{
|
||||
@@ -458,15 +458,15 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
if (other)
|
||||
{
|
||||
OperatorLogoutRequest req;
|
||||
req.id(otherOperatorId);
|
||||
req.id = otherOperatorId;
|
||||
onOperatorLogoutRequest(cookie, req);
|
||||
WARNING_LOG(m_logger) << "Logged out operator " << otherOperatorId << " on workstation id " << request.workstationId();
|
||||
WARNING_LOG(m_logger) << "Logged out operator " << otherOperatorId << " on workstation id " << request.workstationId;
|
||||
}
|
||||
}
|
||||
// Claim WS:
|
||||
Database::OpmOperator op = ifs->data();
|
||||
op.workstationIp = request.workstationIp();
|
||||
op.workstationId = request.workstationId();
|
||||
op.workstationIp = request.workstationIp;
|
||||
op.workstationId = request.workstationId;
|
||||
ret = ifs->updateObject(op);
|
||||
}
|
||||
|
||||
@@ -474,8 +474,8 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedIn(request.id(), request.workstationId());
|
||||
m_mainHandler->getHandlerActiveApps()->cleanupOperator(request.id());
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedIn(request.id, request.workstationId);
|
||||
m_mainHandler->getHandlerActiveApps()->cleanupOperator(request.id);
|
||||
}
|
||||
|
||||
m_mainHandler->fts()->operatorLoginReply(cookie, ret);
|
||||
@@ -493,7 +493,7 @@ void HandlerOperator::onOperatorLogoutRequest(const rti::core::SampleIdentity &c
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "OperatorLogoutRequest: " << request;
|
||||
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
{
|
||||
m_mainHandler->fts()->operatorLogoutReply(cookie, Core::FunctionReplyObject(0, tr_lts("dds", "No valid operator id for logout.")));
|
||||
@@ -509,7 +509,7 @@ void HandlerOperator::onOperatorLogoutRequest(const rti::core::SampleIdentity &c
|
||||
op.workstationIp = 0;
|
||||
op.workstationId = QVariant();
|
||||
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(request.id()); // workstationId = 0 -> logout
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(request.id); // workstationId = 0 -> logout
|
||||
m_mainHandler->getHandlerActiveApps()->cleanupOperator(op.id);
|
||||
|
||||
m_mainHandler->fts()->operatorLogoutReply(cookie, ifs->updateObject(op));
|
||||
@@ -520,45 +520,45 @@ void HandlerOperator::onOperatorGetSetSettingsRequest(const rti::core::SampleIde
|
||||
{
|
||||
Core::FunctionReplyObject fro;
|
||||
OperatorGetSetSettingsReply reply;
|
||||
reply.id(request.id());
|
||||
reply.id = request.id;
|
||||
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (ifs)
|
||||
{
|
||||
if (request.settings().is_set())
|
||||
if (request.settings.is_set())
|
||||
{
|
||||
const auto &data = request.settings().get();
|
||||
const auto &data = request.settings.get();
|
||||
const QByteArray settings(QByteArray(reinterpret_cast<const char*>(&data[0]), data.size()));
|
||||
if (!ifs->saveSettings(settings))
|
||||
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error saving settings in database.") );
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Error saving settings in database.") );
|
||||
}
|
||||
else
|
||||
{
|
||||
QByteArray settings;
|
||||
if (!ifs->loadSettings(settings))
|
||||
{
|
||||
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error loading settings from database.") );
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Error loading settings from database.") );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!settings.isEmpty())
|
||||
{
|
||||
reply.settings().set({});
|
||||
reply.settings().get() = LtsUtils::convert<std::vector<uint8_t>>(settings);
|
||||
reply.settings.set({});
|
||||
reply.settings.get() = LtsUtils::convert<std::vector<uint8_t>>(settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "No valid operator id for retrieving settings."));
|
||||
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "No valid operator id for retrieving settings."));
|
||||
}
|
||||
|
||||
if (fro.error())
|
||||
{
|
||||
reply.id(fro.id());
|
||||
reply.errorString(fro.str());
|
||||
reply.errorParams(fro.args());
|
||||
reply.id = fro.id();
|
||||
reply.errorString = fro.str();
|
||||
reply.errorParams = fro.args();
|
||||
}
|
||||
|
||||
m_mainHandler->fts()->operatorGetSetSettingsReply(cookie, reply);
|
||||
@@ -575,11 +575,11 @@ void HandlerOperator::onOperatorApplyForeignAclsRequest(const rti::core::SampleI
|
||||
|
||||
Core::FunctionReplyObject HandlerOperator::operatorApplyForeignAclsRequest(const OperatorApplyForeignAclsRequest &request)
|
||||
{
|
||||
ObjectOperator *receiver = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *receiver = m_operatorObjMap.value(request.id);
|
||||
if (!receiver)
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Receiving operator not present."));
|
||||
|
||||
ObjectOperator *remoteOperator = m_operatorObjMap.value(request.remoteOperatorId());
|
||||
ObjectOperator *remoteOperator = m_operatorObjMap.value(request.remoteOperatorId);
|
||||
if (!remoteOperator)
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Remote operator not present."));
|
||||
|
||||
@@ -599,20 +599,20 @@ void HandlerOperator::onOperatorUpdateVisiblePartiesByExerciseRequest(const rti:
|
||||
|
||||
Core::FunctionReplyObject HandlerOperator::operatorUpdateVisiblePartiesByExerciseRequest(const OperatorUpdateVisiblePartiesByExerciseRequest &request)
|
||||
{
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
|
||||
if (!ifs)
|
||||
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "No valid operator id given."));
|
||||
return Core::FunctionReplyObject(request.id, tr_lts("dds", "No valid operator id given."));
|
||||
|
||||
Database::OpmOperatorExercise opEx;
|
||||
opEx.operatorId = request.id();
|
||||
opEx.exerciseId = request.exerciseId();
|
||||
opEx.operatorId = request.id;
|
||||
opEx.exerciseId = request.exerciseId;
|
||||
std::vector<int> hiddenParties;
|
||||
if (request.hiddenParties().is_set())
|
||||
opEx.hiddenParties = LtsUtils::IntArray(request.hiddenParties().get());
|
||||
if (request.visibleParties().is_set())
|
||||
opEx.visibleParties = LtsUtils::IntArray(request.visibleParties().get());
|
||||
if (request.hiddenParties.is_set())
|
||||
opEx.hiddenParties = LtsUtils::IntArray(request.hiddenParties.get());
|
||||
if (request.visibleParties.is_set())
|
||||
opEx.visibleParties = LtsUtils::IntArray(request.visibleParties.get());
|
||||
|
||||
opEx.properties = QString::fromStdString(request.properties());
|
||||
opEx.properties = QString::fromStdString(request.properties);
|
||||
|
||||
return ifs->updateOperatorExercise(opEx);
|
||||
}
|
||||
@@ -626,13 +626,13 @@ void HandlerOperator::reloadAcls()
|
||||
void HandlerOperator::onOperatorWorkstationAliveChanged(const OperatorManagement::OperatorWorkstationAlive &data, DataModification modType)
|
||||
{
|
||||
INFO_LOG(m_logger) << "onOperatorWorkstationAliveChanged: " << data << ", " << modType;
|
||||
if (data.operatorId() < 0)
|
||||
if (data.operatorId < 0)
|
||||
{
|
||||
m_aliveData.remove(data.workstationId());
|
||||
m_aliveData.remove(data.workstationId);
|
||||
return;
|
||||
}
|
||||
|
||||
auto &events = m_aliveData[data.workstationId()];
|
||||
auto &events = m_aliveData[data.workstationId];
|
||||
events.push_back(data);
|
||||
// do not store more than 30 history events
|
||||
if (events.size() > 30)
|
||||
@@ -651,7 +651,7 @@ void HandlerOperator::onCheckAliveTimeout()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking alive for workstation " << it.key();
|
||||
auto &events = it.value();
|
||||
if (events.isEmpty() || events.last().lastAlive() >= tTimeoutTime)
|
||||
if (events.isEmpty() || events.last().lastAlive >= tTimeoutTime)
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
@@ -659,14 +659,14 @@ void HandlerOperator::onCheckAliveTimeout()
|
||||
// no reference, will be a dangling one after m_aliveData.erase(it) !
|
||||
const OperatorWorkstationAlive owa = events.last();
|
||||
|
||||
WARNING_LOG(m_logger) << "Timeout for workstation " << owa.workstationId()
|
||||
<< " and operator " << owa.operatorId() << " - logging out";
|
||||
WARNING_LOG(m_logger) << "Timeout for workstation " << owa.workstationId
|
||||
<< " and operator " << owa.operatorId << " - logging out";
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
for (const auto &event : events)
|
||||
DEBUG_LOG(m_logger) << "Alive history: " << event;
|
||||
}
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(owa.operatorId());
|
||||
ObjectOperator *ifs = m_operatorObjMap.value(owa.operatorId);
|
||||
it = m_aliveData.erase(it);
|
||||
|
||||
if (!ifs)
|
||||
@@ -674,8 +674,8 @@ void HandlerOperator::onCheckAliveTimeout()
|
||||
Database::OpmOperator op = ifs->data();
|
||||
op.workstationIp = 0;
|
||||
op.workstationId = QVariant();
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(owa.operatorId()); // workstationId = 0 -> logout
|
||||
m_mainHandler->getHandlerActiveApps()->cleanupOperator(owa.operatorId());
|
||||
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(owa.operatorId); // workstationId = 0 -> logout
|
||||
m_mainHandler->getHandlerActiveApps()->cleanupOperator(owa.operatorId);
|
||||
|
||||
ifs->updateObject(op);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool MainHandler::initWebSocketHandler()
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
return false;
|
||||
}
|
||||
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::PortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::CorePortType::WebSocketServer);
|
||||
DEBUG_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler succesful.";
|
||||
|
||||
return true;
|
||||
|
||||
+3
-3
@@ -51,9 +51,9 @@ void ObjectAccessControlLevel::onPublishData()
|
||||
|
||||
OperatorManagement::AccessControlLevel ddsData;
|
||||
|
||||
ddsData.id(m_data.id);
|
||||
ddsData.name(m_data.name.toStdString());
|
||||
ddsData.description(m_data.description.toStdString());
|
||||
ddsData.id = m_data.id;
|
||||
ddsData.name = m_data.name.toStdString();
|
||||
ddsData.description = m_data.description.toStdString();
|
||||
|
||||
// Todo: Copy as above
|
||||
INFO_LOG(m_logger) << "Publish OpmAccessControlLevel-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
@@ -220,14 +220,14 @@ void ObjectGroup::onPublishData()
|
||||
{
|
||||
OperatorManagement::Group ddsData;
|
||||
|
||||
ddsData.id(m_data.id);
|
||||
ddsData.name(m_data.name.toStdString());
|
||||
ddsData.description(m_data.description.toStdString());
|
||||
ddsData.aclAllow(m_aclAllow);
|
||||
ddsData.aclDeny(m_aclDeny);
|
||||
ddsData.isHidden(m_data.isHidden);
|
||||
ddsData.type(m_data.typeId);
|
||||
ddsData.isMemberOf(m_isMemberOf);
|
||||
ddsData.id = m_data.id;
|
||||
ddsData.name = m_data.name.toStdString();
|
||||
ddsData.description = m_data.description.toStdString();
|
||||
ddsData.aclAllow = m_aclAllow;
|
||||
ddsData.aclDeny = m_aclDeny;
|
||||
ddsData.isHidden = m_data.isHidden;
|
||||
ddsData.type = m_data.typeId;
|
||||
ddsData.isMemberOf = m_isMemberOf;
|
||||
|
||||
INFO_LOG(m_logger) << "Publish OpmGroup-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
|
||||
+21
-21
@@ -307,12 +307,12 @@ void ObjectOperator::onPublishData()
|
||||
{
|
||||
OperatorManagement::User op;
|
||||
|
||||
op.id(m_data.id);
|
||||
op.name(m_data.name.toStdString());
|
||||
op.description(m_data.description.toStdString());
|
||||
op.primaryGroupId(m_data.primaryGroupId);
|
||||
op.rolePresetId(m_data.rolePresetId);
|
||||
op.effectiveAcls() = LtsUtils::convert<std::vector<int32_t>>(m_effectiveAcls);
|
||||
op.id = m_data.id;
|
||||
op.name = m_data.name.toStdString();
|
||||
op.description = m_data.description.toStdString();
|
||||
op.primaryGroupId = m_data.primaryGroupId;
|
||||
op.rolePresetId = m_data.rolePresetId;
|
||||
op.effectiveAcls = LtsUtils::convert<std::vector<int32_t>>(m_effectiveAcls);
|
||||
|
||||
auto vpbe = toDdsData(m_dataExercise);
|
||||
// Append Visible Parties Template (= exId == 0)
|
||||
@@ -325,16 +325,16 @@ void ObjectOperator::onPublishData()
|
||||
|
||||
vpbe.push_back(OperatorManagement::PartiesByExercise(0, m_data.visibleParties(), std::vector<int>(),
|
||||
adlerAllowedDocument.toJson(QJsonDocument::Compact).toStdString()));
|
||||
op.visiblePartiesByExercise(vpbe);
|
||||
op.visiblePartiesByExercise = vpbe;
|
||||
|
||||
op.exerciseIds(m_exercises);
|
||||
op.image() = LtsUtils::convert<std::vector<uint8_t>>(m_data.image);
|
||||
op.workstationIp(m_data.workstationIp);
|
||||
op.workstationId(m_data.workstationId.toInt());
|
||||
op.projectionPriority(m_data.projectionPriority);
|
||||
op.audioChannelPriority(m_data.audioChannelPriority);
|
||||
op.rolePresetId(m_data.rolePresetId);
|
||||
op.properties(m_data.properties.toStdString());
|
||||
op.exerciseIds = m_exercises;
|
||||
op.image = LtsUtils::convert<std::vector<uint8_t>>(m_data.image);
|
||||
op.workstationIp = m_data.workstationIp;
|
||||
op.workstationId = m_data.workstationId.toInt();
|
||||
op.projectionPriority = m_data.projectionPriority;
|
||||
op.audioChannelPriority = m_data.audioChannelPriority;
|
||||
op.rolePresetId = m_data.rolePresetId;
|
||||
op.properties = m_data.properties.toStdString();
|
||||
|
||||
INFO_LOG(m_logger) << "Publish OpmOperator-data to dds (" << m_data.id
|
||||
<< " rolePresetId =" << m_data.rolePresetId
|
||||
@@ -351,22 +351,22 @@ std::vector<OperatorManagement::PartiesByExercise> ObjectOperator::toDdsData(con
|
||||
for (const Database::OpmOperatorExercise &ooe : dbData)
|
||||
{
|
||||
PartiesByExercise pbe;
|
||||
pbe.exerciseId(ooe.exerciseId);
|
||||
pbe.visibleParties();
|
||||
pbe.hiddenParties();
|
||||
pbe.exerciseId = ooe.exerciseId;
|
||||
pbe.visibleParties;
|
||||
pbe.hiddenParties;
|
||||
std::vector<int> visibleParty;
|
||||
for (const auto &elem : ooe.visibleParties())
|
||||
{
|
||||
visibleParty.push_back(elem);
|
||||
}
|
||||
pbe.visibleParties().set(visibleParty);
|
||||
pbe.visibleParties.set(visibleParty);
|
||||
std::vector<int> hiddenParty;
|
||||
for (const auto &elem : ooe.hiddenParties())
|
||||
{
|
||||
hiddenParty.push_back(elem);
|
||||
}
|
||||
pbe.hiddenParties().set(hiddenParty);
|
||||
pbe.properties(ooe.properties.toStdString());
|
||||
pbe.hiddenParties.set(hiddenParty);
|
||||
pbe.properties = ooe.properties.toStdString();
|
||||
ddsData.push_back(pbe);
|
||||
}
|
||||
return ddsData;
|
||||
|
||||
+26
-26
@@ -27,20 +27,20 @@ DtcImplCustom::DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
|
||||
QVector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
|
||||
{
|
||||
std::vector<int> ret;
|
||||
QVector<int> ret;
|
||||
|
||||
DEBUG_LOG(m_logger) << "OperatorRight: " << operatorRight;
|
||||
for (const User &user : std::as_const(m_userCont))
|
||||
{
|
||||
for (int acl : user.effectiveAcls())
|
||||
for (int acl : user.effectiveAcls)
|
||||
{
|
||||
if (operatorRight != acl)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Found acl in Operator " << user.id() << ", operatorRight=" << operatorRight << ", acl=" << acl;
|
||||
ret.push_back(user.id());
|
||||
DEBUG_LOG(m_logger) << "Found acl in Operator " << user.id << ", operatorRight=" << operatorRight << ", acl=" << acl;
|
||||
ret.push_back(user.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -48,31 +48,31 @@ std::vector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
|
||||
QVector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
|
||||
{
|
||||
std::vector<int> ret;
|
||||
QVector<int> ret;
|
||||
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " exerciseId: " << exerciseId << ", partyId: " << partyId;
|
||||
|
||||
for (const User &user : std::as_const(m_userCont))
|
||||
{
|
||||
const auto visiblePartiesByExercise = user.visiblePartiesByExercise();
|
||||
const auto visiblePartiesByExercise = user.visiblePartiesByExercise;
|
||||
for (const auto &pbe : visiblePartiesByExercise)
|
||||
{
|
||||
if (pbe.exerciseId() != exerciseId)
|
||||
if (pbe.exerciseId != exerciseId)
|
||||
continue;
|
||||
|
||||
if (!pbe.visibleParties().has_value())
|
||||
if (!pbe.visibleParties.has_value())
|
||||
continue;
|
||||
|
||||
std::vector<int> hiddenParties;
|
||||
if (pbe.hiddenParties().has_value())
|
||||
if (pbe.hiddenParties.has_value())
|
||||
{
|
||||
const auto& hiddenQVec = pbe.hiddenParties().value();
|
||||
const auto& hiddenQVec = pbe.hiddenParties.value();
|
||||
hiddenParties = std::vector<int>(hiddenQVec.begin(), hiddenQVec.end());
|
||||
}
|
||||
|
||||
for (const auto &id : pbe.visibleParties().value())
|
||||
for (const auto &id : pbe.visibleParties.value())
|
||||
{
|
||||
if (id != partyId)
|
||||
continue;
|
||||
@@ -86,7 +86,7 @@ std::vector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int par
|
||||
}
|
||||
|
||||
if (!isHidden)
|
||||
ret.push_back(user.id());
|
||||
ret.push_back(user.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,17 +164,17 @@ bool DtcImplCustom::sendAdlerNotification(const QString &jsonStr, const int exer
|
||||
return !found;
|
||||
}
|
||||
|
||||
std::vector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
|
||||
QVector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
|
||||
{
|
||||
const std::vector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
|
||||
std::vector<int> operatorIds;
|
||||
const QVector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
|
||||
QVector<int> operatorIds;
|
||||
|
||||
for (const auto &userId : operatorsByOperatorRight)
|
||||
{
|
||||
bool inExercise = false;
|
||||
const auto user = m_userCont.value(userId);
|
||||
// Only include operators who are assigned to the exercise.
|
||||
const auto& exerciseIds = user.exerciseIds();
|
||||
const auto& exerciseIds = user.exerciseIds;
|
||||
for (const auto &exerciseIdUser : exerciseIds)
|
||||
{
|
||||
if (exerciseIdUser == exerciseId)
|
||||
@@ -185,13 +185,13 @@ std::vector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, c
|
||||
}
|
||||
if (!inExercise)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Operator name=" << user.name() << " not in Exercise id=" << exerciseId;
|
||||
DEBUG_LOG(m_logger) << "Operator name=" << user.name << " not in Exercise id=" << exerciseId;
|
||||
continue;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "getNotificationRecipents OperatorId" << user.id() << ", Name=" << user.name() << ", properties=" << user.properties();
|
||||
if (isAdlerAllowedParty(exerciseId, partyId, user.id()) &&
|
||||
sendAdlerNotification(user.properties(), exerciseId, partyId, notificationType))
|
||||
operatorIds.push_back(user.id());
|
||||
DEBUG_LOG(m_logger) << "getNotificationRecipents OperatorId" << user.id << ", Name=" << user.name << ", properties=" << user.properties;
|
||||
if (isAdlerAllowedParty(exerciseId, partyId, user.id) &&
|
||||
sendAdlerNotification(QString::fromStdString(user.properties), exerciseId, partyId, notificationType))
|
||||
operatorIds.push_back(user.id);
|
||||
}
|
||||
return operatorIds;
|
||||
}
|
||||
@@ -201,13 +201,13 @@ bool DtcImplCustom::isAdlerAllowedParty(int exerciseId, int partyId, int operato
|
||||
DEBUG_LOG(m_logger) << LOGFUNCTION << " exerciseId: " << exerciseId << ", partyId: "
|
||||
<< partyId << ", operatorId: " << operatorId;
|
||||
|
||||
const auto visiblePartiesByExercise = m_userCont[operatorId].visiblePartiesByExercise();
|
||||
const auto visiblePartiesByExercise = m_userCont[operatorId].visiblePartiesByExercise;
|
||||
for (const auto &pbe : visiblePartiesByExercise)
|
||||
{
|
||||
if (pbe.exerciseId() != exerciseId)
|
||||
if (pbe.exerciseId != exerciseId)
|
||||
continue;
|
||||
|
||||
const QJsonObject propsObj(QJsonDocument::fromJson(pbe.properties().toUtf8()).object());
|
||||
const QJsonObject propsObj(QJsonDocument::fromJson(QString::fromStdString(pbe.properties).toUtf8()).object());
|
||||
const QJsonArray parties = propsObj.value(QStringLiteral("adlerAllowed")).toArray();
|
||||
|
||||
for (const QJsonValue &val : parties)
|
||||
|
||||
+3
-3
@@ -23,9 +23,9 @@ public:
|
||||
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
|
||||
|
||||
// custom procs, body must be implemented by user
|
||||
std::vector<int> getOperatorsByOperatorRight(int operatorRight) override;
|
||||
std::vector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
|
||||
std::vector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
|
||||
QVector<int> getOperatorsByOperatorRight(int operatorRight) override;
|
||||
QVector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
|
||||
QVector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
|
||||
bool isAdlerAllowedParty(int exerciseId, int partyId, int operatorId) override;
|
||||
|
||||
private:
|
||||
|
||||
+91
-91
@@ -136,20 +136,20 @@ void ParticipantManagement::PpmTests::tryCreateTemplate()
|
||||
std::vector<ParticipantManagement::TemplateData> data;
|
||||
|
||||
ParticipantManagement::TemplateData td;
|
||||
td.modId(100);
|
||||
td.name("Test Template 100");
|
||||
td.designator("100");
|
||||
td.hierarchyNumber(100);
|
||||
td.typeId(19);
|
||||
td.superiorModId(1);
|
||||
td.tacticalIdentifier("100");
|
||||
td.modId = 100;
|
||||
td.name = "Test Template 100";
|
||||
td.designator = "100";
|
||||
td.hierarchyNumber = 100;
|
||||
td.typeId = 19;
|
||||
td.superiorModId = 1;
|
||||
td.tacticalIdentifier = "100";
|
||||
|
||||
data.push_back(td);
|
||||
|
||||
m_dtc->waitForHistoricalDataTemplateParticipant();
|
||||
ParticipantManagement::TemplateParticipant tp = m_dtc->templateParticipant(1);
|
||||
const ParticipantManagement::TemplateData tdSup(m_dtc->convertFromParticipantTemplateToTemplateData(tp));
|
||||
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId();
|
||||
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId;
|
||||
|
||||
data.push_back(tdSup);
|
||||
|
||||
@@ -168,18 +168,18 @@ void ParticipantManagement::PpmTests::tryCreateParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send Create ParticipantData per ModifyParticipantData";
|
||||
|
||||
ParticipantManagement::ParticipantData ptd;
|
||||
ptd.modId(1);
|
||||
ptd.name("Test Participant 1");
|
||||
ptd.typeId(m_typeId);
|
||||
ptd.partyId(m_partyId);
|
||||
ptd.equipmentNumber(m_equipmentId);
|
||||
ptd.hierarchyNumber(1);
|
||||
ptd.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
ptd.modId = 1;
|
||||
ptd.name = "Test Participant 1";
|
||||
ptd.typeId = m_typeId;
|
||||
ptd.partyId = m_partyId;
|
||||
ptd.equipmentNumber = m_equipmentId;
|
||||
ptd.hierarchyNumber = 1;
|
||||
ptd.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
|
||||
std::vector<ParticipantManagement::ParticipantData> data;
|
||||
data.push_back(ptd);
|
||||
ModifyParticipantDataRequest req;
|
||||
req.data(data);
|
||||
req.data = data;
|
||||
|
||||
if (!m_ftc->modifyParticipantDataRequest(req,this))
|
||||
{
|
||||
@@ -196,11 +196,11 @@ void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send update info per registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
rpr.equipmentNumber(m_equipmentId);
|
||||
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
rpr.identification("Test Indentification");
|
||||
rpr.info("Test Info2");
|
||||
rpr.participantId = m_participantId;
|
||||
rpr.equipmentNumber = m_equipmentId;
|
||||
rpr.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
rpr.identification = "Test Indentification";
|
||||
rpr.info = "Test Info2";
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
@@ -216,11 +216,11 @@ void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
||||
INFO_LOG(m_logger) << "Trying to send registerForParticantRequest";
|
||||
|
||||
ParticipantManagement::RegisterParticipantRequest rpr;
|
||||
rpr.participantId(m_participantId);
|
||||
rpr.equipmentNumber(m_equipmentId);
|
||||
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
||||
rpr.identification("Test");
|
||||
rpr.info("Test Info");
|
||||
rpr.participantId = m_participantId;
|
||||
rpr.equipmentNumber = m_equipmentId;
|
||||
rpr.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
rpr.identification = "Test";
|
||||
rpr.info = "Test Info";
|
||||
|
||||
if (!m_ftc->registerParticipantRequest(rpr,this))
|
||||
{
|
||||
@@ -237,18 +237,18 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
|
||||
ParticipantManagement::Party party;
|
||||
|
||||
party.name("Test Party AAA");
|
||||
party.role(ParticipantManagement::Role::Friend);
|
||||
party.color(-65536);
|
||||
party.fadingColor(-65536);
|
||||
party.name = "Test Party AAA";
|
||||
party.role = ParticipantManagement::Role::Friend;
|
||||
party.color = -65536;
|
||||
party.fadingColor = -65536;
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -256,17 +256,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party BBB");
|
||||
party.role(ParticipantManagement::Role::Friend);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party BBB";
|
||||
party.role = ParticipantManagement::Role::Friend;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -274,17 +274,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party CCC");
|
||||
party.role(ParticipantManagement::Role::Enemy);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party CCC";
|
||||
party.role = ParticipantManagement::Role::Enemy;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -292,17 +292,17 @@ void ParticipantManagement::PpmTests::tryCreateParty()
|
||||
failExit();
|
||||
}
|
||||
|
||||
party.name("Test Party DDD");
|
||||
party.role(ParticipantManagement::Role::Enemy);
|
||||
party.color(-16711936);
|
||||
party.fadingColor(-16711936);
|
||||
party.name = "Test Party DDD";
|
||||
party.role = ParticipantManagement::Role::Enemy;
|
||||
party.color = -16711936;
|
||||
party.fadingColor = -16711936;
|
||||
|
||||
req.id(-1);
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(false);
|
||||
req.id = -1;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = false;
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -323,19 +323,19 @@ void ParticipantManagement::PpmTests::tryModifyParty()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
ModifyPartyDataRequest req;
|
||||
req.id(m_partyId);
|
||||
req.name(std::string("Test Party ")+QString::number(m_partyId).toStdString()); // updating name
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.role(party.role());
|
||||
req.isUsedBy(true); // updating isUsed
|
||||
req.id = m_partyId;
|
||||
req.name = std::string("Test Party ")+QString::number(m_partyId).toStdString(); // updating name
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.role = party.role;
|
||||
req.isUsedBy = true; // updating isUsed
|
||||
|
||||
if (!m_ftc->modifyPartyDataRequest(req, this))
|
||||
{
|
||||
@@ -355,18 +355,18 @@ void ParticipantManagement::PpmTests::tryRemoveParty()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
RemovePartyRequest req;
|
||||
req.partyId(m_partyId);
|
||||
req.partyId = m_partyId;
|
||||
|
||||
if (!m_ftc->removePartyRequest(req,this))
|
||||
{
|
||||
if (party.isUsedBy())
|
||||
if (party.isUsedBy)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Not possible to delete used party!" ;
|
||||
successExit();
|
||||
@@ -387,7 +387,7 @@ void ParticipantManagement::PpmTests::trySyncParties()
|
||||
INFO_LOG(m_logger) << "Trying to sync parties with Ex 0";
|
||||
|
||||
SyncPartiesRequest req;
|
||||
req.exerciseId(42);
|
||||
req.exerciseId = 42;
|
||||
|
||||
if (!m_ftc->syncPartiesRequest(req, this))
|
||||
{
|
||||
@@ -407,15 +407,15 @@ void ParticipantManagement::PpmTests::tryChangeUsed()
|
||||
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
if (party.id() < 0)
|
||||
if (party.id < 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
||||
failExit();
|
||||
}
|
||||
|
||||
ChangePartyUsedStateRequest req;
|
||||
req.partyId(m_partyId);
|
||||
req.isUsedBy(false); // updating isUsed
|
||||
req.partyId = m_partyId;
|
||||
req.isUsedBy = false; // updating isUsed
|
||||
|
||||
if (!m_ftc->changePartyUsedStateRequest(req, this))
|
||||
{
|
||||
@@ -433,14 +433,14 @@ void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
||||
INFO_LOG(m_logger) << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
|
||||
|
||||
ParticipantManagement::EquipmentType etd;
|
||||
etd.id(1);
|
||||
etd.name("Test Equipment Type 1");
|
||||
etd.minEquipNo(1000);
|
||||
etd.maxEquipNo(1999);
|
||||
etd.traVulnerabilityModelId(1);
|
||||
etd.traPlayerTypeId(110);
|
||||
etd.wmsTypeClass(ParticipantManagement::WmsTypeClass::Human);
|
||||
etd.deletedInWms(false);
|
||||
etd.id = 1;
|
||||
etd.name = "Test Equipment Type 1";
|
||||
etd.minEquipNo = 1000;
|
||||
etd.maxEquipNo = 1999;
|
||||
etd.traVulnerabilityModelId = 1;
|
||||
etd.traPlayerTypeId = 110;
|
||||
etd.wmsTypeClass = ParticipantManagement::WmsTypeClass::Human;
|
||||
etd.deletedInWms = false;
|
||||
|
||||
std::vector<ParticipantManagement::EquipmentType> data;
|
||||
data.push_back(etd);
|
||||
@@ -581,7 +581,7 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
|
||||
m_dtc->waitForHistoricalDataParty();
|
||||
party = m_dtc->party(m_partyId);
|
||||
|
||||
if (replyObject.error() && !party.isUsedBy())
|
||||
if (replyObject.error() && !party.isUsedBy)
|
||||
{
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
@@ -593,8 +593,8 @@ void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionRep
|
||||
|
||||
void ParticipantManagement::PpmTests::onRegisterParticipantReply(const RegisterReply &reply)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
|
||||
for ( std::string str : reply.errorParams())
|
||||
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString << "exerciseId: " << reply.exerciseId;
|
||||
for ( std::string str : reply.errorParams)
|
||||
ERROR_LOG(m_logger) << "error params: " << str;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -108,17 +108,17 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
m_mutex.unlock();
|
||||
|
||||
// When a participant can have mounted participants, then there is always mountedParticipants set, can be empty
|
||||
if (newPosition.mountedParticipants().is_set())
|
||||
if (newPosition.mountedParticipants.is_set())
|
||||
{
|
||||
// list of new mounted participants
|
||||
std::vector<int32_t> newMountedParticipantIds;
|
||||
// list of already mounted participants
|
||||
std::vector<int32_t> currentMountedParticipantIds;
|
||||
if (m_positionPublished.mountedParticipants().is_set())
|
||||
currentMountedParticipantIds = m_positionPublished.mountedParticipants().get();
|
||||
if (m_positionPublished.mountedParticipants.is_set())
|
||||
currentMountedParticipantIds = m_positionPublished.mountedParticipants.get();
|
||||
|
||||
// set new position for all mounted participants
|
||||
for (const auto mountedEqId : newPosition.mountedParticipants().get())
|
||||
for (const auto mountedEqId : newPosition.mountedParticipants.get())
|
||||
{
|
||||
Participant *mountedParticipant = particpantHandler()->participantByEquipmentNumber(mountedEqId);
|
||||
|
||||
@@ -196,7 +196,7 @@ bool Participant::setPosition(const TrainingAreaBase::EquipmentPosition &newPosi
|
||||
|
||||
// set position if (new mounted position) or (unmounting and participant is still mounted)
|
||||
if ((mountedToId > 0) ||
|
||||
(mountedToId <= 0 && m_positionPublished.mountedOn().is_set()))
|
||||
(mountedToId <= 0 && m_positionPublished.mountedOn.is_set()))
|
||||
setPosition(mountedPosition);
|
||||
|
||||
m_positionToPublish.reportingSource(newPosition.position().reportingSource());
|
||||
@@ -802,17 +802,17 @@ bool Participant::hasToBeChanged(const ParticipantManagement::ParticipantBase &d
|
||||
|
||||
int newEquipmentNumber = 0;
|
||||
// don't know why this is needed though
|
||||
if (m_participantData.equipmentNumber().is_set())
|
||||
newEquipmentNumber = m_participantData.equipmentNumber().get();
|
||||
if (m_participantData.equipmentNumber.is_set())
|
||||
newEquipmentNumber = m_participantData.equipmentNumber.get();
|
||||
|
||||
if (data.equipmentNumber().is_set() && m_participantData.equipmentNumber() != data.equipmentNumber())
|
||||
if (data.equipmentNumber.is_set() && m_participantData.equipmentNumber() != data.equipmentNumber())
|
||||
{
|
||||
newEquipmentNumber = data.equipmentNumber().get();
|
||||
newEquipmentNumber = data.equipmentNumber.get();
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
// = Reserved for excon
|
||||
if (!data.equipmentNumber().is_set() &&
|
||||
if (!data.equipmentNumber.is_set() &&
|
||||
assignState == ParticipantManagement::ParticipantAssignState::HandoutExcon)
|
||||
{
|
||||
newEquipmentNumber = 0;
|
||||
@@ -836,7 +836,7 @@ bool Participant::hasToBeChanged(const ParticipantManagement::ParticipantBase &d
|
||||
if (curData.typeId() != data.typeId())
|
||||
m_bPublishPosition = !m_participantHandler->isUnitType(data.typeId());
|
||||
|
||||
const int oldEquipNo = curData.equipmentNumber().is_set() ? curData.equipmentNumber().get() : 0;
|
||||
const int oldEquipNo = curData.equipmentNumber.is_set() ? curData.equipmentNumber.get() : 0;
|
||||
|
||||
curData = data;
|
||||
|
||||
@@ -882,12 +882,12 @@ bool Participant::setOperationalState(const TrainingAreaBase::EquipmentOperation
|
||||
bool bRet = false;
|
||||
if (operationalState.isManipulation().is_set())
|
||||
{
|
||||
if (operationalState.equipmentFunctionId().is_set() &&
|
||||
if (operationalState.equipmentFunctionId.is_set() &&
|
||||
operationalState.isManipulation().get() &&
|
||||
operationalState.sampleTime() > m_lastManipulationReset) // add if there is a new manipulation which is not outdated
|
||||
{
|
||||
removeManipulation(operationalState.equipmentFunctionId().get()); // precautionary
|
||||
m_dynamicData.manipulation().emplace_back(operationalState.equipmentFunctionId().get(),
|
||||
removeManipulation(operationalState.equipmentFunctionId.get()); // precautionary
|
||||
m_dynamicData.manipulation().emplace_back(operationalState.equipmentFunctionId.get(),
|
||||
operationalState.sampleTime());
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public:
|
||||
int32_t typeId() const { return m_participantData.typeId(); }
|
||||
int32_t superiorId() const { return m_participantData.superiorId(); }
|
||||
// return optional?
|
||||
int32_t equipmentNumber() const { return m_participantData.equipmentNumber().is_set() ? m_participantData.equipmentNumber().get() : 0; }
|
||||
int32_t equipmentNumber() const { return m_participantData.equipmentNumber.is_set() ? m_participantData.equipmentNumber.get() : 0; }
|
||||
int32_t partyId() const { return m_participantData.partyId(); }
|
||||
bool isDeleted() const { return m_participantData.isDeleted(); }
|
||||
ParticipantAssignState assignState() const { return m_participantData.assignState(); }
|
||||
|
||||
+4
-4
@@ -174,9 +174,9 @@ void ParticipantHandler::onNewStateFromProxy(const TrainingAreaBase::EquipmentSt
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
pos.equipmentNumber(data.equipmentNumber());
|
||||
pos.sampleTime(data.sampleTime());
|
||||
if (data.position().is_set())
|
||||
if (data.position.is_set())
|
||||
{
|
||||
pos.position(data.position().get());
|
||||
pos.position(data.position.get());
|
||||
onNewPositionFromProxy(pos);
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
pos.equipmentNumber(data.equipmentNumber());
|
||||
pos.sampleTime(data.sampleTime());
|
||||
if (data.position().is_set())
|
||||
if (data.position.is_set())
|
||||
{
|
||||
Core::GeoPosition geoPos(data.position().get().lon(), data.position().get().lat(), 0);
|
||||
Core::GeoPosition geoPos(data.position.get().lon(), data.position.get().lat(), 0);
|
||||
pos.position().position(geoPos);
|
||||
if (participant->setPosition(pos))
|
||||
participant->publishPosition();
|
||||
|
||||
+10
-10
@@ -53,8 +53,8 @@ static inline Database::PpmParticipant toDbParticipant(const ParticipantData &cu
|
||||
newDbParticipant.isDeleted = currentData.isDeleted();
|
||||
newDbParticipant.isSimulated = currentData.isSimulated();
|
||||
newDbParticipant.assignState = currentData.assignState();
|
||||
if (currentData.equipmentNumber().is_set())
|
||||
newDbParticipant.equipmentNumber = currentData.equipmentNumber().get();
|
||||
if (currentData.equipmentNumber.is_set())
|
||||
newDbParticipant.equipmentNumber = currentData.equipmentNumber.get();
|
||||
newDbParticipant.hierarchyNumber = currentData.hierarchyNumber();
|
||||
newDbParticipant.properties = QString::fromStdString(currentData.properties());
|
||||
|
||||
@@ -677,9 +677,9 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
m_participantOrganisations.erase(it);
|
||||
}
|
||||
}
|
||||
if (request.participantOrganisation().is_set())
|
||||
if (request.participantOrganisation.is_set())
|
||||
{
|
||||
const ParticipantOrganisation &newOrga = request.participantOrganisation().get();
|
||||
const ParticipantOrganisation &newOrga = request.participantOrganisation.get();
|
||||
auto it = m_participantOrganisations.find(newOrga.participantId());
|
||||
|
||||
const int originPartyId = (it == m_participantOrganisations.end() ? -1 : it.value().originPartyId());
|
||||
@@ -1446,8 +1446,8 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
// assign state valid?
|
||||
DEBUG_LOG(m_logger) << "checking assign state";
|
||||
int32_t equipmentNumber = 0;
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
equipmentNumber = participantToValidate.equipmentNumber().get();
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
equipmentNumber = participantToValidate.equipmentNumber.get();
|
||||
|
||||
bool isAssignStateValid = existingParticipant->isNewAssignStateValid(participantToValidate.assignState(), equipmentNumber);
|
||||
if (!isAssignStateValid)
|
||||
@@ -1485,13 +1485,13 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
// new participant
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
{
|
||||
if (participantToValidate.assignState() != ParticipantAssignState::HandoutExcon)
|
||||
|
||||
return Core::FunctionReplyObject(participantToValidate.modId(),
|
||||
tr_lts("dds", "Got a new participant with an equipment number (%1) but assign state is not HandoutExcon"))
|
||||
.arg(participantToValidate.equipmentNumber().get());
|
||||
.arg(participantToValidate.equipmentNumber.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1583,9 +1583,9 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
if (participantToValidate.equipmentNumber().is_set())
|
||||
if (participantToValidate.equipmentNumber.is_set())
|
||||
{
|
||||
const int equipNo = participantToValidate.equipmentNumber().get();
|
||||
const int equipNo = participantToValidate.equipmentNumber.get();
|
||||
const int participantId = participantToValidate.id();
|
||||
DEBUG_LOG(m_logger) << "Check if equipment number is globally unique " << equipNo;
|
||||
int partIdLookup = m_equipNumber2ParticipantId.value(equipNo);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ static inline Database::PpmParticipant toDb(const ParticipantManagement::Partici
|
||||
db.typeId = ddsPart.typeId();
|
||||
db.externalId = ddsPart.externalId();
|
||||
db.designator = QString::fromStdString(ddsPart.designator());
|
||||
db.equipmentNumber = ddsPart.equipmentNumber().is_set() ? ddsPart.equipmentNumber().get() : 0;
|
||||
db.equipmentNumber = ddsPart.equipmentNumber.is_set() ? ddsPart.equipmentNumber.get() : 0;
|
||||
db.hierarchyNumber = ddsPart.hierarchyNumber();
|
||||
db.identification = QString::fromStdString(ddsPart.identification());
|
||||
db.info = QString::fromStdString(ddsPart.info());
|
||||
|
||||
+2
-2
@@ -124,8 +124,8 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
|
||||
// {
|
||||
// for (const auto &p : m_participantMap)
|
||||
// {
|
||||
// if (p.equipmentNumber().is_set())
|
||||
// m_equipmentNumbers.insert(p.equipmentNumber().get());
|
||||
// if (p.equipmentNumber.is_set())
|
||||
// m_equipmentNumbers.insert(p.equipmentNumber.get());
|
||||
// }
|
||||
// DEBUG_LOG(m_logger) << "setReplayStartTime-m_equipmentNumbers after" << m_equipmentNumbers.count();
|
||||
// }
|
||||
|
||||
@@ -115,7 +115,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "ParticipantHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_participantHandler->getWebSocketPort(), Core::PortType::WebSocketPositionServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_participantHandler->getWebSocketPort(), Core::CorePortType::WebSocketPositionServer);
|
||||
|
||||
m_targetInformationHandler = std::make_shared<ParticipantManagement::HandlerTargetInformation>(this);
|
||||
if (!m_targetInformationHandler->init())
|
||||
@@ -168,7 +168,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler initialized";
|
||||
m_ddsHandler->pacemaker()->addPort(m_websocketHandler->webSocketPort(), Core::PortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->addPort(m_websocketHandler->webSocketPort(), Core::CorePortType::WebSocketServer);
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
// UasHandler
|
||||
|
||||
@@ -24,7 +24,9 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
qWarning() << "########## youngestStateInformation ##########";
|
||||
|
||||
ParticipantManagement::StateInformation ret;
|
||||
ret.vulnerabilityState(ProjectDataManagement::VulnerabilityState::NotReady);
|
||||
// rtiddsgen 7.7 generates plain public members (no setters) and prefixed
|
||||
// PDM enumerators (commit be912de9d resolved duplicate enumerators).
|
||||
ret.vulnerabilityState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady;
|
||||
|
||||
if (stateList.empty())
|
||||
{
|
||||
@@ -58,7 +60,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
std::sort(sortedStateList.begin(), sortedStateList.end(),
|
||||
[/*&debug,readyToDebug*/](const ParticipantManagement::StateInformation &left, const ParticipantManagement::StateInformation &right)
|
||||
{
|
||||
if (left.stateTime() == right.stateTime() && left.vulnerabilityState() != right.vulnerabilityState())
|
||||
if (left.stateTime == right.stateTime && left.vulnerabilityState != right.vulnerabilityState)
|
||||
{
|
||||
// if (readyToDebug)
|
||||
// debug = true;
|
||||
@@ -66,10 +68,10 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
// qWarning() << "WARNING: StateInformation with state" << (int)left.vulnerabilityState().underlying() << "has the same stateTime as StateInformation with state" << (int)right.vulnerabilityState().underlying();
|
||||
|
||||
// sort by state if time is the same (higher state = winner)
|
||||
return (left.vulnerabilityState() > right.vulnerabilityState());
|
||||
return (left.vulnerabilityState > right.vulnerabilityState);
|
||||
}
|
||||
|
||||
return (left.stateTime() > right.stateTime());
|
||||
return (left.stateTime > right.stateTime);
|
||||
});
|
||||
|
||||
|
||||
@@ -77,7 +79,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
{
|
||||
qWarning() << ">> printing all SIs";
|
||||
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
|
||||
qWarning() << ">>>> si" << "siVulnId" << (uint8_t)si.vulnerabilityState().underlying() << "bits" << si.vulnerabilityBits() << "time" << si.stateTime();
|
||||
qWarning() << ">>>> si" << "siVulnId" << (uint8_t)si.vulnerabilityState << "bits" << si.vulnerabilityBits << "time" << si.stateTime;
|
||||
|
||||
qWarning() << ">> checking SIs";
|
||||
}
|
||||
@@ -85,7 +87,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
|
||||
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
|
||||
{
|
||||
const uint8_t siVulnId = si.vulnerabilityState().underlying();
|
||||
const uint8_t siVulnId = static_cast<uint8_t>(si.vulnerabilityState);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@@ -94,14 +96,14 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
|
||||
}
|
||||
|
||||
// we're only interested in 'visible' VBGs, don't care about near miss etc. here
|
||||
if (bSkipVbgGreaterCatastrophicKill && si.vulnerabilityState() > ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (bSkipVbgGreaterCatastrophicKill && si.vulnerabilityState > ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
{
|
||||
if (debug)
|
||||
qWarning() << ">>>> vulnId is higher than CK!";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bSkipSanitation && si.originatorType() == ProjectDataManagement::StateChangeOriginator::Sanitation)
|
||||
if (bSkipSanitation && si.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation)
|
||||
{
|
||||
if (debug)
|
||||
qWarning() << ">>>> is sanitation!";
|
||||
@@ -125,29 +127,29 @@ StateInformation youngestRealStateInformation(const std::vector<ParticipantManag
|
||||
if (stateList.size() == 0)
|
||||
{
|
||||
ParticipantManagement::StateInformation ret;
|
||||
ret.vulnerabilityState(ProjectDataManagement::VulnerabilityState::NotReady);
|
||||
ret.vulnerabilityState = ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady;
|
||||
return ret;
|
||||
}
|
||||
StateInformation youngestState = youngestStateInformation(stateList);
|
||||
size_t youngest = 0;
|
||||
for (size_t i = 1; i < stateList.size(); ++i)
|
||||
{
|
||||
const auto &tCurrent = stateList.at(i).stateTime();
|
||||
const auto &tYoungest = stateList.at(youngest).stateTime();
|
||||
const auto &tCurrent = stateList.at(i).stateTime;
|
||||
const auto &tYoungest = stateList.at(youngest).stateTime;
|
||||
|
||||
// we're only interested in 'visible' VBGs, don't care about near miss etc. here
|
||||
if (bSkipVbgGreaterCatastrophicKill && stateList.at(i).vulnerabilityState() > ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (bSkipVbgGreaterCatastrophicKill && stateList.at(i).vulnerabilityState > ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
continue;
|
||||
if (stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::Sanitation ||
|
||||
stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::MedicalTimeout)
|
||||
if (stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation ||
|
||||
stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MedicalTimeout)
|
||||
continue;
|
||||
if (tCurrent > youngestState.stateTime())
|
||||
if (tCurrent > youngestState.stateTime)
|
||||
continue;
|
||||
|
||||
bool higherState = (stateList.at(i).vulnerabilityState() > stateList.at(youngest).vulnerabilityState() ) ||
|
||||
(stateList.at(i).vulnerabilityState() == stateList.at(youngest).vulnerabilityState() && (stateList.at(i).vitality() < stateList.at(youngest).vitality()));
|
||||
bool higherState = (stateList.at(i).vulnerabilityState > stateList.at(youngest).vulnerabilityState ) ||
|
||||
(stateList.at(i).vulnerabilityState == stateList.at(youngest).vulnerabilityState && (stateList.at(i).vitality < stateList.at(youngest).vitality));
|
||||
|
||||
if ((tCurrent > tYoungest && (stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::ObserverController || stateList.at(i).originatorType() == ProjectDataManagement::StateChangeOriginator::ExerciseControl)) ||
|
||||
if ((tCurrent > tYoungest && (stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController || stateList.at(i).originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl)) ||
|
||||
(tCurrent > tYoungest && higherState) ||
|
||||
(tCurrent == tYoungest && higherState))
|
||||
youngest = i;
|
||||
@@ -165,7 +167,7 @@ ParticipantManagement::SanitationResult proceduresDone(const std::vector<StateIn
|
||||
|
||||
// If that guy is killed: NoEffect
|
||||
StateInformation youngestReal = youngestRealStateInformation(stateList);
|
||||
if (youngestReal.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (youngestReal.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)
|
||||
return SanitationResult::NoEffect;
|
||||
|
||||
|
||||
@@ -174,19 +176,19 @@ ParticipantManagement::SanitationResult proceduresDone(const std::vector<StateIn
|
||||
for (size_t i = 1; i < stateList.size(); ++i)
|
||||
{
|
||||
// Better than "Unhandled" can only occur if this is done by Sanitation or O/C
|
||||
if (stateList.at(i).originatorType() != ProjectDataManagement::StateChangeOriginator::Sanitation
|
||||
&& stateList.at(i).originatorType() != ProjectDataManagement::StateChangeOriginator::ObserverController )
|
||||
if (stateList.at(i).originatorType != ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation
|
||||
&& stateList.at(i).originatorType != ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController )
|
||||
continue;
|
||||
// Let's find the newest
|
||||
if (stateList.at(i).stateTime() < youngestReal.stateTime())
|
||||
if (stateList.at(i).stateTime < youngestReal.stateTime)
|
||||
continue;
|
||||
//
|
||||
if (ret == SanitationResult::Unhandled ) //we have a sanitation so at least 1
|
||||
ret = stateList.at(i).sanitationResult();
|
||||
ret = stateList.at(i).sanitationResult;
|
||||
|
||||
if (stateList.at(i).sanitationResult() == SanitationResult::Sufficient && ret != SanitationResult::Optimal )
|
||||
if (stateList.at(i).sanitationResult == SanitationResult::Sufficient && ret != SanitationResult::Optimal )
|
||||
ret = SanitationResult::Sufficient;
|
||||
if (stateList.at(i).sanitationResult() == SanitationResult::Optimal)
|
||||
if (stateList.at(i).sanitationResult == SanitationResult::Optimal)
|
||||
ret = SanitationResult::Optimal;
|
||||
|
||||
}
|
||||
|
||||
+100
-100
@@ -38,7 +38,7 @@ bool DtcImplCustom::rootTemplates(QVector<TemplateParticipant> &templateVector)
|
||||
|
||||
for (const auto &sample : m_dtcTemplateParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().superiorTemplateId() == 0)
|
||||
if (sample.data().superiorTemplateId == 0)
|
||||
templateVector.append(sample.data());
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ TemplateData DtcImplCustom::convertFromParticipantTemplateToTemplateData(const T
|
||||
TemplateBase &out = outputData;
|
||||
out = inputTemplate;
|
||||
// in cases where the ids are not updated by the treeModel
|
||||
outputData.modId(inputTemplate.templateId());
|
||||
outputData.superiorModId(inputTemplate.superiorTemplateId());
|
||||
outputData.modId = inputTemplate.templateId;
|
||||
outputData.superiorModId = inputTemplate.superiorTemplateId;
|
||||
|
||||
return outputData;
|
||||
}
|
||||
@@ -69,8 +69,8 @@ ParticipantData Interface::DtcImplCustom::convertParticipantToParticipantData(co
|
||||
ParticipantBase &out = outputData;
|
||||
out = inputParticipant;
|
||||
// in cases where the ids are not updated by the treeModel
|
||||
outputData.modId(inputParticipant.id());
|
||||
outputData.superiorModId(inputParticipant.superiorId());
|
||||
outputData.modId = inputParticipant.id;
|
||||
outputData.superiorModId = inputParticipant.superiorId;
|
||||
|
||||
return outputData;
|
||||
}
|
||||
@@ -104,14 +104,14 @@ QMap<int, Participant> DtcImplCustom::units() const
|
||||
QSet<int> unitTypeIds;
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
if (sample.data().typeClass() == TypeClass::Unit || sample.data().typeClass() == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id());
|
||||
if (sample.data().typeClass == TypeClass::Unit || sample.data().typeClass == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id);
|
||||
}
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (unitTypeIds.contains(sample.data().typeId()))
|
||||
ret.insert(sample.data().id(), sample.data());
|
||||
if (unitTypeIds.contains(sample.data().typeId))
|
||||
ret.insert(sample.data().id, sample.data());
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -120,11 +120,11 @@ QMap<int, Participant> DtcImplCustom::units() const
|
||||
bool DtcImplCustom::participantIdsByUnit(int unitId, const QMap<int, Participant> &participants, QSet<int> &participantIds)
|
||||
{
|
||||
const ParticipantManagement::Participant unit(participants.value(unitId));
|
||||
if (unit.id() != unitId)
|
||||
if (unit.id != unitId)
|
||||
return false;
|
||||
|
||||
const ParticipantManagement::Type unitType(type(unit.typeId()));
|
||||
if (unitType.typeClass() != ParticipantManagement::TypeClass::Unit && unitType.typeClass() != ParticipantManagement::TypeClass::SupportUnit)
|
||||
const ParticipantManagement::Type unitType(type(unit.typeId));
|
||||
if (unitType.typeClass != ParticipantManagement::TypeClass::Unit && unitType.typeClass != ParticipantManagement::TypeClass::SupportUnit)
|
||||
return false;
|
||||
|
||||
participantIds += recursiveInferiosForParticipant(unitId, participants);
|
||||
@@ -141,8 +141,8 @@ bool DtcImplCustom::visibleParties(QMap<int32_t, Party> &visibleParties, const Q
|
||||
|
||||
const bool bAll = (filter.size() == 1 && filter.first() == -1);
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
if (bAll || filter.contains(sample.data().id()))
|
||||
visibleParties.insert(sample.data().id(), sample);
|
||||
if (bAll || filter.contains(sample.data().id))
|
||||
visibleParties.insert(sample.data().id, sample);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -161,11 +161,11 @@ bool DtcImplCustom::isEquipmentNumberInUse(int equipmentNumber, int &exerciseId)
|
||||
|
||||
for (const auto &sample : m_dtcEquipmentExerciseMapping->readAlive())
|
||||
{
|
||||
for (const Equipment2ParticipantId &e2p : sample.data().mapping())
|
||||
for (const Equipment2ParticipantId &e2p : sample.data().mapping)
|
||||
{
|
||||
if (e2p.equipmentNumber() == equipmentNumber)
|
||||
if (e2p.equipmentNumber == equipmentNumber)
|
||||
{
|
||||
exerciseId = sample.data().exerciseId();
|
||||
exerciseId = sample.data().exerciseId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ bool DtcImplCustom::isTypeInUse(int typeId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().typeId() == typeId)
|
||||
if (sample.data().typeId == typeId)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -193,8 +193,8 @@ int DtcImplCustom::participantIdByEquipmentNumber(int equipmentNumber) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().equipmentNumber().is_set() && sample.data().equipmentNumber().get() == equipmentNumber)
|
||||
return sample.data().id();
|
||||
if (sample.data().equipmentNumber.is_set() && sample.data().equipmentNumber.get() == equipmentNumber)
|
||||
return sample.data().id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -207,10 +207,10 @@ int DtcImplCustom::equipmentNumberByParticipantId(int participantId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().id() == participantId)
|
||||
if (sample.data().id == participantId)
|
||||
{
|
||||
if (sample.data().equipmentNumber().is_set())
|
||||
return sample.data().equipmentNumber().get();
|
||||
if (sample.data().equipmentNumber.is_set())
|
||||
return sample.data().equipmentNumber.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,9 +231,9 @@ int DtcImplCustom::uasMissionIdByEquipmentNumber(int equipmentNumber) const
|
||||
}
|
||||
for (const auto &sample : m_dtcMissionPlan->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() == participantId)
|
||||
if (sample.data().participantId == participantId)
|
||||
{
|
||||
return sample.data().id();
|
||||
return sample.data().id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +247,8 @@ int DtcImplCustom::partyIdFromForceIdentifier(HlaForceIdentifierEnum inputForceI
|
||||
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
{
|
||||
if (sample.data().hlaForceIdentifier() == inputForceIdentifier)
|
||||
return sample.data().id();
|
||||
if (sample.data().hlaForceIdentifier == inputForceIdentifier)
|
||||
return sample.data().id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -268,16 +268,16 @@ ConnectState DtcImplCustom::saaConnectedState(const int partyId)
|
||||
|
||||
for (const auto &sample : m_dtcParty->readAlive())
|
||||
{
|
||||
if (partyId != sample.data().id())
|
||||
if (partyId != sample.data().id)
|
||||
continue;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(sample.data().properties()));
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(sample.data().properties));
|
||||
QJsonObject prop = doc.object();
|
||||
QJsonObject propAdler;
|
||||
if (prop.contains(QStringLiteral("Adler")))
|
||||
{
|
||||
propAdler = prop[QStringLiteral("Adler")].toObject();
|
||||
if (propAdler.contains(QStringLiteral("saaConnectedState")))
|
||||
return static_cast<ConnectState::inner_enum>(propAdler[QStringLiteral("saaConnectedState")].toInt());
|
||||
return static_cast<ConnectState>(propAdler[QStringLiteral("saaConnectedState")].toInt());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -291,8 +291,8 @@ QVector<int> DtcImplCustom::getSubordinatesByParticipant(const int participantId
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().superiorId() == participantId)
|
||||
result.append(sample.data().id());
|
||||
if (sample.data().superiorId == participantId)
|
||||
result.append(sample.data().id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -317,8 +317,8 @@ QVector<int> DtcImplCustom::getParticipantsByPolygon(const QPolygonF &polygon, b
|
||||
}
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
if (sample.data().typeClass() == TypeClass::Unit || sample.data().typeClass() == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id());
|
||||
if (sample.data().typeClass == TypeClass::Unit || sample.data().typeClass == TypeClass::SupportUnit)
|
||||
unitTypeIds.insert(sample.data().id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,17 +326,17 @@ QVector<int> DtcImplCustom::getParticipantsByPolygon(const QPolygonF &polygon, b
|
||||
|
||||
for (const auto ¤tPosition : m_dtcParticipantPosition->readAlive())
|
||||
{
|
||||
if (!includeUnits && unitTypeIds.contains(currentPosition.data().participantTypeId()))
|
||||
if (!includeUnits && unitTypeIds.contains(currentPosition.data().participantTypeId))
|
||||
continue;
|
||||
|
||||
if (!includeOc && currentPosition.data().partyId() == 1) // partyId 1 = OC
|
||||
if (!includeOc && currentPosition.data().partyId == 1) // partyId 1 = OC
|
||||
continue;
|
||||
|
||||
const Core::GeoPosition ¤tGeoPosition = currentPosition.data().pos();
|
||||
const QPointF positionPoint(currentGeoPosition.lon(), currentGeoPosition.lat());
|
||||
const Core::GeoPosition ¤tGeoPosition = currentPosition.data().pos;
|
||||
const QPointF positionPoint(currentGeoPosition.lon, currentGeoPosition.lat);
|
||||
|
||||
if (polygon.containsPoint(positionPoint, Qt::OddEvenFill))
|
||||
participantsInPolygon.append(currentPosition.data().participantId());
|
||||
participantsInPolygon.append(currentPosition.data().participantId);
|
||||
}
|
||||
|
||||
return participantsInPolygon;
|
||||
@@ -351,9 +351,9 @@ QVector<int> DtcImplCustom::getUasIds()
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (isTypeUas(sample.data().typeId()))
|
||||
if (isTypeUas(sample.data().typeId))
|
||||
{
|
||||
result.append(sample.data().id());
|
||||
result.append(sample.data().id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,13 +363,13 @@ QVector<int> DtcImplCustom::getUasIds()
|
||||
UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId) const
|
||||
{
|
||||
ParticipantManagement::UAS uas;
|
||||
uas.id(-1); // if not found
|
||||
uas.id = -1; // if not found
|
||||
|
||||
for (const auto &sample : m_dtcUAS->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() != participantId)
|
||||
if (sample.data().participantId != participantId)
|
||||
continue;
|
||||
if (sample.data().exerciseId() != exerciseId)
|
||||
if (sample.data().exerciseId != exerciseId)
|
||||
continue;
|
||||
uas = sample;
|
||||
break;
|
||||
@@ -380,20 +380,20 @@ UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId) cons
|
||||
MissionAction DtcImplCustom::currentMissionAction(int missionPlanId) const
|
||||
{
|
||||
ParticipantManagement::MissionAction missionAction;
|
||||
missionAction.planId(0); // default compare value in case nothing found
|
||||
missionAction.planId = 0; // default compare value in case nothing found
|
||||
for (const auto &sample : m_dtcMissionPlan->readAlive())
|
||||
{
|
||||
if (sample.data().id() != missionPlanId)
|
||||
if (sample.data().id != missionPlanId)
|
||||
continue;
|
||||
const std::vector<ParticipantManagement::MissionItem> &items = sample.data().items();
|
||||
const std::vector<ParticipantManagement::MissionItem> &items = sample.data().items;
|
||||
for (const auto &item : items)
|
||||
{
|
||||
if (item.fulfilled() > 0)
|
||||
if (item.fulfilled > 0)
|
||||
continue;
|
||||
const std::vector<ParticipantManagement::MissionAction> &actions = item.actions();
|
||||
const std::vector<ParticipantManagement::MissionAction> &actions = item.actions;
|
||||
for (const auto &action : actions)
|
||||
{
|
||||
if (action.fulfilled() > 0)
|
||||
if (action.fulfilled > 0)
|
||||
continue;
|
||||
return action;
|
||||
}
|
||||
@@ -406,11 +406,11 @@ ParticipantManagement::Participant DtcImplCustom::getParticipantByInternalName(i
|
||||
{
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().partyId() != partyId)
|
||||
if (sample.data().partyId != partyId)
|
||||
continue;
|
||||
if (sample.data().isDeleted())
|
||||
if (sample.data().isDeleted)
|
||||
continue;
|
||||
if (sample.data().name() != unitName.toStdString())
|
||||
if (sample.data().name != unitName.toStdString())
|
||||
continue;
|
||||
// Found Unit
|
||||
|
||||
@@ -420,12 +420,12 @@ ParticipantManagement::Participant DtcImplCustom::getParticipantByInternalName(i
|
||||
return sample;
|
||||
}
|
||||
|
||||
for (auto inferiorId : sample.data().inferiorIds())
|
||||
for (auto inferiorId : sample.data().inferiorIds)
|
||||
{
|
||||
const auto &inferiorParticipant = m_participantCont.value(inferiorId);
|
||||
if (inferiorParticipant.id() <= 0 || inferiorParticipant.isDeleted())
|
||||
if (inferiorParticipant.id <= 0 || inferiorParticipant.isDeleted)
|
||||
continue;
|
||||
if (inferiorParticipant.name() == internalName.toStdString())
|
||||
if (inferiorParticipant.name == internalName.toStdString())
|
||||
return inferiorParticipant;
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,7 @@ QSet<int> DtcImplCustom::recursiveInferiosForParticipant(int32_t participantId,
|
||||
|
||||
result += participantId;
|
||||
const Participant &p = it.value();
|
||||
for (int childId : p.inferiorIds())
|
||||
for (int childId : p.inferiorIds)
|
||||
result += recursiveInferiosForParticipant(childId, participants);
|
||||
return result;
|
||||
}
|
||||
@@ -457,10 +457,10 @@ QString DtcImplCustom::lookUpHierachy(int participantId, const QMap<int, Partici
|
||||
return QString();
|
||||
const auto &part = itPart.value();
|
||||
|
||||
QString supStr = lookUpHierachy(part.superiorId(), participants);
|
||||
QString ret = QString::fromStdString(part.designator());
|
||||
QString supStr = lookUpHierachy(part.superiorId, participants);
|
||||
QString ret = QString::fromStdString(part.designator);
|
||||
// First separator is "./"
|
||||
if (part.superiorId() == 0)
|
||||
if (part.superiorId == 0)
|
||||
return (ret + QLatin1String("./"));
|
||||
|
||||
if (supStr.endsWith(QLatin1String("./")))
|
||||
@@ -476,10 +476,10 @@ QVector<TemplateParticipant> DtcImplCustom::inferiorTemplates(int templateId)
|
||||
const TemplateParticipant participant = templateParticipant(templateId);
|
||||
retVector.append(participant);
|
||||
|
||||
if (participant.inferiorIds().is_set())
|
||||
if (participant.inferiorIds.is_set())
|
||||
{
|
||||
retVector.reserve(participant.inferiorIds().get().size() + retVector.size());
|
||||
for (int inferiorId : participant.inferiorIds().get())
|
||||
retVector.reserve(participant.inferiorIds.get().size() + retVector.size());
|
||||
for (int inferiorId : participant.inferiorIds.get())
|
||||
retVector.append(inferiorTemplates(inferiorId));
|
||||
}
|
||||
|
||||
@@ -493,9 +493,9 @@ bool DtcImplCustom::isTypePatientSimulator(int typeId) const
|
||||
|
||||
for (const auto &sample : m_dtcParticipant->readAlive())
|
||||
{
|
||||
if (sample.data().typeId() == typeId)
|
||||
if (sample.data().typeId == typeId)
|
||||
{
|
||||
const std::string &str = sample.data().properties();
|
||||
const std::string &str = sample.data().properties;
|
||||
if (str.size() > 0 && getNeedsIp(str) && getNeedsPort(str))
|
||||
return true;
|
||||
else
|
||||
@@ -512,9 +512,9 @@ bool DtcImplCustom::isAdlerType(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -539,9 +539,9 @@ bool DtcImplCustom::isArtilleryType(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -566,9 +566,9 @@ bool DtcImplCustom::isEditable(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -593,9 +593,9 @@ bool DtcImplCustom::isAdlerVerbund(int typeId) const
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (type.id() != typeId)
|
||||
if (type.id != typeId)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -620,9 +620,9 @@ bool DtcImplCustom::isPartyAdlerVerbund(int partyId) const
|
||||
|
||||
for (const Party &party : m_dtcParty->readAlive())
|
||||
{
|
||||
if (party.id() != partyId)
|
||||
if (party.id != partyId)
|
||||
continue;
|
||||
const auto &prob = party.properties();
|
||||
const auto &prob = party.properties;
|
||||
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
@@ -654,11 +654,11 @@ Type DtcImplCustom::getTypeFromAdlerType(const QString &adlerTypeName, bool isUn
|
||||
|
||||
for (const Type &type : m_dtcType->readAlive())
|
||||
{
|
||||
if (isUnit && type.typeClass() != TypeClass::Unit)
|
||||
if (isUnit && type.typeClass != TypeClass::Unit)
|
||||
continue;
|
||||
if (!isUnit && type.typeClass() != TypeClass::WeaponSystem)
|
||||
if (!isUnit && type.typeClass != TypeClass::WeaponSystem)
|
||||
continue;
|
||||
const auto &prob = type.properties();
|
||||
const auto &prob = type.properties;
|
||||
QJsonParseError parserError;
|
||||
const QByteArray props(QByteArray::fromRawData(prob.c_str(), prob.size()));
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(props, &parserError));
|
||||
@@ -673,11 +673,11 @@ Type DtcImplCustom::getTypeFromAdlerType(const QString &adlerTypeName, bool isUn
|
||||
if (val.toString() != adlerTypeName)
|
||||
continue;
|
||||
|
||||
if (isAdlerVerbund(type.id()) != isVerbund)
|
||||
if (isAdlerVerbund(type.id) != isVerbund)
|
||||
continue;
|
||||
// Found exact Type
|
||||
DEBUG_LOG(m_logger) << "--- "
|
||||
<< "Found exact type --> typeId= " << type.id() << " ---";
|
||||
<< "Found exact type --> typeId= " << type.id << " ---";
|
||||
return type;
|
||||
}
|
||||
return ret;
|
||||
@@ -698,9 +698,9 @@ bool DtcImplCustom::isTypeUas(int typeId)
|
||||
for (const auto &sample : m_dtcType->readAlive())
|
||||
{
|
||||
// DEBUG_LOG(m_logger) << " sample equipmentTypeId=" << sample.data().equipmentTypeId();
|
||||
if (sample.data().id() == typeId)
|
||||
if (sample.data().id == typeId)
|
||||
{
|
||||
const std::string &str = sample.data().properties();
|
||||
const std::string &str = sample.data().properties;
|
||||
if (str.size() > 0 && getIsUAS(str))
|
||||
return true;
|
||||
else
|
||||
@@ -724,9 +724,9 @@ UAS DtcImplCustom::getUasByParticipantId(int participantId, int exerciseId)
|
||||
|
||||
for (const auto &sample : m_dtcUAS->readAlive())
|
||||
{
|
||||
if (sample.data().participantId() != participantId)
|
||||
if (sample.data().participantId != participantId)
|
||||
continue;
|
||||
if (sample.data().exerciseId() != exerciseId)
|
||||
if (sample.data().exerciseId != exerciseId)
|
||||
continue;
|
||||
return sample;
|
||||
}
|
||||
@@ -744,13 +744,13 @@ int DtcImplCustom::getParticipantFromPrf(int prf) const
|
||||
|
||||
for (const DynamicParticipantData &sample : m_dtcDynamicParticipantData->readAlive())
|
||||
{
|
||||
for (const auto &designation : qAsConst(sample.designations()))
|
||||
for (const auto &designation : qAsConst(sample.designations))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code();
|
||||
if (designation.code() == prf)
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code;
|
||||
if (designation.code == prf)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code();
|
||||
return sample.participantId();
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code;
|
||||
return sample.participantId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,16 +765,16 @@ int DtcImplCustom::getPrfFromParticipant(int participantId) const
|
||||
|
||||
for (const DynamicParticipantData &sample : m_dtcDynamicParticipantData->readAlive())
|
||||
{
|
||||
if (participantId == sample.participantId())
|
||||
if (participantId == sample.participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "participantId=" << sample.participantId() << " designations.size()=" << sample.designations().size();
|
||||
for (const auto &designation : qAsConst(sample.designations()))
|
||||
DEBUG_LOG(m_logger) << "participantId=" << sample.participantId << " designations.size()=" << sample.designations.size();
|
||||
for (const auto &designation : qAsConst(sample.designations))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code();
|
||||
if (designation.code() > 0)
|
||||
DEBUG_LOG(m_logger) << " code=" << designation.code;
|
||||
if (designation.code > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code();
|
||||
return designation.code();
|
||||
DEBUG_LOG(m_logger) << " return code=" << designation.code;
|
||||
return designation.code;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -821,17 +821,17 @@ QMap<double, int> DtcImplCustom::sortByDistance(const double lon, const double l
|
||||
|
||||
for (const auto ¤tPosition : m_dtcParticipantPosition->readAlive())
|
||||
{
|
||||
if (participantIds.contains(currentPosition.data().participantId()))
|
||||
if (participantIds.contains(currentPosition.data().participantId))
|
||||
{
|
||||
auto pOrigin = LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat, zone);
|
||||
auto pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(currentPosition.data().pos().lon(), currentPosition.data().pos().lat(), zone);
|
||||
auto pPos = LtsCoordTrans::UtmCoordinate::fromGeographic(currentPosition.data().pos.lon, currentPosition.data().pos.lat, zone);
|
||||
double distance = LtsCoordTrans::distance(pPos, pOrigin);
|
||||
DEBUG_LOG(m_logger) << distance;
|
||||
// Save distance and particiapnt Id into temporar map.
|
||||
// the map is sorted so we can use that later instead of writing a sort method vor a vec
|
||||
// for now
|
||||
distanceMapSorted.insert(distance, currentPosition.data().participantId());
|
||||
DEBUG_LOG(m_logger) << "insert distance=" << distance << ", participantId=" << currentPosition.data().participantId();
|
||||
distanceMapSorted.insert(distance, currentPosition.data().participantId);
|
||||
DEBUG_LOG(m_logger) << "insert distance=" << distance << ", participantId=" << currentPosition.data().participantId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user