Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -44,7 +44,7 @@ JsonDispatcher::JsonDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
, m_webSocketReconnectTimer(new QTimer(this))
, m_bWarnedOnce(false)
{
DEBUG_LOG() << "JsonDispatcher::JsonDispatcher";
DEBUG_LOG(m_logger) << "JsonDispatcher::JsonDispatcher";
m_sendToWebsocket->setWSInterface(m_webSocketInterface);
connect(m_webSocketInterface.get(), &TrainingAreaBase::WebSocketInterface::recivedTelegram, this, &JsonDispatcher::onRecivedTelegram, Qt::UniqueConnection);
@@ -55,19 +55,19 @@ JsonDispatcher::JsonDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
bool JsonDispatcher::init() { return true; }
void JsonDispatcher::connectWebsocket()
{
DEBUG_LOG() << "JsonDispatcher::connectWebsocket()";
DEBUG_LOG(m_logger) << "JsonDispatcher::connectWebsocket()";
if (!m_webSocketInterface->init(Settings::getWebSocketServerPortRange(3)))
{
DEBUG_LOG() << "Adler Could not open WebSocketInterface";
DEBUG_LOG(m_logger) << "Adler Could not open WebSocketInterface";
}
else
{
DEBUG_LOG() << "Adler Could open WebSocketInterface on port " << m_webSocketInterface->getPort();
DEBUG_LOG(m_logger) << "Adler Could open WebSocketInterface on port " << m_webSocketInterface->getPort();
}
emit websocketConnected(m_webSocketInterface->getPort());
const QUrl url(webSocketUrl());
if (!m_bWarnedOnce)
DEBUG_LOG() << "Adler: Using WebSocket url: " << url.toString();
DEBUG_LOG(m_logger) << "Adler: Using WebSocket url: " << url.toString();
if (m_webSocket->state() != QAbstractSocket::ConnectedState)
m_webSocket->open(url);
}
@@ -76,7 +76,7 @@ void JsonDispatcher::onKeepAliveTimerTimeout()
{
QTimer *timer = qobject_cast<QTimer *>(sender());
int wsId = m_connectionKeepaliveTimer.key(timer);
DEBUG_LOG() << "onKeepAliveTimerTimeout Timeout from " << wsId << " still in list " << (getSAAByWs(wsId) != nullptr);
DEBUG_LOG(m_logger) << "onKeepAliveTimerTimeout Timeout from " << wsId << " still in list " << (getSAAByWs(wsId) != nullptr);
auto saa = getSAAByWs(wsId);
@@ -86,14 +86,14 @@ void JsonDispatcher::onKeepAliveTimerTimeout()
const ParticipantManagement::ConnectState connectState = ParticipantManagement::ConnectState::NoHeartbeat;
const bool isSaaConnected = (connectState == ParticipantManagement::ConnectState::Connected);
const int assetId = getAssetId(saa->getSAAName());
DEBUG_LOG() << "Timeout from " << saa->getSAAName() << " ==> SAA URL: " << saaUrl.toString();
DEBUG_LOG(m_logger) << "Timeout from " << saa->getSAAName() << " ==> SAA URL: " << saaUrl.toString();
m_ppmHandler
->modifyPartyAdlerProperties(wsId, assetId, saa->getPartyId(), saa->getSAAName(), saa->getSzenarName(), connectState, saa->getIsVerbund());
m_mainDispatcher->asmHandler()->modifyAssetAdlerProperties(assetId, isSaaConnected);
saa->setIsAlive(false);
}
else
ERROR_LOG() << "Trying to remove an saa after timeout with the websocketId: " << wsId << " that is not connected";
ERROR_LOG(m_logger) << "Trying to remove an saa after timeout with the websocketId: " << wsId << " that is not connected";
m_connectionKeepaliveTimer.remove(wsId);
timer->stop();
@@ -131,11 +131,11 @@ std::shared_ptr<TrainingAreaBase::SendToTab> JsonDispatcher::sendToTab() { retur
bool JsonDispatcher::canSendData() const { return m_webSocket && m_webSocket->state() == QAbstractSocket::ConnectedState; }
void JsonDispatcher::onNewWebsocketConnected(const int wsId, const QString &address, qint16 port)
{
DEBUG_LOG() << "New Connection from: " << address << ", port: " << port << ", with id: " << wsId;
DEBUG_LOG(m_logger) << "New Connection from: " << address << ", port: " << port << ", with id: " << wsId;
}
void JsonDispatcher::onWSDisconnected(const int wsId)
{
DEBUG_LOG() << "Connection disconnect wsId: " << wsId;
DEBUG_LOG(m_logger) << "Connection disconnect wsId: " << wsId;
auto saa = getSAAByWs(wsId);
if (saa)
@@ -143,7 +143,7 @@ void JsonDispatcher::onWSDisconnected(const int wsId)
}
std::shared_ptr<SAAInterface> JsonDispatcher::getSAAByParty(const int partyId)
{
DEBUG_LOG() << "getSAAByParty partyId: " << partyId;
DEBUG_LOG(m_logger) << "getSAAByParty partyId: " << partyId;
if (m_saaInterfaces.empty())
return nullptr;
auto it
@@ -159,9 +159,9 @@ std::shared_ptr<SAAInterface> JsonDispatcher::getSAAByName(const QString &saaNam
std::shared_ptr<SAAInterface> JsonDispatcher::getSAAByWs(const int wsId)
{
TRACE_LOG() << "m_saaInterfaces.size :" << m_saaInterfaces.size() << ", wsId=" << wsId;
TRACE_LOG(m_logger) << "m_saaInterfaces.size :" << m_saaInterfaces.size() << ", wsId=" << wsId;
for (int i = 0; i < m_saaInterfaces.size(); i++)
TRACE_LOG() << "i=" << i << ", getPartyId :" << m_saaInterfaces[i]->getPartyId() << ", getWsId :" << m_saaInterfaces[i]->getWsId();
TRACE_LOG(m_logger) << "i=" << i << ", getPartyId :" << m_saaInterfaces[i]->getPartyId() << ", getWsId :" << m_saaInterfaces[i]->getWsId();
auto it = std::find_if(m_saaInterfaces.begin(), m_saaInterfaces.end(), [wsId](const std::shared_ptr<SAAInterface> &saa) { return saa.get()->getWsId() == wsId; });
return it != m_saaInterfaces.end() ? *it : nullptr;
@@ -169,11 +169,11 @@ std::shared_ptr<SAAInterface> JsonDispatcher::getSAAByWs(const int wsId)
bool JsonDispatcher::sendExFeuerbereit(const ExFeuerbereit &exFBDataIn, const int partyId)
{
DEBUG_LOG() << "TRY SEND EXFeuerbereit attempt for party " << partyId;
DEBUG_LOG(m_logger) << "TRY SEND EXFeuerbereit attempt for party " << partyId;
auto saa = getSAAByParty(partyId);
if (!saa)
{
ERROR_LOG() << "sendExFeuerbereit no saa for paty:" << partyId;
ERROR_LOG(m_logger) << "sendExFeuerbereit no saa for paty:" << partyId;
return false;
}
@@ -181,7 +181,7 @@ bool JsonDispatcher::sendExFeuerbereit(const ExFeuerbereit &exFBDataIn, const in
exFB.sender = QStringLiteral("EXCON@GUEZ.DE");
exFB.receiver = saa->getSAAName();
exFB.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
WARNING_LOG() << "TRY SEND EXFeuerbereit attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
WARNING_LOG(m_logger) << "TRY SEND EXFeuerbereit attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
m_sendToWebsocket->onGenericTelegram1(saa->getWsId(), exFB.toJson());
return true;
@@ -189,7 +189,7 @@ bool JsonDispatcher::sendExFeuerbereit(const ExFeuerbereit &exFBDataIn, const in
bool JsonDispatcher::sendExAbgefeuert(const ExAbgefeuert &exAFDataIn, const int partyId)
{
DEBUG_LOG() << "TRY SEND EXFeuerbereit attempt for party " << partyId;
DEBUG_LOG(m_logger) << "TRY SEND EXFeuerbereit attempt for party " << partyId;
auto saa = getSAAByParty(partyId);
if (!saa)
return false;
@@ -198,7 +198,7 @@ bool JsonDispatcher::sendExAbgefeuert(const ExAbgefeuert &exAFDataIn, const int
exAF.sender = QStringLiteral("EXCON@GUEZ.DE");
exAF.receiver = saa->getSAAName();
exAF.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
WARNING_LOG() << "TRY SEND sendExAbgefeuert attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
WARNING_LOG(m_logger) << "TRY SEND sendExAbgefeuert attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
m_sendToWebsocket->onGenericTelegram1(saa->getWsId(), exAF.toJson());
return true;
@@ -206,7 +206,7 @@ bool JsonDispatcher::sendExAbgefeuert(const ExAbgefeuert &exAFDataIn, const int
bool JsonDispatcher::sendExMqManuelleQuittung(const ExMqManuelleQuittung &exMQDataIn, int partyId)
{
DEBUG_LOG() << "TRY SEND ExMqManuelleQuittung attempt for party " << partyId;
DEBUG_LOG(m_logger) << "TRY SEND ExMqManuelleQuittung attempt for party " << partyId;
auto saa = getSAAByParty(partyId);
if (!saa)
return false;
@@ -215,7 +215,7 @@ bool JsonDispatcher::sendExMqManuelleQuittung(const ExMqManuelleQuittung &exMQDa
exMQ.sender = QStringLiteral("EXCON@GUEZ.DE");
exMQ.receiver = saa->getSAAName();
exMQ.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
DEBUG_LOG() << "TRY SEND ExMqManuelleQuittung attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
DEBUG_LOG(m_logger) << "TRY SEND ExMqManuelleQuittung attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
m_sendToWebsocket->onGenericTelegram1(saa->getWsId(), exMQ.toJson());
return true;
@@ -223,7 +223,7 @@ bool JsonDispatcher::sendExMqManuelleQuittung(const ExMqManuelleQuittung &exMQDa
bool JsonDispatcher::sendExTqTechnischeQuittung(const ExTqTechnischeQuittung &exTQDataIn, int partyId)
{
DEBUG_LOG() << "TRY SEND ExTqTechnischeQuittung attempt for party " << partyId;
DEBUG_LOG(m_logger) << "TRY SEND ExTqTechnischeQuittung attempt for party " << partyId;
auto saa = getSAAByParty(partyId);
if (!saa)
return false;
@@ -232,7 +232,7 @@ bool JsonDispatcher::sendExTqTechnischeQuittung(const ExTqTechnischeQuittung &ex
exMQ.sender = QStringLiteral("EXCON@GUEZ.DE");
exMQ.receiver = saa->getSAAName();
exMQ.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
DEBUG_LOG() << "TRY SEND ExMqManuelleQuittung attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
DEBUG_LOG(m_logger) << "TRY SEND ExMqManuelleQuittung attempt for SAA NAME " << saa->getSAAName() << " esid " << saa->getWsId();
m_sendToWebsocket->onGenericTelegram1(saa->getWsId(), exMQ.toJson());
return true;
@@ -240,7 +240,7 @@ bool JsonDispatcher::sendExTqTechnischeQuittung(const ExTqTechnischeQuittung &ex
bool JsonDispatcher::sendExVollzugsmeldung(const ExVollzugsmeldung &exVZDataIn, int partyId)
{
DEBUG_LOG() << "TRY SEND ExVollzugsmeldung attempt for party " << partyId;
DEBUG_LOG(m_logger) << "TRY SEND ExVollzugsmeldung attempt for party " << partyId;
auto saa = getSAAByParty(partyId);
if (!saa)
return false;
@@ -249,33 +249,33 @@ bool JsonDispatcher::sendExVollzugsmeldung(const ExVollzugsmeldung &exVZDataIn,
exVZ.sender = QStringLiteral("EXCON@GUEZ.DE");
exVZ.receiver = saa->getSAAName();
exVZ.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
WARNING_LOG() << "TRY SEND ExVollzugsmeldung attempt for SAA NAME " << saa->getSAAName() << " WSID " << saa->getWsId();
WARNING_LOG(m_logger) << "TRY SEND ExVollzugsmeldung attempt for SAA NAME " << saa->getSAAName() << " WSID " << saa->getWsId();
m_sendToWebsocket->onGenericTelegram1(saa->getWsId(), exVZ.toJson());
return true;
}
void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const QString &saaName, const QString &szenarName, bool isVerbund, const QString &uuid)
{
DEBUG_LOG() << "Registration attempt from " << saaName << " for party " << partyId << ", saaName: " << saaName << ", uuid: " << uuid << ", wsId: " << wsId;
DEBUG_LOG(m_logger) << "Registration attempt from " << saaName << " for party " << partyId << ", saaName: " << saaName << ", uuid: " << uuid << ", wsId: " << wsId;
ExAnmeldebestaetigung exRC;
exRC.referenceUuid = uuid;
exRC.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
exRC.anBestaetigungsdaten.error = AdlerJson::L45_AnmeldebestaetigungFehlercode::Ok;
auto saa = getSAAByName(saaName);
DEBUG_LOG() << "is saa " << saa;
DEBUG_LOG(m_logger) << "is saa " << saa;
if (saa)
{
DEBUG_LOG() << "saa.get()->getPartyId(): " << saa.get()->getPartyId() << " partyId: " << partyId;
DEBUG_LOG(m_logger) << "saa.get()->getPartyId(): " << saa.get()->getPartyId() << " partyId: " << partyId;
if (saa.get()->getPartyId() == partyId)
{
DEBUG_LOG() << "saa already connected, reconnect!";
DEBUG_LOG(m_logger) << "saa already connected, reconnect!";
onSAADeregistration(saa.get()->getWsId(), partyId);
}
else
{
DEBUG_LOG() << "other saa connected to this party";
DEBUG_LOG(m_logger) << "other saa connected to this party";
@@ -283,7 +283,7 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
}
else if (getSAAByParty(partyId))
{
DEBUG_LOG() << "party is used by other saa";
DEBUG_LOG(m_logger) << "party is used by other saa";
}
@@ -296,10 +296,10 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
m_saaInterfaces.append(newSaa);
int adlerOffset = m_settings->settings()->value(QLatin1String("TrainingAreaBase/AdlerKeepalive"), 30000).toInt();
DEBUG_LOG() << "adlerOffset =" << adlerOffset;
DEBUG_LOG(m_logger) << "adlerOffset =" << adlerOffset;
if (adlerOffset > 0)
{
DEBUG_LOG() << "Started SAA with Keppalive Timer: " << adlerOffset;
DEBUG_LOG(m_logger) << "Started SAA with Keppalive Timer: " << adlerOffset;
QTimer *keepaliveTimer = new QTimer(this);
keepaliveTimer->setInterval(adlerOffset);
m_connectionKeepaliveTimer.insert(wsId, keepaliveTimer);
@@ -309,7 +309,7 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
saa = newSaa;
DEBUG_LOG() << "emit or answer without error wsId: " << wsId;
DEBUG_LOG(m_logger) << "emit or answer without error wsId: " << wsId;
}
exRC.sender = getSender();
exRC.receiver = saa->getSAAName();
@@ -326,7 +326,7 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
const ParticipantManagement::ConnectState connectState = ParticipantManagement::ConnectState::Connected;
const bool isSaaConnected = (connectState == ParticipantManagement::ConnectState::Connected);
const int assetId = getAssetId(saaName);
DEBUG_LOG() << "onSAARegistration modifyParty"
DEBUG_LOG(m_logger) << "onSAARegistration modifyParty"
<< " ==> SAA name " << saaName;
createNotificationRequest(wsId, QString::fromUtf8(tr_lts("Notification", "Reconnect to SAA")),
NotificationManagement::MessageType_def::Success,
@@ -340,7 +340,7 @@ void JsonDispatcher::onSAARegistration(const int wsId, const int partyId, const
void JsonDispatcher::onSAADeregistration(const int wsId, const int partyId)
{
DEBUG_LOG() << "onSAADeregistration"
DEBUG_LOG(m_logger) << "onSAADeregistration"
<< " wsId: " << wsId << ", partyId: " << partyId;
auto saa = getSAAByWs(wsId);
@@ -349,7 +349,7 @@ void JsonDispatcher::onSAADeregistration(const int wsId, const int partyId)
const ParticipantManagement::ConnectState connectState = ParticipantManagement::ConnectState::Disconnected;
const bool isSaaConnected = (connectState == ParticipantManagement::ConnectState::Connected);
const int assetId = getAssetId(saa->getSAAName());
DEBUG_LOG() << "Deregistation from " << saa->getSAAName();
DEBUG_LOG(m_logger) << "Deregistation from " << saa->getSAAName();
createNotificationRequest(wsId, QString::fromUtf8(tr_lts("Notification", "SAADeregistration")),
NotificationManagement::MessageType_def::Info,
NotificationManagement::NotificationType::AdlerNotification,
@@ -360,12 +360,12 @@ void JsonDispatcher::onSAADeregistration(const int wsId, const int partyId)
m_saaInterfaces.removeOne(saa);
}
else
ERROR_LOG() << "Trying to remove an saa with the websocketId: " << wsId << " that is not connected";
ERROR_LOG(m_logger) << "Trying to remove an saa with the websocketId: " << wsId << " that is not connected";
}
void JsonDispatcher::onSAAConnectionTest(const int wsId, const QString &uuid)
{
DEBUG_LOG() << "onSAAConnectionTest"
DEBUG_LOG(m_logger) << "onSAAConnectionTest"
<< " wsId: " << wsId << ", uuid: " << uuid;
auto saa = getSAAByWs(wsId);
@@ -379,10 +379,10 @@ void JsonDispatcher::onSAAConnectionTest(const int wsId, const QString &uuid)
QTimer *connectionTimer = m_connectionKeepaliveTimer.value(wsId);
if (connectionTimer)
{
DEBUG_LOG() << "connectionTimer->start()";
DEBUG_LOG(m_logger) << "connectionTimer->start()";
connectionTimer->start();
}
DEBUG_LOG() << "ConnectionTest from " << saa->getSAAName();
DEBUG_LOG(m_logger) << "ConnectionTest from " << saa->getSAAName();
EXConnectionTestReply exCTR;
exCTR.referenceUuid = uuid;
exCTR.timestamp = QDateTime::currentDateTime().toString(Qt::DateFormat::ISODate);
@@ -392,13 +392,13 @@ void JsonDispatcher::onSAAConnectionTest(const int wsId, const QString &uuid)
}
void JsonDispatcher::onSAAStatus(const int wsId, const EXStatus &status)
{
DEBUG_LOG() << "onSAAStatus"
DEBUG_LOG(m_logger) << "onSAAStatus"
<< " wsId: " << wsId << ", status: " << static_cast<int>(status.status);
auto saa = getSAAByWs(wsId);
if (saa)
{
DEBUG_LOG() << "Status from " << saa->getSAAName() << AdlerJson::szenarstatusToStr(status.status);
DEBUG_LOG(m_logger) << "Status from " << saa->getSAAName() << AdlerJson::szenarstatusToStr(status.status);
saa->setStatus(status.status);
QString title;
switch (status.status)
@@ -429,7 +429,7 @@ void JsonDispatcher::onSAAStatus(const int wsId, const EXStatus &status)
QString JsonDispatcher::getParticipantInfoLink(const QString &verein, const int partyId, const bool isVerbund)
{
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(verein, partyId, isVerbund);
DEBUG_LOG() << "ParticipantId=" << part.id();
DEBUG_LOG(m_logger) << "ParticipantId=" << part.id();
QString ppmlink = QString::fromUtf8(tr_lts("Notification","<a href='lts://ParticipantInfo/%1'>Show Participant Info</a><br />"))
.arg(part.id());
@@ -440,11 +440,11 @@ QString JsonDispatcher::getParticipantInfoLink(const QString &verein, const int
void JsonDispatcher::onSAAExceptionStatus(const int wsId, const TechnischeDaten &exceptionStatus)
{
DEBUG_LOG() << "onSAAExceptionStatus"
DEBUG_LOG(m_logger) << "onSAAExceptionStatus"
<< ", wsId: " << wsId << ", status: " << StatusL32Map.key(exceptionStatus.status) << ", beschreibung: " << exceptionStatus.beschreibung;
const auto saa = getSAAByWs(wsId);
DEBUG_LOG() << "Sende Notification Technische Quittung";
DEBUG_LOG(m_logger) << "Sende Notification Technische Quittung";
QString content = QString::fromUtf8(tr_lts("Notification", "<B>Status: </B>%1<br /><B> Description: </B>%2"));
@@ -467,7 +467,7 @@ void JsonDispatcher::onSAAExceptionStatus(const int wsId, const TechnischeDaten
void JsonDispatcher::onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS)
{
DEBUG_LOG() << "onSAASQWS";
DEBUG_LOG(m_logger) << "onSAASQWS";
const bool isVerbund = true;
auto saa = getSAAByWs(wsId);
int partyId = saa->getPartyId();
@@ -481,7 +481,7 @@ void JsonDispatcher::onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS)
args.append(QString::number(exSQWS.einheit.r));
args.append(exSQWS.einheit.verein);
DEBUG_LOG() << "Stellungsmeldung Waffensystem content=" << content;
DEBUG_LOG(m_logger) << "Stellungsmeldung Waffensystem content=" << content;
createNotificationRequest(wsId,
QString::fromUtf8(tr_lts("Notification","Weapon System Position Report")),
NotificationManagement::MessageType_def::Info,
@@ -494,7 +494,7 @@ void JsonDispatcher::onSAASQWS(const int wsId, const Waffensystemdaten &exSQWS)
void JsonDispatcher::onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS)
{
DEBUG_LOG() << "onSAASQFS";
DEBUG_LOG(m_logger) << "onSAASQFS";
auto saa = getSAAByWs(wsId);
int partyId = saa->getPartyId();
const bool isVerbund = true;
@@ -508,7 +508,7 @@ void JsonDispatcher::onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS
args.append(QString::number(exSQFS.feuereinheit.r));
args.append(exSQFS.feuereinheit.verein);
DEBUG_LOG() << "Stellungsmeldung Feuerstellung content=" << content;
DEBUG_LOG(m_logger) << "Stellungsmeldung Feuerstellung content=" << content;
createNotificationRequest(wsId,
QString::fromUtf8(tr_lts("Notification","Position Report: Firing Unit")),
NotificationManagement::MessageType_def::Info,
@@ -521,14 +521,14 @@ void JsonDispatcher::onSAASQFS(const int wsId, const Feuerstellungsdaten &exSQFS
void JsonDispatcher::onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP)
{
DEBUG_LOG() << "onSAASQLP";
DEBUG_LOG(m_logger) << "onSAASQLP";
auto saa = getSAAByWs(wsId);
int partyId = saa->getPartyId();
const bool isVerbund = true;
QStringList args;
const ParticipantManagement::Participant &part = m_ppmHandler->findParticipantByInternalName(exSQLP.einheit.verein, partyId, isVerbund);
DEBUG_LOG() << "ParticipantId=" << part.id();
DEBUG_LOG(m_logger) << "ParticipantId=" << part.id();
QString content = QString::fromUtf8(tr_lts("Notification","<a href='lts://ParticipantInfo/%1'>Show Participant Info</a><br /><B>Unit:</B> %2/%3/%4"));
@@ -543,29 +543,29 @@ void JsonDispatcher::onSAASQLP(const int wsId, const Ladeplatzdaten &exSQLP)
NotificationManagement::NotificationType::AdlerNotification,
content,
args);
DEBUG_LOG() << "Stellungsmeldung Ladeplatz content=" << content;
DEBUG_LOG(m_logger) << "Stellungsmeldung Ladeplatz content=" << content;
m_ppmHandler->parseSQLP(exSQLP, wsId);
}
void JsonDispatcher::onSAATrajectoryData(const int wsId, const Flugbahndaten &exFlugbahndaten, const QString referenceUuid)
{
DEBUG_LOG() << "onSAATrajectoryData wsId=" << wsId << ", referenceUuid :" << referenceUuid;
DEBUG_LOG(m_logger) << "onSAATrajectoryData wsId=" << wsId << ", referenceUuid :" << referenceUuid;
auto saa = getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "onSAATrajectoryData but SAA with wsId " << wsId << " not found";
ERROR_LOG(m_logger) << "onSAATrajectoryData but SAA with wsId " << wsId << " not found";
return;
}
QString referenceUuidAlt = referenceUuid;
referenceUuidAlt = referenceUuidAlt.replace(QStringLiteral("-"), QStringLiteral(""));
if (!m_trajectoryIdentifier.contains(referenceUuidAlt))
{
DEBUG_LOG() << "referenceUuid not found in m_trajectoryIdentifier"
DEBUG_LOG(m_logger) << "referenceUuid not found in m_trajectoryIdentifier"
<< ", referenceUuid : " << referenceUuidAlt;
for (auto it = m_trajectoryIdentifier.constBegin(); it != m_trajectoryIdentifier.constEnd(); ++it)
{
DEBUG_LOG() << "m_trajectoryIdentifier key : " << it.key() << ", value aesItemId :" << it.value().aesItemId << ", explosionId :" << it.value().explosionId;
DEBUG_LOG(m_logger) << "m_trajectoryIdentifier key : " << it.key() << ", value aesItemId :" << it.value().aesItemId << ", explosionId :" << it.value().explosionId;
}
}
@@ -583,7 +583,7 @@ void JsonDispatcher::onSAAHXGuidingLines(const int wsId, const Koordinierungsdat
auto saa = getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ HX (K) from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ HX (K) from SAA but SAA with id " << wsId << " not found";
return;
}
@@ -598,7 +598,7 @@ void JsonDispatcher::onSAAHXGuidingLinesAndBoundaries(const int wsId, const Fueh
auto saa = getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ HX (G) from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ HX (G) from SAA but SAA with id " << wsId << " not found";
return;
}
@@ -614,10 +614,10 @@ void JsonDispatcher::onSSAEXFIREHALT(const int wsId, const FeuerHaltDaten &feuer
const auto saa = getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "EX-FH from SSA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "EX-FH from SSA but SAA with id " << wsId << " not found";
}
DEBUG_LOG() << "[EX-FH] data from SSA " << wsId << " : "
DEBUG_LOG(m_logger) << "[EX-FH] data from SSA " << wsId << " : "
<< "verein: " << feuerhaltdaten.verein << " "
<< "kenner: " << feuerhaltdaten.kenner.underlying() << " "
<< "kategorie: " << feuerhaltdaten.kategorie.underlying() << " "
@@ -683,7 +683,7 @@ void JsonDispatcher::onWebSocketError()
if (!m_webSocket)
return;
if (!m_bWarnedOnce)
WARNING_LOG() << "Error connecting to " << webSocketUrl().toString() << ": " << m_webSocket->errorString();
WARNING_LOG(m_logger) << "Error connecting to " << webSocketUrl().toString() << ": " << m_webSocket->errorString();
m_webSocket->close();
m_webSocketReconnectTimer->start(5000);
m_bWarnedOnce = true;
@@ -715,11 +715,11 @@ void JsonDispatcher::onRecivedTelegram(int wsId, const QJsonObject &telegram)
QJsonDocument doc(telegram);
if (!isConnectionTest(doc))
{
DEBUG_LOG() << "Text Message received: " << doc.toJson() << ", wsId: " << wsId;
DEBUG_LOG(m_logger) << "Text Message received: " << doc.toJson() << ", wsId: " << wsId;
}
else
{
TRACE_LOG() << "Text Message received: " << doc.toJson() << ", wsId: " << wsId;
TRACE_LOG(m_logger) << "Text Message received: " << doc.toJson() << ", wsId: " << wsId;
}
int errorcode = 0;
@@ -728,7 +728,7 @@ void JsonDispatcher::onRecivedTelegram(int wsId, const QJsonObject &telegram)
TRACE_LOG() << "errorcode = " << errorcode;
TRACE_LOG(m_logger) << "errorcode = " << errorcode;
const int typeId = telegram[JsonKeys::TYPE_ID()].toInt();
if (typeId != TelegramIds::EX_FLUGBAHNDATEN())
return;
@@ -738,7 +738,7 @@ void JsonDispatcher::onRecivedTelegram(int wsId, const QJsonObject &telegram)
QString errorStr = FehlercodeMap.key(fehlercode);
QString completeErrorStr = QStringLiteral("Calculate Trajectory failed: ") + errorStr;
DEBUG_LOG() << "errorStr :" << errorStr << ", completeErrorStr :" << completeErrorStr;
DEBUG_LOG(m_logger) << "errorStr :" << errorStr << ", completeErrorStr :" << completeErrorStr;
Core::FunctionReplyObject reply = Core::FunctionReplyObject(-1, tr_lts("dds", completeErrorStr.toStdString()), {errorStr.toStdString()});
reply.setId(m_explosionIndex);
@@ -753,7 +753,7 @@ void JsonDispatcher::onRecivedTelegram(int wsId, const QJsonObject &telegram)
}
void JsonDispatcher::onTextMessageReceived(const QByteArray &message)
{
DEBUG_LOG() << "Text Message received: " << message;
DEBUG_LOG(m_logger) << "Text Message received: " << message;
m_recvFromWebsocket->handleTelegram(message);
}
@@ -765,7 +765,7 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
Core::FunctionReplyObject ret;
m_explosionIndex = request.explosionIndex();
m_cookieCalculateTrajectoryAdler = cookie;
DEBUG_LOG() << "Adler Plugin onSendCalculateTrajectoryAdlerRequest"
DEBUG_LOG(m_logger) << "Adler Plugin onSendCalculateTrajectoryAdlerRequest"
<< ", m_saaInterfaces.size=" << m_saaInterfaces.size();
int wsId = 0;
@@ -775,13 +775,13 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
if (wsId == 0)
{
DEBUG_LOG() << " No wsId found wsId=" << wsId << " return";
DEBUG_LOG(m_logger) << " No wsId found wsId=" << wsId << " return";
ret.setId(request.explosionIndex());
m_ftsTab->adlerCalculateTrajectoryReply(cookie, ret);
return;
}
DEBUG_LOG() << "Adler Plugin onSendCalculateTrajectoryAdlerRequest"
DEBUG_LOG(m_logger) << "Adler Plugin onSendCalculateTrajectoryAdlerRequest"
<< " connect to SAA and send data"
<< ", partyId :" << request.partyId() << ", wsId :" << wsId;
ExFlugbahnberechnung exFlugbahnberechnung;
@@ -790,7 +790,7 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
auto saa = getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ WS from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ WS from SAA but SAA with id " << wsId << " not found";
return;
}
exFlugbahnberechnung.receiver = saa->getSAAName();
@@ -806,27 +806,27 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
exFlugbahnberechnung.flugbahnberechnungDaten.zielkoordinate.hoehe = request.positionTarget().z();
exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem = ProjectDataManagement::L26_EffectingSystemType::inner_enum(request.weaponSystemType().underlying() + 1);
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 weaponSystemType " << request.weaponSystemType().underlying();
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 weaponSystemType " << request.weaponSystemType().underlying();
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 L26_EffectingSystemType " << exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem;
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 L26_EffectingSystemType " << exFlugbahnberechnung.flugbahnberechnungDaten.waffensystem;
exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.geschosssorte
= m_mainDispatcher->pdmHandler()->getDtc()->adlerChargeTypeName(request.trajectory().chargeTypeId());
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 chargeTypeId " << request.trajectory().chargeTypeId();
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 geschosssorte " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.geschosssorte;
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 chargeTypeId " << request.trajectory().chargeTypeId();
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 geschosssorte " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.geschosssorte;
exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuender = m_mainDispatcher->pdmHandler()->getDtc()->adlerIgniterTypeName(request.trajectory().igniterTypeId());
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 igniterTypeId " << request.trajectory().igniterTypeId();
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 zuender " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuender;
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 igniterTypeId " << request.trajectory().igniterTypeId();
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 zuender " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuender;
exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuenderFunktion
= m_mainDispatcher->pdmHandler()->getDtc()->adlerIgniterFunctionName(request.trajectory().igniterFunctionId());
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 igniterFunctionId " << request.trajectory().igniterFunctionId();
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 zuenderFunktion " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuenderFunktion;
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 igniterFunctionId " << request.trajectory().igniterFunctionId();
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 zuenderFunktion " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.zuenderFunktion;
if (request.trajectory().loadTypeId() > 0)
exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.ladung = m_mainDispatcher->pdmHandler()->getDtc()->adlerLoadTypeName(request.trajectory().loadTypeId());
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 ladung " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.ladung;
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 ladung " << exFlugbahnberechnung.flugbahnberechnungDaten.geschoss.ladung;
exFlugbahnberechnung.flugbahnberechnungDaten.sprenghoehe = static_cast<int>(request.explosionHeight());
exFlugbahnberechnung.flugbahnberechnungDaten.winkelgruppe = AdlerJson::Winkelgruppe(request.angleGroup().underlying());
@@ -835,12 +835,12 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
if (request.properties().empty())
ERROR_LOG() << "No properties available";
DEBUG_LOG() << ", request.aesItemId() :" << request.aesItemId();
ERROR_LOG(m_logger) << "No properties available";
DEBUG_LOG(m_logger) << ", request.aesItemId() :" << request.aesItemId();
DEBUG_LOG() << "UUID=" << exFlugbahnberechnung.uuid;
DEBUG_LOG(m_logger) << "UUID=" << exFlugbahnberechnung.uuid;
TrajectoryIdentifier trajectoryIdentifier;
trajectoryIdentifier.aesItemId = request.aesItemId();
@@ -851,7 +851,7 @@ void JsonDispatcher::onAdlerCalculateTrajectoryRequest(const rti::core::SampleId
QJsonObject telegram;
telegram = exFlugbahnberechnung.toJson();
DEBUG_LOG() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 " << QJsonDocument(telegram).toJson(QJsonDocument::JsonFormat::Compact);
DEBUG_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!77 " << QJsonDocument(telegram).toJson(QJsonDocument::JsonFormat::Compact);
m_sendToWebsocket->onGenericTelegram1(wsId, telegram);
}
@@ -859,7 +859,7 @@ void JsonDispatcher::cleanupSaaInterfaces(const QString &saaName, int wsId, int
{
DEBUG_LOG() << "cleanup saa partyId: " << partyId << " name: " << saaName << " wsId " << wsId;
DEBUG_LOG(m_logger) << "cleanup saa partyId: " << partyId << " name: " << saaName << " wsId " << wsId;
const auto copy = m_saaInterfaces;
for (const auto &saa : copy)
@@ -867,7 +867,7 @@ void JsonDispatcher::cleanupSaaInterfaces(const QString &saaName, int wsId, int
if ((partyId > 0 && saa.get()->getPartyId() == partyId) || (!saaName.isEmpty() && saa.get()->getSAAName() == saaName)
|| (wsId > 0 && saa.get()->getWsId() == wsId))
{
DEBUG_LOG() << "Cleanup SAA " << saa->getSAAName() << " for Party: " << saa->getPartyId();
DEBUG_LOG(m_logger) << "Cleanup SAA " << saa->getSAAName() << " for Party: " << saa->getPartyId();
m_saaInterfaces.removeOne(saa);
}
}
@@ -894,7 +894,7 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
const auto saa = getSAAByWs(wsId);
if (!saa)
{
WARNING_LOG() << "No valid SAA for wsId";
WARNING_LOG(m_logger) << "No valid SAA for wsId";
return;
}
@@ -919,7 +919,7 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
partyId,
OperatorRights::AdlerExplosionClusterEdit,
data.notification().notificationType().underlying());
DEBUG_LOG() << "getCreateNotificationRequestData recipientIds.size=" << recipientIds.size()
DEBUG_LOG(m_logger) << "getCreateNotificationRequestData recipientIds.size=" << recipientIds.size()
<< ", exerciseId=" << m_mainDispatcher->exerciseId();
std::vector<NotificationManagement::Address> recipientIdsDds;
recipientIdsDds.reserve(recipientIds.size());
@@ -933,7 +933,7 @@ void JsonDispatcher::getCreateNotificationRequestData(const int wsId,
addr.name(user.name());
addr.addressType(NotificationManagement::AddressType_def::Operator);
notif.recipientIds().push_back(addr);
DEBUG_LOG() << "recipientId=" << addr.name()
DEBUG_LOG(m_logger) << "recipientId=" << addr.name()
<< ", addr.addressId=" << addr.addressId();
}
@@ -952,44 +952,44 @@ void JsonDispatcher::createNotificationRequest(const int wsId,
const QString &content,
const QStringList &args)
{
DEBUG_LOG() << "createNotificationRequest"
DEBUG_LOG(m_logger) << "createNotificationRequest"
<< ", content=" << content;
NotificationManagement::CreateNotification req;
getCreateNotificationRequestData(wsId, title, req, content, args);
if (req.notification().content().empty())
{
INFO_LOG() << "req.notification().content().empty()";
INFO_LOG(m_logger) << "req.notification().content().empty()";
return;
}
req.notification().messageType(messageType);
req.notification().notificationType(notificationType);
INFO_LOG() << "trying to send CreateNotificationRequest";
INFO_LOG(m_logger) << "trying to send CreateNotificationRequest";
if (req.notification().recipientIds().size() == 0)
{
INFO_LOG() << "req.notification().recipientIds().size() == 0";
INFO_LOG(m_logger) << "req.notification().recipientIds().size() == 0";
return;
}
INFO_LOG() << "CreateNotificationRequest";
INFO_LOG(m_logger) << "CreateNotificationRequest";
if (!m_ftcNom->createNotificationRequest(req, this))
{
ERROR_LOG() << "Error requesting create data";
ERROR_LOG(m_logger) << "Error requesting create data";
}
}
void JsonDispatcher::onCreateNotificationReply(const Core::FunctionReplyObject &replyObject)
{
INFO_LOG() << "Got createReply with id " << replyObject.id() << " and errorString " << replyObject.translated();
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id() << " and errorString " << replyObject.translated();
if (replyObject.error())
{
ERROR_LOG() << "Error requesting CreateNotification";
ERROR_LOG(m_logger) << "Error requesting CreateNotification";
return;
}
else
{
DEBUG_LOG() << "Requesting create data ok. Got new id:" << replyObject.id() << " ... ok.";
DEBUG_LOG(m_logger) << "Requesting create data ok. Got new id:" << replyObject.id() << " ... ok.";
}
}