Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+83
-83
@@ -47,24 +47,24 @@ bool AesHandler::init(MainDispatcher *mainDispatcher)
|
||||
|
||||
if (!m_ftcAes->enableAirSupportImpactModify() || !m_dtcAes->enableExplosionSingle())
|
||||
{
|
||||
ERROR_LOG() << "Can not enableAirSupportImpactModify or enableExplosionSingle";
|
||||
ERROR_LOG(m_logger) << "Can not enableAirSupportImpactModify or enableExplosionSingle";
|
||||
|
||||
}
|
||||
|
||||
if (!m_dtcAes->enableExplosionCluster() || !m_ftcAes->enableExplosionClusterModify() || !m_ftcAes->enableExplosionClusterReleaseReceived()
|
||||
|| !m_ftcAes->enableExplosionClusterPauseResume() || !m_ftcAes->enableTrajectoryAdlerModify() || !m_ftcAes->enableEffectClusterFireHalt())
|
||||
{
|
||||
ERROR_LOG() << "Can not enableExplosionCluster or enableExplosionClusterModify";
|
||||
ERROR_LOG(m_logger) << "Can not enableExplosionCluster or enableExplosionClusterModify";
|
||||
|
||||
}
|
||||
if (!m_dtcAes->enableEffectCluster() || !m_ftcAes->enableEffectClusterModify() || !m_ftcAes->enableEffectClusterReleaseReceived()
|
||||
|| !m_ftcAes->enableEffectClusterPauseResume() || !m_ftcAes->enableEffectClusterRemove())
|
||||
{
|
||||
ERROR_LOG() << "Can not enableEffectnCluster or enableEffectClusterModify";
|
||||
ERROR_LOG(m_logger) << "Can not enableEffectnCluster or enableEffectClusterModify";
|
||||
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "------ Connect Explosion Single Changed ------- ";
|
||||
DEBUG_LOG(m_logger) << "------ Connect Explosion Single Changed ------- ";
|
||||
connect(m_dtcAes.get(), &AreaEffectSimulation::Interface::Dtc::explosionSingleChanged, this, &AesHandler::onExplosionSingleChanged);
|
||||
connect(m_dtcAes.get(), &AreaEffectSimulation::Interface::Dtc::effectClusterChanged, this, &AesHandler::onEffectClusterChanged);
|
||||
|
||||
@@ -73,24 +73,24 @@ bool AesHandler::init(MainDispatcher *mainDispatcher)
|
||||
|
||||
void AesHandler::onOffRouteMineModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG() << "onOffRouteMineModifyReply"
|
||||
DEBUG_LOG(m_logger) << "onOffRouteMineModifyReply"
|
||||
<< ", replyObject.id :" << replyObject.id() << ", str :" << replyObject.str() << ", tanslated :" << replyObject.translated();
|
||||
};
|
||||
|
||||
void AesHandler::onEffectClusterModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG() << "onEffectClusterModifyReply"
|
||||
DEBUG_LOG(m_logger) << "onEffectClusterModifyReply"
|
||||
<< ", replyObject.id :" << replyObject.id() << ", str :" << replyObject.str() << ", tanslated :" << replyObject.translated()
|
||||
<< ", additinal Info :" << replyObject.additionalInfo();
|
||||
m_requestHelper->requestReply(replyObject);
|
||||
|
||||
DEBUG_LOG() << "Got Reply";
|
||||
DEBUG_LOG(m_logger) << "Got Reply";
|
||||
|
||||
if (replyObject.error())
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "Got onEffectClusterModifyReply ERROR: " << replyObject.translated();
|
||||
DEBUG_LOG(m_logger) << "Got onEffectClusterModifyReply ERROR: " << replyObject.translated();
|
||||
ExTqTechnischeQuittung extq;
|
||||
extq.technischeDaten.beschreibung = replyObject.translated();
|
||||
extq.technischeDaten.status = Status_L32::DAT;
|
||||
@@ -100,11 +100,11 @@ void AesHandler::onEffectClusterModifyReply(const Core::FunctionReplyObject &rep
|
||||
}
|
||||
QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(replyObject.additionalInfo())).object();
|
||||
|
||||
ERROR_LOG() << "Try send notification0";
|
||||
ERROR_LOG(m_logger) << "Try send notification0";
|
||||
m_aesId = replyObject.id();
|
||||
ProjectDataManagement::EffectSource effectSource
|
||||
= static_cast<ProjectDataManagement::EffectSource::type>(propertiesObject.value(QStringLiteral("effectSource")).toInt());
|
||||
ERROR_LOG() << "Try send notification1 " << effectSource;
|
||||
ERROR_LOG(m_logger) << "Try send notification1 " << effectSource;
|
||||
|
||||
if (effectSource != ProjectDataManagement::EffectSource::ES_ADLER)
|
||||
return;
|
||||
@@ -181,14 +181,14 @@ void AesHandler::onEffectClusterModifyReply(const Core::FunctionReplyObject &rep
|
||||
m_mainDispatcher->ddsHandler()->ftcNom()->createNotificationRequest(req, this);
|
||||
}
|
||||
else
|
||||
WARNING_LOG() << "No recipent found for exercise";
|
||||
WARNING_LOG(m_logger) << "No recipent found for exercise";
|
||||
|
||||
}
|
||||
|
||||
void AesHandler::onCreateNotificationReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
ERROR_LOG() << "Got onCreateNotificationReply ERROR: " << replyObject.translated();
|
||||
ERROR_LOG(m_logger) << "Got onCreateNotificationReply ERROR: " << replyObject.translated();
|
||||
}
|
||||
|
||||
bool AesHandler::sendAesModifyRequest(const QJsonObject &data)
|
||||
@@ -247,7 +247,7 @@ void AesHandler::handleCreateSingleExplosion(const TrainingAreaBase::TetraIcd::C
|
||||
{
|
||||
auto strFromObj = QJsonDocument(data.toJson()).toJson(QJsonDocument::Compact);
|
||||
m_singleExplosions.insert(data.aesDdsId, AreaEffectSimulation::AesEffectState_def::EsCreated);
|
||||
DEBUG_LOG() << "TEST SINGLE EXPLOSION CREATED " << strFromObj;
|
||||
DEBUG_LOG(m_logger) << "TEST SINGLE EXPLOSION CREATED " << strFromObj;
|
||||
}
|
||||
|
||||
void AesHandler::handleEXFire(const Feuerkampfdaten &data, int wsId)
|
||||
@@ -280,7 +280,7 @@ void AesHandler::handleEXDontFire(const Feuerkampfdaten &data, int wsId)
|
||||
|
||||
const auto saa = m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId);
|
||||
|
||||
DEBUG_LOG() << "[EX-FQ(nFN)] data from SSA " << wsId << " : "
|
||||
DEBUG_LOG(m_logger) << "[EX-FQ(nFN)] data from SSA " << wsId << " : "
|
||||
<< "verein: " << data.verein << " "
|
||||
<< "kenner: " << data.kenner.underlying() << " "
|
||||
<< "feuerkampfReferenz: " << data.feuerkampfReferenz;
|
||||
@@ -295,18 +295,18 @@ void AesHandler::handleEXDontFire(const Feuerkampfdaten &data, int wsId)
|
||||
|
||||
void AesHandler::onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "onTrajectoryAdlerModifyReply"
|
||||
DEBUG_LOG(m_logger) << "onTrajectoryAdlerModifyReply"
|
||||
<< ", aesId :" << reply.id() << ", str :" << reply.str() << ", m_wirkmittelIndex :" << m_wirkmittelIndex
|
||||
<< ", m_data.feuerkommando.wirkmittel.size() :" << m_wirkfeldPlanungsData.feuerkommando.wirkmittel.size();
|
||||
if (reply.error())
|
||||
ERROR_LOG() << reply.translated();
|
||||
ERROR_LOG(m_logger) << reply.translated();
|
||||
if (m_wirkmittelIndex == m_wirkfeldPlanungsData.feuerkommando.wirkmittel.size() - 1)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "TAB->SAA EX-MQ"
|
||||
DEBUG_LOG(m_logger) << "TAB->SAA EX-MQ"
|
||||
<< ", feuerkampfReferenz :" << m_wirkfeldPlanungsData.feuerkampfReferenz;
|
||||
|
||||
DEBUG_LOG() << "onTrajectoryAdlerModifyReply " << reply.id();
|
||||
DEBUG_LOG(m_logger) << "onTrajectoryAdlerModifyReply " << reply.id();
|
||||
ExFeuerbereit exFB;
|
||||
|
||||
exFB.feuerkampfdaten.feuerkampfReferenz = m_wirkfeldPlanungsData.feuerkampfReferenz;
|
||||
@@ -318,7 +318,7 @@ void AesHandler::onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &r
|
||||
if (m_wirkmittelIndex < m_wirkfeldPlanungsData.feuerkommando.wirkmittel.size() - 1)
|
||||
{
|
||||
m_wirkmittelIndex++;
|
||||
DEBUG_LOG() << "sendTrajectoryAdlerModifyRequest"
|
||||
DEBUG_LOG(m_logger) << "sendTrajectoryAdlerModifyRequest"
|
||||
<< ", m_participantId :" << m_participantId << ", m_wirkmittelIndex :" << m_wirkmittelIndex << ", m_aesId :" << m_aesId;
|
||||
sendTrajectoryAdlerModifyRequest(m_wirkfeldPlanungsData, m_participantId, m_wirkmittelIndex, m_aesId);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ void AesHandler::onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &r
|
||||
void AesHandler::sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &data, int participantId, int wirkmittelIndex, int aesId)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "sendTrajectoryAdlerModifyRequest"
|
||||
DEBUG_LOG(m_logger) << "sendTrajectoryAdlerModifyRequest"
|
||||
<< ", participantId :" << participantId << ", wirkmittelIndex :" << wirkmittelIndex << ", aesId:" << aesId;
|
||||
std::vector<Core::RelativePositionRelativeTime> geometryRef;
|
||||
geometryRef.clear();
|
||||
@@ -338,7 +338,7 @@ void AesHandler::sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &dat
|
||||
|
||||
for (int subordinate : std::as_const(subordinates))
|
||||
{
|
||||
DEBUG_LOG() << "subordinates(" << participantId << ") :" << subordinate;
|
||||
DEBUG_LOG(m_logger) << "subordinates(" << participantId << ") :" << subordinate;
|
||||
subordinatePositions.append(m_dtcPpm->participantPosition(subordinate));
|
||||
}
|
||||
|
||||
@@ -385,10 +385,10 @@ void AesHandler::sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &dat
|
||||
matrix.rotate(-grad);
|
||||
|
||||
QPointF point(pntGeo.x(), pntGeo.y());
|
||||
DEBUG_LOG() << " POS bevore rot: " << point;
|
||||
DEBUG_LOG(m_logger) << " POS bevore rot: " << point;
|
||||
|
||||
auto rotatePoint = matrix.map(point);
|
||||
DEBUG_LOG() << " POS after rot: " << rotatePoint;
|
||||
DEBUG_LOG(m_logger) << " POS after rot: " << rotatePoint;
|
||||
|
||||
pntGeo.setX(rotatePoint.x());
|
||||
pntGeo.setY(rotatePoint.y());
|
||||
@@ -410,11 +410,11 @@ void AesHandler::sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &dat
|
||||
impactPosition.z(data.zieldaten.koordinate.hoehe);
|
||||
newRequest->impactPosition(impactPosition);
|
||||
newRequest->geometry(geometryRef);
|
||||
DEBUG_LOG() << "geometryRef.size=" << geometryRef.size() << ", newRequest->geometry().size() :" << newRequest->geometry().size();
|
||||
DEBUG_LOG(m_logger) << "geometryRef.size=" << geometryRef.size() << ", newRequest->geometry().size() :" << newRequest->geometry().size();
|
||||
|
||||
if (newRequest->aesItemId() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "newRequest->aesItemId() <=0"
|
||||
ERROR_LOG(m_logger) << "newRequest->aesItemId() <=0"
|
||||
<< ", aesItemId :" << newRequest->aesItemId();
|
||||
return;
|
||||
}
|
||||
@@ -428,12 +428,12 @@ void AesHandler::sendTrajectoryAdlerModifyRequest(const WirkfeldplanungData &dat
|
||||
|
||||
void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
{
|
||||
DEBUG_LOG() << "AesHandler::handleEffectCluster (Empfang WirkfeldplanungData)"
|
||||
DEBUG_LOG(m_logger) << "AesHandler::handleEffectCluster (Empfang WirkfeldplanungData)"
|
||||
<< ", feuerkampfReferenz :" << data.feuerkampfReferenz << ", wirkmittel.size() :" << data.feuerkommando.wirkmittel.size();
|
||||
|
||||
if (!m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId))
|
||||
{
|
||||
ERROR_LOG() << "!m_mainDispatcher->jsonDispatcher()->getSAAByWs(" << wsId << ") return";
|
||||
ERROR_LOG(m_logger) << "!m_mainDispatcher->jsonDispatcher()->getSAAByWs(" << wsId << ") return";
|
||||
return;
|
||||
}
|
||||
const QString &verein = data.feuerkommando.verein;
|
||||
@@ -448,7 +448,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
if (part.id() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "Got EffectClusterData for " << verein << " but unit not found";
|
||||
ERROR_LOG(m_logger) << "Got EffectClusterData for " << verein << " but unit not found";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
AreaEffectSimulation::AesExplosionGeometry geometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
AreaEffectSimulation::Area area;
|
||||
const bool createArea = data.zieldaten.breiteRadius == 0 && data.zieldaten.tiefe == 0;
|
||||
ERROR_LOG() << "create AREA??? " << createArea << " breite " << data.zieldaten.breiteRadius << " tiefe " << data.zieldaten.tiefe;
|
||||
ERROR_LOG(m_logger) << "create AREA??? " << createArea << " breite " << data.zieldaten.breiteRadius << " tiefe " << data.zieldaten.tiefe;
|
||||
|
||||
if (!createArea && data.zieldaten.geometrie == ProjectDataManagement::L4_TargetGeometry::Point)
|
||||
{
|
||||
@@ -485,7 +485,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
const int igniterFunctionId = m_mainDispatcher->pdmHandler()->getDtc()->getIgniterFunctionIdFromAdlerIgniterFunction(chargeData.zuenderFunktion);
|
||||
const int impactRadius = m_mainDispatcher->pdmHandler()->getDtc()->impactRadius(chargeTypeId, igniterTypeId, igniterFunctionId);
|
||||
|
||||
DEBUG_LOG() << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
DEBUG_LOG(m_logger) << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
area.height(impactRadius * 2);
|
||||
area.width(impactRadius * 2);
|
||||
}
|
||||
@@ -515,28 +515,28 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
const QPointF bl = QTransform().rotate(-area.rotation()).map(rect.topLeft());
|
||||
const LtsCoordTrans::UtmCoordinate centerUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(centerPoint);
|
||||
DEBUG_LOG() << "centerUtm="
|
||||
DEBUG_LOG(m_logger) << "centerUtm="
|
||||
<< ", x :" << centerUtm.x << ", y :" << centerUtm.y << ", zone :" << centerUtm.zone;
|
||||
const QPointF &bottomLeft = centerUtm.geographic(bl);
|
||||
DEBUG_LOG() << "bl="
|
||||
DEBUG_LOG(m_logger) << "bl="
|
||||
<< ", x :" << bl.x() << ", y :" << bl.y();
|
||||
DEBUG_LOG() << "bottomLeft="
|
||||
DEBUG_LOG(m_logger) << "bottomLeft="
|
||||
<< ", x :" << bottomLeft.x() << ", y :" << bottomLeft.y();
|
||||
area.cornerBottomLeft(Core::GeoPosition2D(bottomLeft.x(), bottomLeft.y()));
|
||||
DEBUG_LOG() << "area.cornerBottomLeft="
|
||||
DEBUG_LOG(m_logger) << "area.cornerBottomLeft="
|
||||
<< ", lon :" << area.cornerBottomLeft().lon() << ", lat :" << area.cornerBottomLeft().lat();
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate cornerBottomLeftUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(area.cornerBottomLeft().lon(), area.cornerBottomLeft().lat());
|
||||
DEBUG_LOG() << "cornerBottomLeftUtm="
|
||||
DEBUG_LOG(m_logger) << "cornerBottomLeftUtm="
|
||||
<< ", x :" << cornerBottomLeftUtm.x << ", y :" << cornerBottomLeftUtm.y << ", zone :" << cornerBottomLeftUtm.zone;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << " Need to generate area";
|
||||
DEBUG_LOG(m_logger) << " Need to generate area";
|
||||
if (data.feuerkommando.wirkmittel.size() == 1)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << " Need to generate area SINGLE";
|
||||
DEBUG_LOG(m_logger) << " Need to generate area SINGLE";
|
||||
geometry = AreaEffectSimulation::AesExplosionGeometry::EgPoint;
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
const int igniterFunctionId = m_mainDispatcher->pdmHandler()->getDtc()->getIgniterFunctionIdFromAdlerIgniterFunction(chargeData.zuenderFunktion);
|
||||
const int impactRadius = m_mainDispatcher->pdmHandler()->getDtc()->impactRadius(chargeTypeId, igniterTypeId, igniterFunctionId);
|
||||
|
||||
DEBUG_LOG() << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
DEBUG_LOG(m_logger) << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
area.height(impactRadius * 2);
|
||||
area.width(impactRadius * 2);
|
||||
|
||||
@@ -561,25 +561,25 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
const QPointF bl = QTransform().rotate(-area.rotation()).map(rect.topLeft());
|
||||
const LtsCoordTrans::UtmCoordinate centerUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(centerPoint);
|
||||
DEBUG_LOG() << "centerUtm="
|
||||
DEBUG_LOG(m_logger) << "centerUtm="
|
||||
<< ", x :" << centerUtm.x << ", y :" << centerUtm.y << ", zone :" << centerUtm.zone;
|
||||
const QPointF bottomLeft = centerUtm.geographic(bl);
|
||||
DEBUG_LOG() << "bl="
|
||||
DEBUG_LOG(m_logger) << "bl="
|
||||
<< ", x :" << bl.x() << ", y :" << bl.y();
|
||||
DEBUG_LOG() << "bottomLeft="
|
||||
DEBUG_LOG(m_logger) << "bottomLeft="
|
||||
<< ", x :" << bottomLeft.x() << ", y :" << bottomLeft.y();
|
||||
area.cornerBottomLeft(Core::GeoPosition2D(bottomLeft.x(), bottomLeft.y()));
|
||||
DEBUG_LOG() << "area.cornerBottomLeft="
|
||||
DEBUG_LOG(m_logger) << "area.cornerBottomLeft="
|
||||
<< ", lon :" << area.cornerBottomLeft().lon() << ", lat :" << area.cornerBottomLeft().lat();
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate cornerBottomLeftUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(area.cornerBottomLeft().lon(), area.cornerBottomLeft().lat());
|
||||
ERROR_LOG() << "cornerBottomLeftUtm="
|
||||
ERROR_LOG(m_logger) << "cornerBottomLeftUtm="
|
||||
<< ", x :" << cornerBottomLeftUtm.x << ", y :" << cornerBottomLeftUtm.y << ", zone :" << cornerBottomLeftUtm.zone;
|
||||
}
|
||||
else if (data.feuerkommando.wirkmittel.size() > 1)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << " Need to generate area AREA";
|
||||
DEBUG_LOG(m_logger) << " Need to generate area AREA";
|
||||
|
||||
geometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
|
||||
@@ -590,7 +590,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
const int igniterFunctionId = m_mainDispatcher->pdmHandler()->getDtc()->getIgniterFunctionIdFromAdlerIgniterFunction(chargeData.zuenderFunktion);
|
||||
const int impactRadius = m_mainDispatcher->pdmHandler()->getDtc()->impactRadius(chargeTypeId, igniterTypeId, igniterFunctionId);
|
||||
|
||||
DEBUG_LOG() << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
DEBUG_LOG(m_logger) << "Impact Radius for " << chargeTypeId << " " << igniterTypeId << " " << igniterTypeId << " is " << impactRadius;
|
||||
|
||||
|
||||
QList<AreaEffectSimulation::Area> areas;
|
||||
@@ -628,11 +628,11 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
|
||||
area = createMinimumRect(zone, vecPoints);
|
||||
DEBUG_LOG() << "FINAL AREA " << area.cornerBottomLeft() << " " << area.height() << " " << area.width();
|
||||
DEBUG_LOG(m_logger) << "FINAL AREA " << area.cornerBottomLeft() << " " << area.height() << " " << area.width();
|
||||
}
|
||||
else if (data.feuerkommando.wirkmittelRakete.size() > 0)
|
||||
{
|
||||
DEBUG_LOG() << " Need to generate area AREA";
|
||||
DEBUG_LOG(m_logger) << " Need to generate area AREA";
|
||||
|
||||
geometry = AreaEffectSimulation::AesExplosionGeometry::EgArea;
|
||||
|
||||
@@ -677,7 +677,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
|
||||
area = createMinimumRect(zone, vecPoints);
|
||||
DEBUG_LOG() << "FINAL AREA " << area.cornerBottomLeft() << " " << area.height() << " " << area.width();
|
||||
DEBUG_LOG(m_logger) << "FINAL AREA " << area.cornerBottomLeft() << " " << area.height() << " " << area.width();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,9 +725,9 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
effectorData.chargeStruct().igniterTypeId() = m_mainDispatcher->pdmHandler()->getDtc()->getIgniterTypeIdFromAdlerIgniter(effectorAdler.geschoss.zuender);
|
||||
effectorData.chargeStruct().igniterFunctionId()
|
||||
= m_mainDispatcher->pdmHandler()->getDtc()->getIgniterFunctionIdFromAdlerIgniterFunction(effectorAdler.geschoss.zuenderFunktion);
|
||||
DEBUG_LOG() << "FOUND chargeTypeId " << effectorData.chargeStruct().chargeTypeId() << " for " << effectorAdler.geschoss.geschosssorte;
|
||||
DEBUG_LOG() << "igniterTypeId: " << effectorData.chargeStruct().igniterTypeId();
|
||||
DEBUG_LOG() << "igniterFunctionId: " << effectorData.chargeStruct().igniterFunctionId();
|
||||
DEBUG_LOG(m_logger) << "FOUND chargeTypeId " << effectorData.chargeStruct().chargeTypeId() << " for " << effectorAdler.geschoss.geschosssorte;
|
||||
DEBUG_LOG(m_logger) << "igniterTypeId: " << effectorData.chargeStruct().igniterTypeId();
|
||||
DEBUG_LOG(m_logger) << "igniterFunctionId: " << effectorData.chargeStruct().igniterFunctionId();
|
||||
effectorData.participantId()
|
||||
= m_dtcPpm->getParticipantByInternalName(part.partyId(), QString::fromStdString(part.name()), waffensystemkennerMap.key(effectorAdler.kenner)).id();
|
||||
std::vector<Core::RelativePositionRelativeTime> flightCurve;
|
||||
@@ -735,20 +735,20 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
|
||||
const auto &startPos = m_dtcPpm->participantPosition(effectorData.participantId());
|
||||
const auto coordStart = LtsCoordTrans::UtmCoordinate::fromGeographic(startPos.pos().lon(), startPos.pos().lat());
|
||||
DEBUG_LOG() << "Start point: " << coordStart;
|
||||
DEBUG_LOG(m_logger) << "Start point: " << coordStart;
|
||||
|
||||
const auto coordEnd = LtsCoordTrans::UtmCoordinate::fromGeographic(effectorAdler.auftreffpunkt.koordinate.longitude * (M_PI / 180.0),
|
||||
effectorAdler.auftreffpunkt.koordinate.latitude * (M_PI / 180.0));
|
||||
DEBUG_LOG() << "End point: " << coordEnd;
|
||||
DEBUG_LOG(m_logger) << "End point: " << coordEnd;
|
||||
LtsCoordTrans::UtmCoordinate coordDiff = coordEnd;
|
||||
|
||||
coordDiff.x = coordDiff.x - coordStart.x;
|
||||
coordDiff.y = coordDiff.y - coordStart.y;
|
||||
DEBUG_LOG() << "Last point: " << coordDiff.x << " " << coordDiff.y;
|
||||
DEBUG_LOG() << "Last point ATAN: " << std::atan2(coordDiff.y, coordDiff.x);
|
||||
DEBUG_LOG(m_logger) << "Last point: " << coordDiff.x << " " << coordDiff.y;
|
||||
DEBUG_LOG(m_logger) << "Last point ATAN: " << std::atan2(coordDiff.y, coordDiff.x);
|
||||
|
||||
const double useNewGrad = -90 + std::atan2(coordDiff.y, coordDiff.x) * (180.0 / M_PI);
|
||||
DEBUG_LOG() << "Atan2 Deg to: last point " << std::atan2(coordDiff.y, coordDiff.x) * (180.0 / M_PI);
|
||||
DEBUG_LOG(m_logger) << "Atan2 Deg to: last point " << std::atan2(coordDiff.y, coordDiff.x) * (180.0 / M_PI);
|
||||
|
||||
for (const auto &flightPointAdler : std::as_const(effectorAdler.flugbahnpunkt))
|
||||
{
|
||||
@@ -761,10 +761,10 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
QTransform matrix;
|
||||
matrix.rotate(useNewGrad);
|
||||
const QPointF point(flightPoint.offsetX(), flightPoint.offsetY());
|
||||
TRACE_LOG() << " POS bevore rot: " << point;
|
||||
TRACE_LOG(m_logger) << " POS bevore rot: " << point;
|
||||
|
||||
const auto rotatePoint = matrix.map(point);
|
||||
TRACE_LOG() << " POS after rot: " << rotatePoint;
|
||||
TRACE_LOG(m_logger) << " POS after rot: " << rotatePoint;
|
||||
|
||||
flightPoint.offsetX() = rotatePoint.x();
|
||||
flightPoint.offsetY() = rotatePoint.y();
|
||||
@@ -785,8 +785,8 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
effectorData.mhpScatterLengthDetonationHeight() = effectorAdler.streuung.laengsstreuungH;
|
||||
effectorData.mhpScatterWidth() = effectorAdler.streuung.seitenstreuung;
|
||||
effectorData.mhpScatterWidthDetonationHeight() = effectorAdler.streuung.seitenstreuungH;
|
||||
DEBUG_LOG() << effectorAdler.kenner;
|
||||
DEBUG_LOG() << "Looking for participantID with stats = party: " << part.partyId() << " unitname: " << part.name()
|
||||
DEBUG_LOG(m_logger) << effectorAdler.kenner;
|
||||
DEBUG_LOG(m_logger) << "Looking for participantID with stats = party: " << part.partyId() << " unitname: " << part.name()
|
||||
<< " effectorname: " << waffensystemkennerMap.key(effectorAdler.kenner);
|
||||
effectorData.peakHeight() = effectorAdler.gipfelhoehe;
|
||||
effectorVec.push_back(effectorData);
|
||||
@@ -809,14 +809,14 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
effectorData.chargeStruct().igniterFunctionId()
|
||||
= m_mainDispatcher->pdmHandler()->getDtc()->getIgniterFunctionIdFromAdlerIgniterFunction(effectorAdler.geschoss.zuenderFunktion);
|
||||
|
||||
DEBUG_LOG() << "FOUND chargeTypeId " << effectorData.chargeStruct().chargeTypeId() << " for " << effectorAdler.geschoss.geschosssorte;
|
||||
DEBUG_LOG() << "igniterTypeId: " << effectorData.chargeStruct().igniterTypeId();
|
||||
DEBUG_LOG() << "igniterFunctionId: " << effectorData.chargeStruct().igniterFunctionId();
|
||||
DEBUG_LOG(m_logger) << "FOUND chargeTypeId " << effectorData.chargeStruct().chargeTypeId() << " for " << effectorAdler.geschoss.geschosssorte;
|
||||
DEBUG_LOG(m_logger) << "igniterTypeId: " << effectorData.chargeStruct().igniterTypeId();
|
||||
DEBUG_LOG(m_logger) << "igniterFunctionId: " << effectorData.chargeStruct().igniterFunctionId();
|
||||
|
||||
effectorData.participantId()
|
||||
= m_dtcPpm->getParticipantByInternalName(part.partyId(), QString::fromStdString(part.name()), waffensystemkennerMap.key(effectorAdler.kenner)).id();
|
||||
if (effectorData.participantId() == 0)
|
||||
WARNING_LOG() << "Could not find participant for partiyId " << part.partyId() << ", name " << part.name() << ", kenner " << effectorAdler.kenner;
|
||||
WARNING_LOG(m_logger) << "Could not find participant for partiyId " << part.partyId() << ", name " << part.name() << ", kenner " << effectorAdler.kenner;
|
||||
effectorData.chargeStruct().igniterTypeId() = m_mainDispatcher->pdmHandler()->getDtc()->getIgniterTypeIdFromAdlerIgniter(effectorAdler.geschoss.zuender);
|
||||
effectorData.interval() = effectorAdler.geschoss.intervall;
|
||||
|
||||
@@ -852,7 +852,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
AreaEffectSimulation::TrajectoryGeoPosition trajectoryWithoutTime;
|
||||
|
||||
if (!AreaEffectSimulation::TrajectoryGenerator::getInstance()->generateTrajectoryBiedziak(trajectoryStart, trajectoryEnd, 45.0, trajectoryWithoutTime))
|
||||
ERROR_LOG() << "Could not create trajectory for Feuerkommando " << data.feuerkommando.verein;
|
||||
ERROR_LOG(m_logger) << "Could not create trajectory for Feuerkommando " << data.feuerkommando.verein;
|
||||
|
||||
|
||||
|
||||
@@ -897,12 +897,12 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
req.tla(data.zieldaten.zog);
|
||||
|
||||
if (data.feuerkommando.wirkmittel.empty())
|
||||
DEBUG_LOG() << "flugzeit :"
|
||||
DEBUG_LOG(m_logger) << "flugzeit :"
|
||||
<< " -";
|
||||
else
|
||||
DEBUG_LOG() << "flugzeit :" << data.feuerkommando.wirkmittel.at(0).flugzeit;
|
||||
DEBUG_LOG(m_logger) << "flugzeit :" << data.feuerkommando.wirkmittel.at(0).flugzeit;
|
||||
|
||||
DEBUG_LOG() << "SEND " << data.feuerkampfReferenz << " ";
|
||||
DEBUG_LOG(m_logger) << "SEND " << data.feuerkampfReferenz << " ";
|
||||
int ammoCounter = 0;
|
||||
std::vector<ProjectDataManagement::L27_EffectorId> refWirkmittel;
|
||||
refWirkmittel.reserve(data.feuerkommando.wirkmittel.size());
|
||||
@@ -910,7 +910,7 @@ void AesHandler::handleEffectCluster(const WirkfeldplanungData &data, int wsId)
|
||||
for (const auto &wm : std::as_const(data.feuerkommando.wirkmittel))
|
||||
{
|
||||
ammoCounter += wm.geschoss.anzahl;
|
||||
DEBUG_LOG() << "INSERT KENNER INTO MAP: " << data.feuerkampfReferenz << "---------" << wm.kenner;
|
||||
DEBUG_LOG(m_logger) << "INSERT KENNER INTO MAP: " << data.feuerkampfReferenz << "---------" << wm.kenner;
|
||||
refWirkmittel.push_back(wm.kenner);
|
||||
}
|
||||
|
||||
@@ -966,7 +966,7 @@ void AesHandler::handleAmmoCount(const Feuerkampfdaten &data, int saaPartyId, bo
|
||||
bool outOfAmmo = false;
|
||||
const int newAmmoAmount = std::max(0, refAmmoCounter - 1);
|
||||
|
||||
DEBUG_LOG() << "Handle ammo count - ID: " << aes.id() << " | Ref: " << refTrimmed << " | PartyID: " << saaPartyId << " | oldAmmoCount: " << refAmmoCounter
|
||||
DEBUG_LOG(m_logger) << "Handle ammo count - ID: " << aes.id() << " | Ref: " << refTrimmed << " | PartyID: " << saaPartyId << " | oldAmmoCount: " << refAmmoCounter
|
||||
<< " | newAmmoCount: " << newAmmoAmount;
|
||||
|
||||
if (newAmmoAmount <= 0)
|
||||
@@ -991,7 +991,7 @@ void AesHandler::handleAmmoCount(const Feuerkampfdaten &data, int saaPartyId, bo
|
||||
exvm.feuerkampfdaten.kenner = kenner;
|
||||
exvm.feuerkampfdaten.verein = data.verein;
|
||||
|
||||
DEBUG_LOG() << "------------ SENDE ExVollzugsmeldung für ------------ " << kenner;
|
||||
DEBUG_LOG(m_logger) << "------------ SENDE ExVollzugsmeldung für ------------ " << kenner;
|
||||
|
||||
m_mainDispatcher->jsonDispatcher()->sendExVollzugsmeldung(exvm, saaPartyId);
|
||||
}
|
||||
@@ -1014,15 +1014,15 @@ void AesHandler::removeAllPendingEffectCluster(int partyId)
|
||||
if (effectClusterIds.isEmpty())
|
||||
return;
|
||||
|
||||
INFO_LOG() << "Pending effect cluster size: " << effectClusterIds.size();
|
||||
INFO_LOG(m_logger) << "Pending effect cluster size: " << effectClusterIds.size();
|
||||
Core::RemoveElementRequest req;
|
||||
for (const qint32 id : std::as_const(effectClusterIds))
|
||||
{
|
||||
req.id(id);
|
||||
INFO_LOG() << "Remove effect cluster id: " << id;
|
||||
INFO_LOG(m_logger) << "Remove effect cluster id: " << id;
|
||||
|
||||
qint32 ret = m_ftcAes->effectClusterRemoveRequest(req);
|
||||
INFO_LOG() << "m_ftsAes->effectClusterRemoveRequest(req) --> " << ret;
|
||||
INFO_LOG(m_logger) << "m_ftsAes->effectClusterRemoveRequest(req) --> " << ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,13 +1046,13 @@ void AesHandler::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionS
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "----------------- remove area ------------- ";
|
||||
DEBUG_LOG(m_logger) << "----------------- remove area ------------- ";
|
||||
m_singleExplosions.remove(data.id());
|
||||
return;
|
||||
}
|
||||
if (modType == DataModification::eAdded)
|
||||
{
|
||||
DEBUG_LOG() << "----------------- add area ------------- " << data.effectStateId();
|
||||
DEBUG_LOG(m_logger) << "----------------- add area ------------- " << data.effectStateId();
|
||||
m_singleExplosions.insert(data.id(), data.effectStateId());
|
||||
return;
|
||||
}
|
||||
@@ -1060,7 +1060,7 @@ void AesHandler::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionS
|
||||
&& m_singleExplosions.value(data.id(), AreaEffectSimulation::AesEffectState::EsActivated) != AreaEffectSimulation::AesEffectState_def::EsActivated)
|
||||
{
|
||||
const auto state = data.effectStateId();
|
||||
DEBUG_LOG() << "----------------- switch state ------------- " << state;
|
||||
DEBUG_LOG(m_logger) << "----------------- switch state ------------- " << state;
|
||||
m_singleExplosions.insert(data.id(), state);
|
||||
QJsonObject telegram;
|
||||
telegram[QStringLiteral("typeId")] = 80082;
|
||||
@@ -1089,12 +1089,12 @@ void AesHandler::onExplosionSingleChanged(const AreaEffectSimulation::ExplosionS
|
||||
|
||||
void AesHandler::onEffectClusterChanged(const AreaEffectSimulation::EffectCluster &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "Try auto handle effectCluster: " << data.name();
|
||||
DEBUG_LOG(m_logger) << "Try auto handle effectCluster: " << data.name();
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Try auto handle effectCluster: probs: " << data.properties();
|
||||
DEBUG_LOG(m_logger) << "Try auto handle effectCluster: probs: " << data.properties();
|
||||
|
||||
if (data.properties().empty())
|
||||
return;
|
||||
@@ -1102,20 +1102,20 @@ void AesHandler::onEffectClusterChanged(const AreaEffectSimulation::EffectCluste
|
||||
if (!data.partyId().is_set())
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "has PARTY " << data.properties();
|
||||
DEBUG_LOG(m_logger) << "has PARTY " << data.properties();
|
||||
|
||||
if (!data.participantId().is_set())
|
||||
return;
|
||||
|
||||
if (data.effectSourceId() != ProjectDataManagement::EffectSource::ES_ADLER)
|
||||
return;
|
||||
DEBUG_LOG() << "has PARTICIPANTID " << data.properties();
|
||||
DEBUG_LOG(m_logger) << "has PARTICIPANTID " << data.properties();
|
||||
|
||||
QJsonObject propertiesObject = QJsonDocument::fromJson(QByteArray::fromStdString(data.properties())).object();
|
||||
if (!propertiesObject.value(QStringLiteral("useReceived")).toBool())
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "has USE RECEIVED " << data.effectStateId().underlying();
|
||||
DEBUG_LOG(m_logger) << "has USE RECEIVED " << data.effectStateId().underlying();
|
||||
|
||||
switch (data.effectStateId().underlying())
|
||||
{
|
||||
@@ -1136,7 +1136,7 @@ void AesHandler::onEffectClusterChanged(const AreaEffectSimulation::EffectCluste
|
||||
|
||||
|
||||
m_aesIdToFeuerkampfReferenz.remove(data.id());
|
||||
DEBUG_LOG() << "SEND MQ for " << data.name() << " " << reference;
|
||||
DEBUG_LOG(m_logger) << "SEND MQ for " << data.name() << " " << reference;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -60,16 +60,19 @@ class AesHandler
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> getFtc() { return m_ftcAes; };
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
AreaEffectSimulation::Area createMinimumRect(int zone, const QVector<QPointF> &points);
|
||||
|
||||
signals:
|
||||
void explosionSingleChanged(const QJsonObject &jsonObj);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QList<qint32> findAllPendingEffectCluster(int partyId);
|
||||
void handleAmmoCount(const Feuerkampfdaten &data, int saaPartyId, bool sendExVollzug = false);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
MainDispatcher *m_mainDispatcher;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ bool AsmHandler::init(MainDispatcher* mainDispatcher)
|
||||
m_dtcAsm = AssetManagement::Interface::Dtc::create(mainDispatcher->ddsHandler()->ddsConnector());
|
||||
if (!m_dtcAsm->enableAsset())
|
||||
{
|
||||
ERROR_LOG()<<" Can't read data from ASM";
|
||||
ERROR_LOG(m_logger)<<" Can't read data from ASM";
|
||||
return false;
|
||||
}
|
||||
m_exerciseId = mainDispatcher->exerciseId();
|
||||
@@ -37,7 +37,7 @@ bool AsmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
void AsmHandler::modifyAssetAdlerProperties(int assetId, bool isSaaConnected)
|
||||
{
|
||||
WARNING_LOG()<<">> modify asset properties: set exerciseId: "<<m_exerciseId<<" assetName: "<<assetId;
|
||||
WARNING_LOG(m_logger)<<">> modify asset properties: set exerciseId: "<<m_exerciseId<<" assetName: "<<assetId;
|
||||
|
||||
AssetManagement::Asset asset = m_dtcAsm->asset(assetId);
|
||||
if (asset.id() <= 0)
|
||||
@@ -51,7 +51,7 @@ void AsmHandler::modifyAssetAdlerProperties(int assetId, bool isSaaConnected)
|
||||
|
||||
void AsmHandler::onAssetModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "Got Function Reply error ? "<<reply.error();
|
||||
DEBUG_LOG(m_logger) << "Got Function Reply error ? "<<reply.error();
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -34,9 +34,11 @@ public:
|
||||
std::shared_ptr<AssetManagement::Interface::Ftc> getFtc() { return m_ftcAsm; }
|
||||
void modifyAssetAdlerProperties(int assetId, bool isSaaConnected = false);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onAssetModifyReply(const Core::FunctionReplyObject &reply) override;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<AssetManagement::Interface::Dtc> m_dtcAsm;
|
||||
std::shared_ptr<AssetManagement::Interface::Ftc> m_ftcAsm;
|
||||
int m_exerciseId;
|
||||
|
||||
+18
-18
@@ -48,7 +48,7 @@ bool FlmHandler::init(MainDispatcher *mainDispatcher)
|
||||
|
||||
bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungsnummer, const QJsonObject &obj)
|
||||
{
|
||||
ERROR_LOG() << "exerciseId: " << m_exerciseId << ", partyId: " << partyId
|
||||
ERROR_LOG(m_logger) << "exerciseId: " << m_exerciseId << ", partyId: " << partyId
|
||||
<< ", name: " << name
|
||||
<< ", meldungsnummer: " << meldungsnummer;
|
||||
|
||||
@@ -58,11 +58,11 @@ bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungs
|
||||
const QString folderName = QStringLiteral("Messages");
|
||||
int folderHXMessagesId = m_dtcFlm->findFolder(partyFolderId, folderName);
|
||||
|
||||
ERROR_LOG() << "folderHXMessagesId: " << folderHXMessagesId;
|
||||
ERROR_LOG(m_logger) << "folderHXMessagesId: " << folderHXMessagesId;
|
||||
|
||||
if (folderHXMessagesId <= 0)
|
||||
{
|
||||
ERROR_LOG() << "Folder Messages does not exist for exerciseId: " << m_exerciseId << ", partyId: " << partyId;
|
||||
ERROR_LOG(m_logger) << "Folder Messages does not exist for exerciseId: " << m_exerciseId << ", partyId: " << partyId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungs
|
||||
fileContentReq.exerciseId(m_exerciseId);
|
||||
fileContentReq.operatorId(99);
|
||||
|
||||
DEBUG_LOG() << "HQ: name: " << fileContentReq.name() << ", folderId: " << folderHXMessagesId << ", exerciseId: " << m_exerciseId << ", partyId: " << partyId;
|
||||
DEBUG_LOG(m_logger) << "HQ: name: " << fileContentReq.name() << ", folderId: " << folderHXMessagesId << ", exerciseId: " << m_exerciseId << ", partyId: " << partyId;
|
||||
|
||||
|
||||
QRegularExpression re(QStringLiteral("_\\d+$"));
|
||||
@@ -93,12 +93,12 @@ bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungs
|
||||
|
||||
|
||||
baseName = baseName.normalized(QString::NormalizationForm_C);
|
||||
ERROR_LOG() << "BaseName: " << baseName << "|";
|
||||
ERROR_LOG(m_logger) << "BaseName: " << baseName << "|";
|
||||
|
||||
QStringList fileNames;
|
||||
if (!m_dtcFlm->getAllFiles(fileContentReq.fileType(), folderHXMessagesId, fileNames, true))
|
||||
{
|
||||
ERROR_LOG() << "Error while reading fileNames for folderId: " << folderHXMessagesId;
|
||||
ERROR_LOG(m_logger) << "Error while reading fileNames for folderId: " << folderHXMessagesId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,13 +106,13 @@ bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungs
|
||||
for (const QString &fileName : std::as_const(fileNames))
|
||||
{
|
||||
QString normalizedName = fileName.normalized(QString::NormalizationForm_C);
|
||||
DEBUG_LOG() << "normalized fileName: " << normalizedName << "|";
|
||||
DEBUG_LOG(m_logger) << "normalized fileName: " << normalizedName << "|";
|
||||
|
||||
if (!normalizedName.startsWith(baseName))
|
||||
continue;
|
||||
|
||||
QString rest = fileName.mid(baseName.length());
|
||||
DEBUG_LOG() << "rest: " << rest;
|
||||
DEBUG_LOG(m_logger) << "rest: " << rest;
|
||||
if (rest.contains(QStringLiteral(".")))
|
||||
rest = rest.section(QStringLiteral("."), 0, 0);
|
||||
|
||||
@@ -128,12 +128,12 @@ bool FlmHandler::processHQMessage(int partyId, const QString &name, int meldungs
|
||||
if (ok)
|
||||
maxNumber = std::max(maxNumber, currentNum);
|
||||
}
|
||||
DEBUG_LOG() << " maxNumber: " << maxNumber;
|
||||
DEBUG_LOG(m_logger) << " maxNumber: " << maxNumber;
|
||||
}
|
||||
|
||||
const QString newName = baseName
|
||||
+ QStringLiteral("_") + QString::number(++maxNumber);
|
||||
DEBUG_LOG() << "newName : " << newName;
|
||||
DEBUG_LOG(m_logger) << "newName : " << newName;
|
||||
fileContentReq.name(newName.toStdString());
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ void FlmHandler::createHQNotification(const int partyId, const int folderId, con
|
||||
notif.expiryTime(expiryTime);
|
||||
|
||||
int prio = s->getInteger(QStringLiteral("NOM/notificationPriority"), 3);
|
||||
DEBUG_LOG() << " Setting: NotificationPriority: " << prio;
|
||||
DEBUG_LOG(m_logger) << " Setting: NotificationPriority: " << prio;
|
||||
notif.priority(static_cast<NotificationManagement::Priority_def::type>(prio));
|
||||
notif.processedPriority(NotificationManagement::Priority_def::Low);
|
||||
notif.exerciseId(m_exerciseId);
|
||||
@@ -191,7 +191,7 @@ void FlmHandler::createHQNotification(const int partyId, const int folderId, con
|
||||
notifReq.notification(notif);
|
||||
|
||||
if (!m_ftcNom->createNotificationRequest(notifReq, this))
|
||||
ERROR_LOG() << "Error requesting create Notification data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create Notification data";
|
||||
}
|
||||
|
||||
void FlmHandler::initHQFolders(int partyId)
|
||||
@@ -201,7 +201,7 @@ void FlmHandler::initHQFolders(int partyId)
|
||||
|
||||
if (exerciseFolderId <= 0)
|
||||
{
|
||||
ERROR_LOG() << "No exercise Folder for exerciseId: " << m_exerciseId;
|
||||
ERROR_LOG(m_logger) << "No exercise Folder for exerciseId: " << m_exerciseId;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -220,27 +220,27 @@ void FlmHandler::initHQFolders(int partyId)
|
||||
|
||||
void FlmHandler::onFileContentModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "Got Function Reply: " << reply.translated();
|
||||
DEBUG_LOG(m_logger) << "Got Function Reply: " << reply.translated();
|
||||
|
||||
if (reply.error())
|
||||
ERROR_LOG() << "Error while insert HX Message: " << reply.translated() << ", error: " << reply.error();
|
||||
ERROR_LOG(m_logger) << "Error while insert HX Message: " << reply.translated() << ", error: " << reply.error();
|
||||
else
|
||||
createHQNotification(m_partyId, m_folderHXMessagesId, reply.id());
|
||||
}
|
||||
|
||||
void FlmHandler::onPathCreateReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "Got Function Reply: " << reply.translated();
|
||||
DEBUG_LOG(m_logger) << "Got Function Reply: " << reply.translated();
|
||||
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << "Error while creating folders: " << reply.translated() << ", error: " << reply.error();
|
||||
ERROR_LOG(m_logger) << "Error while creating folders: " << reply.translated() << ", error: " << reply.error();
|
||||
}
|
||||
}
|
||||
|
||||
void FlmHandler::onCreateNotificationReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "FlmHandler: Got createReply with id " << replyObject.id() << " and errorString " << replyObject.translated();
|
||||
INFO_LOG(m_logger) << "FlmHandler: Got createReply with id " << replyObject.id() << " and errorString " << replyObject.translated();
|
||||
}
|
||||
|
||||
bool FlmHandler::parseContent(const QString &contentString, QMap<QString, QString> &retMap)
|
||||
|
||||
+2
@@ -41,12 +41,14 @@ class FlmHandler
|
||||
void initHQFolders(int partyId);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onFileContentModifyReply(const Core::FunctionReplyObject &reply) override;
|
||||
void onPathCreateReply(const Core::FunctionReplyObject &reply) override;
|
||||
void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
bool parseContent(const QString &contentString, QMap<QString, QString> &retMap);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
MainDispatcher *m_mainDispatcher = nullptr;
|
||||
int m_exerciseId;
|
||||
int m_parentFolderId;
|
||||
|
||||
+97
-97
@@ -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.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -115,6 +115,7 @@ class JsonDispatcher final
|
||||
void websocketConnected(quint16 port);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QUrl webSocketUrl() const;
|
||||
bool isConnectionTest(QJsonDocument &doc);
|
||||
QString getParticipantInfoLink(const QString &verein, const int partyId, const bool isVerbund);
|
||||
@@ -122,6 +123,7 @@ class JsonDispatcher final
|
||||
std::shared_ptr<SAAInterface> getSAAByName(const QString &saaName);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
std::shared_ptr<JsonHandlerRx> m_recvFromWebsocket;
|
||||
std::shared_ptr<JsonHandlerTx> m_sendToWebsocket;
|
||||
|
||||
+36
-37
@@ -14,15 +14,14 @@ JsonHandlerRx::JsonHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab
|
||||
const std::shared_ptr<TrainingAreaBase::TxMixin> &sendToTabCb,
|
||||
JsonDispatcher *dispatcher,
|
||||
AesHandler *aesHandler,
|
||||
PpmHandler *ppmHandler)
|
||||
: m_rxHandler(recvFromTabCb)
|
||||
PpmHandler *ppmHandler) : m_rxHandler(recvFromTabCb)
|
||||
, m_txHandler(sendToTabCb)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_bWarnedOnce(false)
|
||||
, m_bWarnedOnceTx(false)
|
||||
, m_aesHandler(aesHandler)
|
||||
, m_ppmHandler(ppmHandler)
|
||||
{
|
||||
, m_ppmHandler(ppmHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
}
|
||||
bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &errorcode)
|
||||
{
|
||||
@@ -31,7 +30,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
|
||||
if (!telegram.contains(JsonKeys::TYPE_ID()))
|
||||
{
|
||||
ERROR_LOG() << "telegram not contains typeId";
|
||||
ERROR_LOG(m_logger) << "telegram not contains typeId";
|
||||
}
|
||||
|
||||
const int typeId = telegram[JsonKeys::TYPE_ID()].toInt();
|
||||
@@ -39,7 +38,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
const QString uuid = telegram[JsonKeys::UUID_()].toString();
|
||||
const QString referenceUuid = telegram[JsonKeys::REFERENCE_UUID()].toString();
|
||||
|
||||
INFO_LOG() << "[handleTelegram] typeId=" << typeId << " typeName=" << typeName << " uuid=" << uuid << " referenceUuid=" << referenceUuid;
|
||||
INFO_LOG(m_logger) << "[handleTelegram] typeId=" << typeId << " typeName=" << typeName << " uuid=" << uuid << " referenceUuid=" << referenceUuid;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -53,7 +52,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
QString szenarName = dataObj.value(JsonKeys::SZENAR()).toString();
|
||||
bool isVerbund = dataObj.value(JsonKeys::ADLER_VERBUND()).toBool();
|
||||
m_dispatcher->onSAARegistration(wsId, partyId, saaName, szenarName, isVerbund, uuid);
|
||||
WARNING_LOG() << "On Register ------------------- partyId= " << partyId << ", saaName= " << saaName << ", szenarName= " << szenarName
|
||||
WARNING_LOG(m_logger) << "On Register ------------------- partyId= " << partyId << ", saaName= " << saaName << ", szenarName= " << szenarName
|
||||
<< ", isVerbund= " << isVerbund << ", wsId= " << wsId;
|
||||
break;
|
||||
}
|
||||
@@ -61,18 +60,18 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
{
|
||||
const int partyId = telegram[JsonKeys::DATA()].toObject().value(JsonKeys::PARTY_ID()).toInt(0);
|
||||
m_dispatcher->onSAADeregistration(wsId, partyId);
|
||||
WARNING_LOG() << "[EX_DEREGISTRATION_REQUEST] EX-Abmeldung -------------------------------------";
|
||||
WARNING_LOG(m_logger) << "[EX_DEREGISTRATION_REQUEST] EX-Abmeldung -------------------------------------";
|
||||
break;
|
||||
}
|
||||
case TelegramIds::EX_CONNECTION_TEST_REQUEST():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_CONNECTION_TEST_REQUEST] EX-Verbindungsanfrage -------------------------------------";
|
||||
DEBUG_LOG(m_logger) << "[EX_CONNECTION_TEST_REQUEST] EX-Verbindungsanfrage -------------------------------------";
|
||||
m_dispatcher->onSAAConnectionTest(wsId, uuid);
|
||||
break;
|
||||
}
|
||||
case TelegramIds::EX_STATUS():
|
||||
{
|
||||
WARNING_LOG() << "[EX_STATUS] EX-Status -------------------------------------";
|
||||
WARNING_LOG(m_logger) << "[EX_STATUS] EX-Status -------------------------------------";
|
||||
auto data = telegram[JsonKeys::DATA()];
|
||||
const QString status = data.toObject().value(JsonKeys::STATUS()).toString(QStringLiteral(""));
|
||||
|
||||
@@ -84,7 +83,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_TQ():
|
||||
{
|
||||
WARNING_LOG() << "[EX_TQ] Technische Quittierung -------------------------------------";
|
||||
WARNING_LOG(m_logger) << "[EX_TQ] Technische Quittierung -------------------------------------";
|
||||
const auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
bool bOk = true;
|
||||
TechnischeDaten technischeDaten;
|
||||
@@ -94,7 +93,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_FIRE():
|
||||
{
|
||||
WARNING_LOG() << "[EX-FQ(FN)] EX-Feuern -------------------------------------";
|
||||
WARNING_LOG(m_logger) << "[EX-FQ(FN)] EX-Feuern -------------------------------------";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
bool bOk = true;
|
||||
Feuerkampfdaten exFire;
|
||||
@@ -107,12 +106,12 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_AWES_PLANNING():
|
||||
{
|
||||
WARNING_LOG() << "[EX_AWES_PLANNING] EX-FQ(BA-BB-FK) Wirkfeldplanung";
|
||||
WARNING_LOG(m_logger) << "[EX_AWES_PLANNING] EX-FQ(BA-BB-FK) Wirkfeldplanung";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
WirkfeldplanungData wirkfeldplanungData;
|
||||
bool bOk = true;
|
||||
wirkfeldplanungDataFromJson(data, wirkfeldplanungData, bOk);
|
||||
DEBUG_LOG() << "\n-------------------"
|
||||
DEBUG_LOG(m_logger) << "\n-------------------"
|
||||
<< "\nwirkfeldplanungData"
|
||||
<< "\n dauer: " << wirkfeldplanungData.dauer << "\n abfeuerungsArt: " << static_cast<int>(wirkfeldplanungData.abfeuerungsArt)
|
||||
<< "\n feuerkampfReferenz: '" << wirkfeldplanungData.feuerkampfReferenz << "'"
|
||||
@@ -124,14 +123,14 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_POSITION_REPORT_WEAPON():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_POSITION_REPORT_WEAPON] Ex-SQ(WS) Stellungsmeldung Waffensystem";
|
||||
DEBUG_LOG(m_logger) << "[EX_POSITION_REPORT_WEAPON] Ex-SQ(WS) Stellungsmeldung Waffensystem";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Waffensystemdaten exSQWS;
|
||||
bool bOk = true;
|
||||
waffensystemdatenFromJson(data, exSQWS, bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG() << "Received Ex-SQ(WS) but couldn't parse the jsondata ";
|
||||
ERROR_LOG(m_logger) << "Received Ex-SQ(WS) but couldn't parse the jsondata ";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,14 +140,14 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_POSITION_REPORT_FIRE():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_POSITION_REPORT_FIRE] Ex-SQ(FS) Stellungsmeldung Feuerstellung";
|
||||
DEBUG_LOG(m_logger) << "[EX_POSITION_REPORT_FIRE] Ex-SQ(FS) Stellungsmeldung Feuerstellung";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Feuerstellungsdaten exSQFS;
|
||||
bool bOk = true;
|
||||
feuerstellungsdatenFromJson(data, exSQFS, bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG() << "Received Ex-SQ(FS) but couldn't parse the jsondata ";
|
||||
ERROR_LOG(m_logger) << "Received Ex-SQ(FS) but couldn't parse the jsondata ";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -158,14 +157,14 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_POSITION_REPORT_LOADING_PLACE():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_POSITION_REPORT_LOADING_PLACE] EX-SQ(LP)Stellungsmeldung Ladeplatz";
|
||||
DEBUG_LOG(m_logger) << "[EX_POSITION_REPORT_LOADING_PLACE] EX-SQ(LP)Stellungsmeldung Ladeplatz";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Ladeplatzdaten exSQLP;
|
||||
bool bOk = true;
|
||||
ladeplatzdatenFromJson(data, exSQLP, bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG() << "Received Ex-SQ(LP) but couldn't parse the jsondata ";
|
||||
ERROR_LOG(m_logger) << "Received Ex-SQ(LP) but couldn't parse the jsondata ";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -175,17 +174,17 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_FLUGBAHNDATEN():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_FLUGBAHNDATEN] EX-Flugbahndaten";
|
||||
DEBUG_LOG(m_logger) << "[EX_FLUGBAHNDATEN] EX-Flugbahndaten";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Flugbahndaten flugbahndaten;
|
||||
bool bOk = true;
|
||||
flugbahndatenFromJson(data, flugbahndaten, bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG() << "Received EX-Flugbahndaten but couldn't parse the jsondata ";
|
||||
ERROR_LOG(m_logger) << "Received EX-Flugbahndaten but couldn't parse the jsondata ";
|
||||
break;
|
||||
}
|
||||
DEBUG_LOG() << "Vor onSAATrajectoryData wsId=" << wsId;
|
||||
DEBUG_LOG(m_logger) << "Vor onSAATrajectoryData wsId=" << wsId;
|
||||
if (static_cast<int>(flugbahndaten.fehlercode) == 0)
|
||||
m_dispatcher->onSAATrajectoryData(wsId, flugbahndaten, referenceUuid);
|
||||
else
|
||||
@@ -194,7 +193,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_GUIDING_LINES():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_GUIDING_LINES] EX-HQ Koordinierungsmassnahmen";
|
||||
DEBUG_LOG(m_logger) << "[EX_GUIDING_LINES] EX-HQ Koordinierungsmassnahmen";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Koordinierungsdaten koordinierungsdaten;
|
||||
bool bOk = true;
|
||||
@@ -210,7 +209,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_GUIDING_LINES_AND_BOUNDARIES():
|
||||
{
|
||||
DEBUG_LOG() << "[EX_GUIDING_LINES_AND_BOUNDARIES] EX-HQ(G)Fuehrungslinien und Grenzen ";
|
||||
DEBUG_LOG(m_logger) << "[EX_GUIDING_LINES_AND_BOUNDARIES] EX-HQ(G)Fuehrungslinien und Grenzen ";
|
||||
auto data = telegram[JsonKeys::DATA()].toObject();
|
||||
Fuehrungsdaten fuehrungsdaten;
|
||||
bool bOk = true;
|
||||
@@ -226,7 +225,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_FIRE_HALT():
|
||||
{
|
||||
WARNING_LOG() << "[EX_FIRE_HALT] Feuerhalt";
|
||||
WARNING_LOG(m_logger) << "[EX_FIRE_HALT] Feuerhalt";
|
||||
|
||||
auto data = telegram[QStringLiteral("data")].toObject();
|
||||
bool bOk = true;
|
||||
@@ -239,7 +238,7 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
case TelegramIds::EX_DONT_FIRE():
|
||||
{
|
||||
WARNING_LOG() << "[EX_DONT_FIRE] Dont Fire";
|
||||
WARNING_LOG(m_logger) << "[EX_DONT_FIRE] Dont Fire";
|
||||
auto data = telegram[QStringLiteral("data")].toObject();
|
||||
bool bOk = true;
|
||||
Feuerkampfdaten feuerkampfdaten;
|
||||
@@ -251,20 +250,20 @@ bool JsonHandlerRx::handleTelegram(int wsId, const QJsonObject &telegram, int &e
|
||||
}
|
||||
default:
|
||||
{
|
||||
WARNING_LOG() << "Cant handle Telegram typeId=" << typeId;
|
||||
WARNING_LOG(m_logger) << "Cant handle Telegram typeId=" << typeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool JsonHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
{
|
||||
DEBUG_LOG() << "JsonHandlerRx::handleTelegram";
|
||||
DEBUG_LOG(m_logger) << "JsonHandlerRx::handleTelegram";
|
||||
|
||||
if (baJson.isEmpty())
|
||||
return false;
|
||||
@@ -273,19 +272,19 @@ bool JsonHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
if (typeId.toInt() != 21)
|
||||
ERROR_LOG() << "Telegram before filter: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Telegram before filter: " << baJson;
|
||||
try
|
||||
{
|
||||
QJsonValue header = data[QStringLiteral("header")];
|
||||
|
||||
QJsonObject obj = header.toObject();
|
||||
|
||||
ERROR_LOG() << "Telegram header: " << obj.count();
|
||||
ERROR_LOG(m_logger) << "Telegram header: " << obj.count();
|
||||
if (!obj.isEmpty())
|
||||
{
|
||||
int eqNo = obj[QStringLiteral("equipmentNumber")].toInt(0);
|
||||
@@ -295,11 +294,11 @@ bool JsonHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
return false;
|
||||
}
|
||||
if (typeId.toInt() != 21)
|
||||
ERROR_LOG() << "Telegram after filter: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Telegram after filter: " << baJson;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -313,7 +312,7 @@ template <typename T> void JsonHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
@@ -328,7 +327,7 @@ template <typename T> void JsonHandlerRx::txData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnceTx)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnceTx = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@ void JsonHandlerTx::onWebsocketConnectedToExternalSystem(bool bConnected)
|
||||
{
|
||||
m_bWebsocketConnectedToExternalSystem = bConnected;
|
||||
|
||||
INFO_LOG() << "Connected to SAA";
|
||||
INFO_LOG(m_logger) << "Connected to SAA";
|
||||
const auto tele2 = m_pdp->exerciseEnvironmentData();
|
||||
sendToTx(&tele2, true);
|
||||
connect(m_mainDispatcher->aesHandler().get(), &AesHandler::explosionSingleChanged, this, &JsonHandlerTx::onGenericTelegram, Qt::UniqueConnection);
|
||||
@@ -353,7 +353,7 @@ bool JsonHandlerTx::txData(const TrainingAreaBase::TetraIcd::ExConfirmationRepor
|
||||
|
||||
void JsonHandlerTx::onParticipantConnectionState(const int equipmentNumber, const bool dataCommunicationPossible)
|
||||
{
|
||||
INFO_LOG() << "onParticipantConnectionState - " << equipmentNumber
|
||||
INFO_LOG(m_logger) << "onParticipantConnectionState - " << equipmentNumber
|
||||
<< ", communication possible: " << dataCommunicationPossible;
|
||||
if (equipmentNumber == -1)
|
||||
m_dataCommunicationPossible.clear();
|
||||
@@ -365,7 +365,7 @@ void JsonHandlerTx::onGenericTelegram(const QJsonObject &telegram)
|
||||
if (!m_webSocket || !m_bWebsocketConnectedToExternalSystem)
|
||||
return;
|
||||
const QByteArray ba = QJsonDocument(telegram).toJson(QJsonDocument::Compact);
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
m_webSocket->sendTextMessage(QString::fromUtf8(ba));
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ bool JsonHandlerTx::sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTeleg
|
||||
telegram[QStringLiteral("data")] = data->toJson();
|
||||
telegram[QStringLiteral("type")] = data->type();
|
||||
telegram[QStringLiteral("typeId")] = data->id();
|
||||
ERROR_LOG() << QJsonDocument(telegram).toJson(QJsonDocument::Compact).toStdString();
|
||||
ERROR_LOG(m_logger) << QJsonDocument(telegram).toJson(QJsonDocument::Compact).toStdString();
|
||||
onGenericTelegram(telegram);
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ MainDispatcher::MainDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
|
||||
, m_domainId(pdp->domainId())
|
||||
, m_exerciseId(pdp->exerciseId())
|
||||
{
|
||||
INFO_LOG() << "Plugin AdlerJson started";
|
||||
INFO_LOG(m_logger) << "Plugin AdlerJson started";
|
||||
}
|
||||
|
||||
MainDispatcher::~MainDispatcher()
|
||||
@@ -79,7 +79,7 @@ bool MainDispatcher::init()
|
||||
}
|
||||
void MainDispatcher::onWebsocketConnected(quint16 port)
|
||||
{
|
||||
ERROR_LOG() << "ApAdler started, Domain Id: " << QString::number(port);
|
||||
ERROR_LOG(m_logger) << "ApAdler started, Domain Id: " << QString::number(port);
|
||||
m_ddsHandler->pacemaker()->addPort(port, Core::PortType::WebSocketAdlerServer);
|
||||
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public:
|
||||
const char *name () const override { return tr_lts("dds", "ApHlaJson"); }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
JsonDispatcher *m_adlerDispatcher;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
|
||||
+5
-6
@@ -10,9 +10,8 @@ namespace AdlerJson
|
||||
{
|
||||
|
||||
|
||||
PdmHandler::PdmHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
PdmHandler::PdmHandler(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
{
|
||||
@@ -20,7 +19,7 @@ bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
if (!m_dtcPdm->enableChargeType())
|
||||
{
|
||||
ERROR_LOG() << "Can not read data from Pdm";
|
||||
ERROR_LOG(m_logger) << "Can not read data from Pdm";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,7 +32,7 @@ bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
void PdmHandler::getChargeTypes()
|
||||
{
|
||||
DEBUG_LOG() << "Get Charge Types";
|
||||
DEBUG_LOG(m_logger) << "Get Charge Types";
|
||||
QJsonObject obj;
|
||||
QJsonArray dataArray;
|
||||
obj[QStringLiteral("type")] = QStringLiteral("ApacheHlaSendChargeTypes");
|
||||
@@ -43,7 +42,7 @@ void PdmHandler::getChargeTypes()
|
||||
QMap<qint32, ProjectDataManagement::ChargeType> chargeTypes = m_dtcPdm->chargeTypes();
|
||||
QMap<qint32, ProjectDataManagement::GearType> gearTypes = m_dtcPdm->gearTypes();
|
||||
QMap<qint32, ProjectDataManagement::GearTypeChargeType> gearTypeChargeTypes = m_dtcPdm->gearTypeChargeTypes();
|
||||
DEBUG_LOG() << "Fetched " << chargeTypes.size() << " ChargeTypes to send to WebSocket. Ommiting those without DIS-Entity though.";
|
||||
DEBUG_LOG(m_logger) << "Fetched " << chargeTypes.size() << " ChargeTypes to send to WebSocket. Ommiting those without DIS-Entity though.";
|
||||
|
||||
for(const ProjectDataManagement::ChargeType &charge : chargeTypes)
|
||||
{
|
||||
|
||||
+1
@@ -32,6 +32,7 @@ public slots:
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
};
|
||||
|
||||
|
||||
+38
-38
@@ -36,10 +36,10 @@ bool PpmHandler::init(MainDispatcher *mainDispatcher)
|
||||
|
||||
m_dtcPpm = ParticipantManagement::Interface::Dtc::create(m_mainDispatcher->ddsHandler()->ddsConnector());
|
||||
|
||||
DEBUG_LOG() << "-------------<><><>------" << m_mainDispatcher->exerciseId();
|
||||
DEBUG_LOG(m_logger) << "-------------<><><>------" << m_mainDispatcher->exerciseId();
|
||||
if (!m_dtcPpm->enableParticipant() || !m_dtcPpm->enableDynamicParticipantData() || !m_dtcPpm->enableParticipantPosition())
|
||||
{
|
||||
ERROR_LOG() << "Can not read data from Ppm";
|
||||
ERROR_LOG(m_logger) << "Can not read data from Ppm";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
|
||||
const ParticipantManagement::ConnectState &connectState,
|
||||
const bool isVerbund)
|
||||
{
|
||||
DEBUG_LOG() << "modifyParty"
|
||||
DEBUG_LOG(m_logger) << "modifyParty"
|
||||
<< " assetId=" << assetId << " partyId=" << partyId << " saaName=" << saaName << " szenarName=" << szenarName << " connectState=" << connectState
|
||||
<< " isVerbund=" << isVerbund;
|
||||
|
||||
@@ -93,11 +93,11 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
|
||||
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
{
|
||||
ERROR_LOG() << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
|
||||
ERROR_LOG(m_logger) << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
|
||||
doc = QJsonDocument();
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "json to parse: " << doc.toJson();
|
||||
DEBUG_LOG(m_logger) << "json to parse: " << doc.toJson();
|
||||
|
||||
QJsonObject obj(doc.object());
|
||||
obj[QStringLiteral("Adler")] = adlerPropertiesObj;
|
||||
@@ -110,11 +110,11 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
|
||||
|
||||
void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
|
||||
{
|
||||
DEBUG_LOG() << "Start parse SQFS";
|
||||
DEBUG_LOG(m_logger) << "Start parse SQFS";
|
||||
auto saa = m_mainDispatcher->jsonDispatcher()->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;
|
||||
}
|
||||
const QString &verein = exSQFS.feuereinheit.verein;
|
||||
@@ -179,7 +179,7 @@ void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
|
||||
const auto root = findRootUnit(saa->getPartyId());
|
||||
if (root.id() > 0)
|
||||
{
|
||||
DEBUG_LOG() << "Append FS Unit to root Unit";
|
||||
DEBUG_LOG(m_logger) << "Append FS Unit to root Unit";
|
||||
list.push_back(root);
|
||||
}
|
||||
|
||||
@@ -214,11 +214,11 @@ void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
|
||||
|
||||
void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
{
|
||||
DEBUG_LOG() << "Start parse SQWS";
|
||||
DEBUG_LOG(m_logger) << "Start parse SQWS";
|
||||
auto saa = m_mainDispatcher->jsonDispatcher()->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;
|
||||
}
|
||||
const ProjectDataManagement::L27_EffectorId &internalName = exSQWS.kenner;
|
||||
@@ -253,7 +253,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
if (pp.id() > 0)
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "Found Participant only update pos";
|
||||
DEBUG_LOG(m_logger) << "Found Participant only update pos";
|
||||
sendPositionFromTempMap(currentRandomNumber, saa->getPartyId(), saa->getIsVerbund());
|
||||
sendChargesFromTempMap(currentRandomNumber, saa->getPartyId(), saa->getIsVerbund());
|
||||
|
||||
@@ -267,10 +267,10 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
|
||||
|
||||
const ParticipantManagement::Type type = m_dtcPpm->getTypeFromAdlerType(waffensystemtypMap.key(internalType.underlying()), false, saa->getIsVerbund());
|
||||
DEBUG_LOG() << "found type with id: " << type.id() << " for name: " << waffensystemtypMap.key(internalType);
|
||||
DEBUG_LOG(m_logger) << "found type with id: " << type.id() << " for name: " << waffensystemtypMap.key(internalType);
|
||||
if (type.id() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "NO Type Found";
|
||||
ERROR_LOG(m_logger) << "NO Type Found";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -280,12 +280,12 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
uint superiorModId = QRandomGenerator::global()->generate() / 2;
|
||||
|
||||
ParticipantManagement::Participant pUnit = findParticipantByInternalName(verein, saa->getPartyId(), saa->getIsVerbund());
|
||||
DEBUG_LOG() << "Looking for Verein: " << verein << " found Unit: " << pUnit.id() << " foundData: " << pUdata.modId();
|
||||
DEBUG_LOG(m_logger) << "Looking for Verein: " << verein << " found Unit: " << pUnit.id() << " foundData: " << pUdata.modId();
|
||||
|
||||
if (pUdata.modId() > 0)
|
||||
{
|
||||
superiorModId = pUdata.modId();
|
||||
DEBUG_LOG() << "FOUND UNIT in list use their modId " << superiorModId << " RND: " << currentRandomNumber;
|
||||
DEBUG_LOG(m_logger) << "FOUND UNIT in list use their modId " << superiorModId << " RND: " << currentRandomNumber;
|
||||
}
|
||||
else if (pUnit.id() > 0)
|
||||
{
|
||||
@@ -296,7 +296,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
|
||||
list.push_back(pUData);
|
||||
m_tempPartDataList.insert(currentRandomNumber, list);
|
||||
DEBUG_LOG() << "CREATE Uit from ppm " << superiorModId << " RND: " << currentRandomNumber;
|
||||
DEBUG_LOG(m_logger) << "CREATE Uit from ppm " << superiorModId << " RND: " << currentRandomNumber;
|
||||
ParticipantManagement::Participant tmp = pUnit;
|
||||
while (tmp.superiorId() > 0)
|
||||
{
|
||||
@@ -314,11 +314,11 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
const auto root = findRootUnit(saa->getPartyId());
|
||||
if (root.id() > 0)
|
||||
{
|
||||
DEBUG_LOG() << "Append to Unit" << superiorModId << " RND: " << currentRandomNumber;
|
||||
DEBUG_LOG(m_logger) << "Append to Unit" << superiorModId << " RND: " << currentRandomNumber;
|
||||
list.push_back(root);
|
||||
}
|
||||
const ParticipantManagement::Type unitType = m_dtcPpm->getTypeFromAdlerType(waffensystemtypMap.key(internalType), true, saa->getIsVerbund());
|
||||
DEBUG_LOG() << "CREATE NEW Unit use supId" << superiorModId << " RND: " << currentRandomNumber;
|
||||
DEBUG_LOG(m_logger) << "CREATE NEW Unit use supId" << superiorModId << " RND: " << currentRandomNumber;
|
||||
ParticipantManagement::ParticipantData data;
|
||||
data.id(0);
|
||||
data.partyId(saa->getPartyId());
|
||||
@@ -337,7 +337,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
list.push_back(data);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Create new Participant"
|
||||
DEBUG_LOG(m_logger) << "Create new Participant"
|
||||
<< " RND: " << currentRandomNumber;
|
||||
|
||||
ParticipantManagement::ParticipantData data;
|
||||
@@ -366,11 +366,11 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
|
||||
|
||||
void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
|
||||
{
|
||||
DEBUG_LOG() << "START parse SQLP";
|
||||
DEBUG_LOG(m_logger) << "START parse SQLP";
|
||||
auto saa = m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId);
|
||||
if (!saa)
|
||||
{
|
||||
ERROR_LOG() << "SQ LP from SAA but SAA with id " << wsId << " not found";
|
||||
ERROR_LOG(m_logger) << "SQ LP from SAA but SAA with id " << wsId << " not found";
|
||||
return;
|
||||
}
|
||||
const QString &verein = exSQLP.einheit.verein;
|
||||
@@ -409,7 +409,7 @@ void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "Create new Participant LP";
|
||||
DEBUG_LOG(m_logger) << "Create new Participant LP";
|
||||
std::vector<ParticipantManagement::ParticipantData> list;
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
|
||||
const auto root = findRootUnit(saa->getPartyId());
|
||||
if (root.id() > 0)
|
||||
{
|
||||
DEBUG_LOG() << "Append LP to Unit";
|
||||
DEBUG_LOG(m_logger) << "Append LP to Unit";
|
||||
list.push_back(root);
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ void PpmHandler::removeAllSAAParticipants(const int partyId)
|
||||
list.push_back(pToDel);
|
||||
}
|
||||
req.data(list);
|
||||
DEBUG_LOG() << "Remove all participants (without Units): " << list.size();
|
||||
DEBUG_LOG(m_logger) << "Remove all participants (without Units): " << list.size();
|
||||
m_ftcPpm->modifyParticipantDataRequest(req, this);
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ void PpmHandler::onSendParticipantDataTimeout()
|
||||
{
|
||||
m_sendParticipantDataTimer->stop();
|
||||
if (m_randomNumbers.empty())
|
||||
ERROR_LOG() << "Cant Send ParticipantData RandomNumbers is empty";
|
||||
ERROR_LOG(m_logger) << "Cant Send ParticipantData RandomNumbers is empty";
|
||||
ParticipantManagement::ModifyParticipantDataRequest *newRequest = new ParticipantManagement::ModifyParticipantDataRequest();
|
||||
int currentRandomNumber = m_randomNumbers.first();
|
||||
newRequest->requestId(currentRandomNumber);
|
||||
@@ -707,7 +707,7 @@ void PpmHandler::handleParticipantPositionChangedExternal(const ParticipantManag
|
||||
|
||||
void PpmHandler::handleParticipantPositionChangedInternal(const ParticipantManagement::ParticipantPosition &position)
|
||||
{
|
||||
DEBUG_LOG() << "handleParticipantPositionChangedInternal";
|
||||
DEBUG_LOG(m_logger) << "handleParticipantPositionChangedInternal";
|
||||
ParticipantManagement::Participant part = m_dtcPpm->participant(position.participantId());
|
||||
|
||||
const bool hasMountedParticipants = position.mountedParticipants().is_set() && position.mountedParticipants().get().size() > 0;
|
||||
@@ -739,7 +739,7 @@ void PpmHandler::handleParticipantPositionChangedInternal(const ParticipantManag
|
||||
void PpmHandler::sendParticipantMount(const ParticipantManagement::Participant &part, const ParticipantManagement::Participant &partToBeMounted)
|
||||
{
|
||||
m_mountedParticipants.insert(part.equipmentNumber().get(), partToBeMounted.equipmentNumber().get());
|
||||
ERROR_LOG() << "Mount Participant";
|
||||
ERROR_LOG(m_logger) << "Mount Participant";
|
||||
QJsonObject telegram;
|
||||
|
||||
telegram[QStringLiteral("type")] = QStringLiteral("UFomHlaParticipantMount");
|
||||
@@ -759,7 +759,7 @@ void PpmHandler::sendParticipantMount(const ParticipantManagement::Participant &
|
||||
void PpmHandler::sendParticipantUnmount(const ParticipantManagement::Participant &participant)
|
||||
{
|
||||
m_mountedParticipants.remove(participant.equipmentNumber().get());
|
||||
DEBUG_LOG() << "Unmount Participant";
|
||||
DEBUG_LOG(m_logger) << "Unmount Participant";
|
||||
QJsonObject telegram;
|
||||
|
||||
telegram[QStringLiteral("type")] = QStringLiteral("UFomHlaParticipantUnmount");
|
||||
@@ -800,7 +800,7 @@ void PpmHandler::sendParticipantPositionChanged(const ParticipantManagement::Par
|
||||
|
||||
void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "Got Function Reply " << reply.str();
|
||||
DEBUG_LOG(m_logger) << "Got Function Reply " << reply.str();
|
||||
|
||||
if (!reply.error())
|
||||
{
|
||||
@@ -815,7 +815,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
|
||||
|
||||
const bool isVerbund = m_mainDispatcher->jsonDispatcher()->getSAAByParty(partyId)->getIsVerbund();
|
||||
|
||||
DEBUG_LOG() << "Got ModifyParticipant Reply SEND from temp Maps (partyId: " << partyId << " , isVerbund: " << isVerbund << ")";
|
||||
DEBUG_LOG(m_logger) << "Got ModifyParticipant Reply SEND from temp Maps (partyId: " << partyId << " , isVerbund: " << isVerbund << ")";
|
||||
|
||||
if (m_tempPositionMap.contains(reply.id()))
|
||||
sendPositionFromTempMap(reply.id(), partyId, isVerbund);
|
||||
@@ -828,7 +828,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "GOT ModifyParticipant Replay with error " << reply.translated();
|
||||
ERROR_LOG(m_logger) << "GOT ModifyParticipant Replay with error " << reply.translated();
|
||||
}
|
||||
|
||||
|
||||
@@ -845,7 +845,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
|
||||
m_tempPartDataList.remove(reply.id());
|
||||
}
|
||||
|
||||
void PpmHandler::onModifyPartyDataReply(const Core::FunctionReplyObject &reply) { DEBUG_LOG() << "Got Function Reply " << reply.str(); }
|
||||
void PpmHandler::onModifyPartyDataReply(const Core::FunctionReplyObject &reply) { DEBUG_LOG(m_logger) << "Got Function Reply " << reply.str(); }
|
||||
|
||||
QList<ParticipantManagement::Participant> PpmHandler::findAllSAAParticipants(const int partyId)
|
||||
{
|
||||
@@ -908,7 +908,7 @@ ParticipantManagement::ParticipantData PpmHandler::findRootUnit(const int partyI
|
||||
ParticipantManagement::Participant PpmHandler::findParticipantByInternalName(const QString &internalName, const int partyId, const bool isVerbund)
|
||||
{
|
||||
ParticipantManagement::Participant pp;
|
||||
DEBUG_LOG() << "START find participant: " << internalName;
|
||||
DEBUG_LOG(m_logger) << "START find participant: " << internalName;
|
||||
auto participantMap = m_dtcPpm->participants();
|
||||
for (const auto &part : std::as_const(participantMap))
|
||||
{
|
||||
@@ -931,13 +931,13 @@ ParticipantManagement::Participant PpmHandler::findParticipantByInternalName(con
|
||||
|
||||
void PpmHandler::onPartyChanged(const ParticipantManagement::Party &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << ", modType: " << modType;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << ", modType: " << modType;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
const ParticipantManagement::ConnectState connectState = m_dtcPpm->saaConnectedState(data.id());
|
||||
DEBUG_LOG() << "++++ connectState: " << connectState;
|
||||
DEBUG_LOG(m_logger) << "++++ connectState: " << connectState;
|
||||
|
||||
|
||||
if (connectState != ParticipantManagement::ConnectState::Disconnecting)
|
||||
@@ -947,7 +947,7 @@ void PpmHandler::onPartyChanged(const ParticipantManagement::Party &data, DataMo
|
||||
if (!saa)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "++++ szenarName: " << saa->getSzenarName() << ", wsId: " << saa->getWsId();
|
||||
DEBUG_LOG(m_logger) << "++++ szenarName: " << saa->getSzenarName() << ", wsId: " << saa->getWsId();
|
||||
|
||||
EXStatus status;
|
||||
status.status = Szenarstatus::Gestoppt;
|
||||
@@ -1015,7 +1015,7 @@ void PpmHandler::sendChargesFromTempMap(const int rndNmbr, const int partyId, co
|
||||
if (chargeTypeId <= 0)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG() << "---- participant.id:" << participant.id() << (participant.typeId() == type.id() ? " (Ladeplatz)" : "");
|
||||
DEBUG_LOG(m_logger) << "---- participant.id:" << participant.id() << (participant.typeId() == type.id() ? " (Ladeplatz)" : "");
|
||||
|
||||
QVector<int> gearTypesIds = m_mainDispatcher->pdmHandler()->getDtc()->gearTypeIdFromChargeTypeId(chargeTypeId);
|
||||
|
||||
@@ -1059,7 +1059,7 @@ int PpmHandler::convertStatus_L28(const ProjectDataManagement::L28_Status &statu
|
||||
return ADLER_NOT_OPERATIONAL;
|
||||
|
||||
default:
|
||||
WARNING_LOG() << "Status " << status << " not handled in switch";
|
||||
WARNING_LOG(m_logger) << "Status " << status << " not handled in switch";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -65,6 +65,7 @@ private slots:
|
||||
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
void onSendParticipantDataTimeout();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void handleParticipantPositionChangedExternal(const ParticipantManagement::ParticipantPosition &position);
|
||||
void handleParticipantPositionChangedInternal(const ParticipantManagement::ParticipantPosition &position);
|
||||
|
||||
@@ -85,6 +86,7 @@ private:
|
||||
|
||||
QVector<AdlerJson::Geschoss> sumUpAnzahlForSameGeschoss(const QVector<AdlerJson::Geschoss> &geschosse) const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
MainDispatcher *m_mainDispatcher;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftcPpm;
|
||||
|
||||
+17
-17
@@ -73,7 +73,7 @@ bool SAAInterface::init(std::shared_ptr<PpmHandler> ppmHandler,
|
||||
|
||||
m_ftcAes = m_aesHandler->getFtc();
|
||||
|
||||
DEBUG_LOG() << "INIT SAA Interface";
|
||||
DEBUG_LOG(m_logger) << "INIT SAA Interface";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ static Core::RelativePositionRelativeTime convertFlugbahnpunkt(const Flugbahnpun
|
||||
|
||||
void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int aesItemId, int exposionId, const Core::GeoPosition &positionLaunch)
|
||||
{
|
||||
DEBUG_LOG() << "SAAInterface::parseFlugbahndaten";
|
||||
DEBUG_LOG(m_logger) << "SAAInterface::parseFlugbahndaten";
|
||||
|
||||
std::vector<Core::RelativePositionRelativeTime> geometryRef;
|
||||
geometryRef.clear();
|
||||
@@ -138,22 +138,22 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
const auto &utmLaunch = LtsCoordTrans::UtmCoordinate::fromGeographic(positionLaunch.lon(), positionLaunch.lat(), zone);
|
||||
|
||||
|
||||
DEBUG_LOG() << " mmilirad: " << flugbahndaten.schussrichtung;
|
||||
DEBUG_LOG(m_logger) << " mmilirad: " << flugbahndaten.schussrichtung;
|
||||
double grad = (flugbahndaten.schussrichtung / 6400.) * 360.0;
|
||||
DEBUG_LOG() << " milli rad to degree" << (flugbahndaten.schussrichtung / 6400.) * 360;
|
||||
DEBUG_LOG() << "Degree to target" << grad;
|
||||
DEBUG_LOG(m_logger) << " milli rad to degree" << (flugbahndaten.schussrichtung / 6400.) * 360;
|
||||
DEBUG_LOG(m_logger) << "Degree to target" << grad;
|
||||
|
||||
DEBUG_LOG() << "Start point: " << positionLaunch;
|
||||
DEBUG_LOG(m_logger) << "Start point: " << positionLaunch;
|
||||
|
||||
const auto &coordEnd = LtsCoordTrans::UtmCoordinate::fromGeographic(flugbahndaten.zielkoordinate.koordinate.longitude * (M_PI / 180.0),
|
||||
flugbahndaten.zielkoordinate.koordinate.latitude * (M_PI / 180.0));
|
||||
DEBUG_LOG() << "End point: " << coordEnd;
|
||||
DEBUG_LOG(m_logger) << "End point: " << coordEnd;
|
||||
LtsCoordTrans::UtmCoordinate coordDiff = coordEnd;
|
||||
|
||||
coordDiff.x = coordDiff.x - utmLaunch.x;
|
||||
coordDiff.y = coordDiff.y - utmLaunch.y;
|
||||
const double useNewGrad = -90 + std::atan2(coordDiff.y, coordDiff.x) * (180.0 / M_PI);
|
||||
DEBUG_LOG() << "use new Degree " << useNewGrad;
|
||||
DEBUG_LOG(m_logger) << "use new Degree " << useNewGrad;
|
||||
|
||||
QTransform matrix;
|
||||
matrix.rotate(useNewGrad);
|
||||
@@ -169,11 +169,11 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
if (m_logger.isDebugEnabled())
|
||||
{
|
||||
const auto &fbPosRelative = convertFlugbahnpunkt(pos, matrix, utmLaunch, m_logger);
|
||||
DEBUG_LOG() << " fbPosRelative " << fbPosRelative;
|
||||
DEBUG_LOG(m_logger) << " fbPosRelative " << fbPosRelative;
|
||||
}
|
||||
|
||||
|
||||
TRACE_LOG() << "Flugbahnpunkt:"
|
||||
TRACE_LOG(m_logger) << "Flugbahnpunkt:"
|
||||
<< ", xRelativ :" << pos.xRelativ
|
||||
<< ", yRelativ :" << pos.yRelativ
|
||||
<< ", zRelativ :" << pos.zRelativ
|
||||
@@ -198,7 +198,7 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
utmCoord.zone = utmLaunch.zone;
|
||||
QPointF pntGeo = utmCoord.geographic();
|
||||
|
||||
TRACE_LOG() << "utmCoord :" << utmCoord.x << " / " << utmCoord.y << ", utmCoord.zone :" << utmCoord.zone << ", utmCoord.isValid() :" << utmCoord.isValid()
|
||||
TRACE_LOG(m_logger) << "utmCoord :" << utmCoord.x << " / " << utmCoord.y << ", utmCoord.zone :" << utmCoord.zone << ", utmCoord.isValid() :" << utmCoord.isValid()
|
||||
<< ", pntGeo :" << pntGeo.x() << " / " << pntGeo.y() << " / " << z;
|
||||
QTransform matrix;
|
||||
matrix.rotate(useNewGrad);
|
||||
@@ -210,15 +210,15 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
flightPoint.relativeTime() = pos.zeit;
|
||||
QPointF point(flightPoint.offsetX(), flightPoint.offsetY());
|
||||
|
||||
TRACE_LOG() << " POS bevore rot: " << point;
|
||||
TRACE_LOG(m_logger) << " POS bevore rot: " << point;
|
||||
|
||||
auto rotatePoint = matrix.map(point);
|
||||
TRACE_LOG() << " POS after rot: " << rotatePoint;
|
||||
TRACE_LOG(m_logger) << " POS after rot: " << rotatePoint;
|
||||
|
||||
pntGeo.setX(rotatePoint.x());
|
||||
pntGeo.setY(rotatePoint.y());
|
||||
|
||||
TRACE_LOG() << "utmCoord :" << utmCoord.x << " / " << utmCoord.y << ", utmCoord.zone :" << utmCoord.zone << ", utmCoord.isValid() :" << utmCoord.isValid()
|
||||
TRACE_LOG(m_logger) << "utmCoord :" << utmCoord.x << " / " << utmCoord.y << ", utmCoord.zone :" << utmCoord.zone << ", utmCoord.isValid() :" << utmCoord.isValid()
|
||||
<< ", pntGeo :" << pntGeo.x() << " / " << pntGeo.y() << " / " << z;
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
newRequest->mhpScatterWidthDetonationHeight(flugbahndaten.streuung.seitenstreuungH);
|
||||
newRequest->shootDirection((flugbahndaten.schussrichtung / 6400.) * 360);
|
||||
newRequest->errorcode(static_cast<int>(flugbahndaten.fehlercode));
|
||||
DEBUG_LOG() << "!!!!!!!!!!!geometryRef.size=" << geometryRef.size() << ", newRequest->geometry().size() :" << newRequest->geometry().size()
|
||||
DEBUG_LOG(m_logger) << "!!!!!!!!!!!geometryRef.size=" << geometryRef.size() << ", newRequest->geometry().size() :" << newRequest->geometry().size()
|
||||
<< ", newRequest->errorcode :" << newRequest->errorcode() << ", newRequest->Peak:" << newRequest->peakAltitude()
|
||||
<< ", newRequest->direction:" << newRequest->shootDirection() << ", flugbahndaten.fehlercode :" << static_cast<int>(flugbahndaten.fehlercode);
|
||||
|
||||
@@ -254,10 +254,10 @@ void SAAInterface::parseFlugbahndaten(const Flugbahndaten &flugbahndaten, int ae
|
||||
|
||||
void SAAInterface::onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
DEBUG_LOG() << "onTrajectoryAdlerModifyReply";
|
||||
DEBUG_LOG(m_logger) << "onTrajectoryAdlerModifyReply";
|
||||
if (reply.error())
|
||||
{
|
||||
ERROR_LOG() << reply.translated();
|
||||
ERROR_LOG(m_logger) << reply.translated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -75,6 +75,8 @@ public:
|
||||
void rxData (const T &data );
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onTrajectoryAdlerModifyReply(const Core::FunctionReplyObject &reply) override;
|
||||
|
||||
int m_wsId;
|
||||
|
||||
+11
-11
@@ -58,25 +58,25 @@ bool WebSocketHandler::sendTelegram(int typeId, const QJsonObject *data, int exe
|
||||
|
||||
bool WebSocketHandler::sendTelegram(const int wsId, const QJsonObject *data)
|
||||
{
|
||||
DEBUG_LOG() << "Send Telegram esId=" << wsId
|
||||
DEBUG_LOG(m_logger) << "Send Telegram esId=" << wsId
|
||||
<< ", m_connections.size=" << m_connections.size();
|
||||
|
||||
for (auto it = m_connections.begin(); it != m_connections.end(); it++)
|
||||
DEBUG_LOG() << "key: " << it.key();
|
||||
DEBUG_LOG(m_logger) << "key: " << it.key();
|
||||
|
||||
const QString jsonStr = QString::fromUtf8(QJsonDocument(*data).toJson(QJsonDocument::Compact));
|
||||
if(!m_connections.contains(wsId))
|
||||
{
|
||||
DEBUG_LOG() << "!m_connections.contains(" << wsId << ") return false;";
|
||||
DEBUG_LOG(m_logger) << "!m_connections.contains(" << wsId << ") return false;";
|
||||
return false;
|
||||
}
|
||||
std::shared_ptr<WebSocketWrapper> ws = m_connections.value(wsId);
|
||||
|
||||
DEBUG_LOG() << "Send Telegram to SAA: " << jsonStr<< " \n LocalPort" << ws->webSocket()->localAddress().toString()
|
||||
DEBUG_LOG(m_logger) << "Send Telegram to SAA: " << jsonStr<< " \n LocalPort" << ws->webSocket()->localAddress().toString()
|
||||
<< "." << ws->webSocket()->localPort()
|
||||
<< " PeerPort " << ws->webSocket()->peerAddress().toString()
|
||||
<< ":" <<ws->webSocket()->peerPort();
|
||||
DEBUG_LOG() << "VERSION " << ws->webSocket()->version();
|
||||
DEBUG_LOG(m_logger) << "VERSION " << ws->webSocket()->version();
|
||||
return ws->sendTextMessage(jsonStr);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ bool WebSocketHandler::disconnectWs(int wsId)
|
||||
{
|
||||
if(!m_connections.contains(wsId))
|
||||
{
|
||||
DEBUG_LOG() << "!m_connections.contains(" << wsId << ") return false;";
|
||||
DEBUG_LOG(m_logger) << "!m_connections.contains(" << wsId << ") return false;";
|
||||
return false;
|
||||
}
|
||||
std::shared_ptr<WebSocketWrapper> ws = m_connections.value(wsId);
|
||||
@@ -124,7 +124,7 @@ int WebSocketHandler::getExerciseId(int wsId) const
|
||||
|
||||
void WebSocketHandler::onTextMessageReceived(const QByteArray &baJson)
|
||||
{
|
||||
DEBUG_LOG() << "Receive Telegram from SAA <<<<< " << baJson;
|
||||
DEBUG_LOG(m_logger) << "Receive Telegram from SAA <<<<< " << baJson;
|
||||
using namespace TrainingAreaBase::TetraIcd;
|
||||
|
||||
WebSocketWrapper *wsw = qobject_cast<WebSocketWrapper *>(sender());
|
||||
@@ -147,7 +147,7 @@ void WebSocketHandler::onNewConnection()
|
||||
if (!ws)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
DEBUG_LOG(m_logger) << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
auto wsw = std::make_shared<WebSocketWrapper>(ws);
|
||||
int wsId = m_nextWsId;
|
||||
|
||||
@@ -158,7 +158,7 @@ void WebSocketHandler::onNewConnection()
|
||||
wsw->setWsId(wsId);
|
||||
emit newConnection( wsId, ws->peerAddress().toString(),ws->peerPort());
|
||||
m_connections.insert(wsId ,wsw);
|
||||
DEBUG_LOG() << "m_connections.insert"
|
||||
DEBUG_LOG(m_logger) << "m_connections.insert"
|
||||
<< ", wsId :" << wsId;
|
||||
m_nextWsId++;
|
||||
|
||||
@@ -181,10 +181,10 @@ void WebSocketHandler::onWebSocketDisconnected()
|
||||
for (auto it = copy.begin(); it != copy.end(); ++it)
|
||||
{
|
||||
auto wsw = *it;
|
||||
DEBUG_LOG() << "peerPort :" << wsw->webSocket()->peerPort() << ", localPort :" << wsw->webSocket()->localPort();
|
||||
DEBUG_LOG(m_logger) << "peerPort :" << wsw->webSocket()->peerPort() << ", localPort :" << wsw->webSocket()->localPort();
|
||||
if (wsw->webSocket() == ws)
|
||||
{
|
||||
DEBUG_LOG() << it.key() << " Emit Disconnect ------------------------------------- esId=" << it.key();
|
||||
DEBUG_LOG(m_logger) << it.key() << " Emit Disconnect ------------------------------------- esId=" << it.key();
|
||||
emit wsDisconnected(it.key());
|
||||
m_connections.remove(it.key());
|
||||
break;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ bool AesHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
if (!m_ftcAes->enableAirSupportImpactModify())
|
||||
{
|
||||
ERROR_LOG() << "Can not enableAirSupportImpactModify ";
|
||||
ERROR_LOG(m_logger) << "Can not enableAirSupportImpactModify ";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
|
||||
+4
-5
@@ -8,17 +8,16 @@
|
||||
namespace ApHlaJson
|
||||
{
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId) : m_ddsConnector(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
};
|
||||
|
||||
+4
-4
@@ -67,7 +67,7 @@ bool HlaDispatcher::canSendData() const
|
||||
|
||||
void HlaDispatcher::onWebSocketConnected()
|
||||
{
|
||||
INFO_LOG() << "WebSocket connected";
|
||||
INFO_LOG(m_logger) << "WebSocket connected";
|
||||
QWebSocket *ws = qobject_cast<QWebSocket *>(sender());
|
||||
m_sendToHla->onWebSocketConnected(ws);
|
||||
m_webSocketReconnectTimer->stop();
|
||||
@@ -76,7 +76,7 @@ void HlaDispatcher::onWebSocketConnected()
|
||||
|
||||
void HlaDispatcher::onWebsocketDisconnected()
|
||||
{
|
||||
INFO_LOG() << "Hla socket disconnected";
|
||||
INFO_LOG(m_logger) << "Hla socket disconnected";
|
||||
m_sendToHla->onWebSocketDisconnected();
|
||||
|
||||
emit connectionState(QString::fromUtf8(name()), false);
|
||||
@@ -95,7 +95,7 @@ void HlaDispatcher::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;
|
||||
@@ -106,7 +106,7 @@ void HlaDispatcher::onWebSocketError()
|
||||
void HlaDispatcher::onTextMessageReceived(const QByteArray &message)
|
||||
{
|
||||
|
||||
INFO_LOG() << "Text Message received: " << message;
|
||||
INFO_LOG(m_logger) << "Text Message received: " << message;
|
||||
|
||||
m_recvFromHla->handleTelegram(message);
|
||||
}
|
||||
|
||||
+2
@@ -50,8 +50,10 @@ Q_SIGNALS:
|
||||
void broadcastTelegramsRequest(int equipmentNumber, int broadcastIndex, int resetCounter);
|
||||
void hlaTelegramReceived(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QUrl webSocketUrl() const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
std::shared_ptr<HlaHandlerRx> m_recvFromHla;
|
||||
std::shared_ptr<HlaHandlerTx> m_sendToHla;
|
||||
|
||||
+9
-10
@@ -16,15 +16,14 @@ HlaHandlerRx::HlaHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab>
|
||||
const std::shared_ptr<TrainingAreaBase::TxMixin> &sendToTabCb,
|
||||
HlaDispatcher *dispatcher,
|
||||
AesHandler* aesHandler,
|
||||
PpmHandler* ppmHandler)
|
||||
: m_rxHandler(recvFromTabCb)
|
||||
PpmHandler* ppmHandler) : m_rxHandler(recvFromTabCb)
|
||||
, m_txHandler(sendToTabCb)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_bWarnedOnce(false)
|
||||
, m_bWarnedOnceTx(false)
|
||||
, m_aesHandler(aesHandler)
|
||||
, m_ppmHandler(ppmHandler)
|
||||
{}
|
||||
, m_ppmHandler(ppmHandler),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
{
|
||||
@@ -38,12 +37,12 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
if(typeId.toInt() != 21)
|
||||
ERROR_LOG() << "Telegram before filter: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Telegram before filter: " << baJson;
|
||||
try
|
||||
{
|
||||
QJsonValue header = data[QStringLiteral("header")];
|
||||
@@ -57,7 +56,7 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
return false;
|
||||
}
|
||||
if(typeId.toInt() != 21)
|
||||
ERROR_LOG() << "Telegram after filter: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Telegram after filter: " << baJson;
|
||||
switch (typeId.toInt())
|
||||
{
|
||||
case Constraints<ProxyConnectionState>::id():
|
||||
@@ -110,7 +109,7 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -130,7 +129,7 @@ void HlaHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
@@ -146,7 +145,7 @@ void HlaHandlerRx::txData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnceTx)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnceTx = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+2
@@ -31,12 +31,14 @@ public:
|
||||
Q_SIGNALS:
|
||||
void participantConnectionState(int equipmentNumber, bool dataCommunicationPossible);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
template<typename T>
|
||||
void rxData(const T &data);
|
||||
|
||||
template<typename T>
|
||||
void txData(const T &data);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool checkExercise(int equipmentNumber) const;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
|
||||
+2
-2
@@ -296,7 +296,7 @@ bool HlaHandlerTx::txData(const TrainingAreaBase::TetraIcd::SelectiveReammunitio
|
||||
|
||||
void HlaHandlerTx::onParticipantConnectionState(int equipmentNumber, bool dataCommunicationPossible)
|
||||
{
|
||||
INFO_LOG() << "onParticipantConnectionState - " << equipmentNumber
|
||||
INFO_LOG(m_logger) << "onParticipantConnectionState - " << equipmentNumber
|
||||
<< ", communication possible: " << dataCommunicationPossible;
|
||||
if (equipmentNumber == -1)
|
||||
m_dataCommunicationPossible.clear();
|
||||
@@ -308,7 +308,7 @@ void HlaHandlerTx::onGenericTelegram(const QJsonObject &telegram)
|
||||
if (!m_webSocket || !m_bHlaConnectedToExternalSystem)
|
||||
return;
|
||||
const QByteArray ba = QJsonDocument(telegram).toJson(QJsonDocument::Compact);
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
m_webSocket->sendTextMessage(QString::fromUtf8(ba));
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -74,8 +74,10 @@ public slots:
|
||||
void onGenericTelegram(const QJsonObject &telegram);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data, bool bForce = false);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QHash<int, bool> m_dataCommunicationPossible;
|
||||
TrainingAreaBase::Plugin::DataProvider *m_pdp;
|
||||
PpmHandler* m_ppmHandler;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ MainDispatcher::MainDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
|
||||
, m_domainId(pdp->domainId())
|
||||
, m_exerciseId(pdp->exerciseId())
|
||||
{
|
||||
INFO_LOG() << "ApHla started, Domain Id: " << m_domainId << " ExerciseId: " << m_exerciseId;
|
||||
INFO_LOG(m_logger) << "ApHla started, Domain Id: " << m_domainId << " ExerciseId: " << m_exerciseId;
|
||||
}
|
||||
|
||||
MainDispatcher::~MainDispatcher()
|
||||
|
||||
+1
@@ -61,6 +61,7 @@ public:
|
||||
const char *name() const override { return tr_lts("dds", "ApHlaJson"); }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
HlaDispatcher *m_hlaDispatcher;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
|
||||
+1
@@ -61,6 +61,7 @@ public:
|
||||
bool txData(const TrainingAreaBase::TetraIcd::SelectiveReammunition &data) override;
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTxMixin(const T *data);
|
||||
private:
|
||||
|
||||
+5
-6
@@ -10,9 +10,8 @@ namespace ApHlaJson
|
||||
{
|
||||
|
||||
|
||||
PdmHandler::PdmHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
PdmHandler::PdmHandler(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
{
|
||||
@@ -20,7 +19,7 @@ bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
if (!m_dtcPdm->enableChargeType())
|
||||
{
|
||||
ERROR_LOG() << "Can not read data from Pdm";
|
||||
ERROR_LOG(m_logger) << "Can not read data from Pdm";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,7 +35,7 @@ bool PdmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
void PdmHandler::getChargeTypes()
|
||||
{
|
||||
DEBUG_LOG() << "Get Charge Types";
|
||||
DEBUG_LOG(m_logger) << "Get Charge Types";
|
||||
QJsonObject obj;
|
||||
QJsonArray dataArray;
|
||||
obj[QStringLiteral("type")] = QStringLiteral("ApacheHlaSendChargeTypes");
|
||||
@@ -46,7 +45,7 @@ void PdmHandler::getChargeTypes()
|
||||
QMap<qint32, ProjectDataManagement::ChargeType> chargeTypes = m_dtcPdm->chargeTypes();
|
||||
QMap<qint32, ProjectDataManagement::GearType> gearTypes = m_dtcPdm->gearTypes();
|
||||
QMap<qint32, ProjectDataManagement::GearTypeChargeType> gearTypeChargeTypes = m_dtcPdm->gearTypeChargeTypes();
|
||||
DEBUG_LOG() << "Fetched " << chargeTypes.size() << " ChargeTypes to send to WebSocket. Ommiting those without DIS-Entity though.";
|
||||
DEBUG_LOG(m_logger) << "Fetched " << chargeTypes.size() << " ChargeTypes to send to WebSocket. Ommiting those without DIS-Entity though.";
|
||||
|
||||
for(const ProjectDataManagement::ChargeType &charge : chargeTypes)
|
||||
{
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ public slots:
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
};
|
||||
|
||||
|
||||
+3
-4
@@ -11,9 +11,8 @@ namespace ApHlaJson
|
||||
|
||||
|
||||
|
||||
PpmHandler::PpmHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
PpmHandler::PpmHandler(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool PpmHandler::init(MainDispatcher* mainDispatcher)
|
||||
{
|
||||
@@ -24,7 +23,7 @@ bool PpmHandler::init(MainDispatcher* mainDispatcher)
|
||||
|
||||
if (!m_dtcPpm->enableParticipant() || !m_dtcPpm->enableDynamicParticipantData() || !m_dtcPpm->enableParticipantPosition())
|
||||
{
|
||||
ERROR_LOG() << "Can not read data from Ppm";
|
||||
ERROR_LOG(m_logger) << "Can not read data from Ppm";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ private slots:
|
||||
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
QHash<int, int> m_participantIdsByEqNo;
|
||||
};
|
||||
|
||||
+2
@@ -63,6 +63,8 @@ public:
|
||||
bool txData(const TrainingAreaBase::TetraIcd::ExConfirmationReport &data) override;
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTx(const T *data);
|
||||
protected:
|
||||
|
||||
+9
-10
@@ -19,12 +19,11 @@ namespace TetraRadio
|
||||
|
||||
|
||||
|
||||
DirectoryCleaner::DirectoryCleaner(const QString &directory, unsigned int maxAgeSec, QObject *parent)
|
||||
: QObject(parent)
|
||||
DirectoryCleaner::DirectoryCleaner(const QString &directory, unsigned int maxAgeSec, QObject *parent) : QObject(parent)
|
||||
, m_cleanerThread(new QThread(this))
|
||||
, m_worker(new DirectoryCleanerWorker(directory, maxAgeSec))
|
||||
.getNGLLogger("TAB.Plugin.DirectoryCleaner"))
|
||||
{
|
||||
.getNGLLogger("TAB.Plugin.DirectoryCleaner")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
QDir().mkpath(directory);
|
||||
doInitialCleanup(directory);
|
||||
m_worker->moveToThread(m_cleanerThread);
|
||||
@@ -44,7 +43,7 @@ void DirectoryCleaner::doInitialCleanup(const QString &directory)
|
||||
QDir d(directory);
|
||||
if (!d.exists())
|
||||
{
|
||||
WARNING_LOG() << "Directory " << directory
|
||||
WARNING_LOG(m_logger) << "Directory " << directory
|
||||
<< " does not exist - can not cleanup directory";
|
||||
return;
|
||||
}
|
||||
@@ -113,7 +112,7 @@ void DirectoryCleanerWorker::doCleanup()
|
||||
if (!d.exists())
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
WARNING_LOG() << "Directory " << m_directory
|
||||
WARNING_LOG(m_logger) << "Directory " << m_directory
|
||||
<< " does not exist - can not cleanup directory";
|
||||
m_bWarnedOnce = true;
|
||||
return;
|
||||
@@ -127,12 +126,12 @@ void DirectoryCleanerWorker::doCleanup()
|
||||
const QString filename(it.fileName());
|
||||
bool bOk = false;
|
||||
qint64 timestampUSec = filename.toLongLong(&bOk);
|
||||
TRACE_LOG() << "File: " << filename
|
||||
TRACE_LOG(m_logger) << "File: " << filename
|
||||
<< " timestamp: " << timestampUSec
|
||||
<< " remove time: " << tRemoveTimeMSec * 1000;
|
||||
if (!bOk)
|
||||
{
|
||||
WARNING_LOG() << "Found file with name '" << filepath
|
||||
WARNING_LOG(m_logger) << "Found file with name '" << filepath
|
||||
<< " which is not a valid xdr filename"
|
||||
<< " - removing this file when mtime older than "
|
||||
<< m_maxAgeSec << "seconds";
|
||||
@@ -146,9 +145,9 @@ void DirectoryCleanerWorker::doCleanup()
|
||||
if (timestampMSec < tRemoveTimeMSec)
|
||||
{
|
||||
if (!QFile::remove(filepath))
|
||||
WARNING_LOG() << "Could not remove " << filepath;
|
||||
WARNING_LOG(m_logger) << "Could not remove " << filepath;
|
||||
else
|
||||
TRACE_LOG() << "Removed " << filepath;
|
||||
TRACE_LOG(m_logger) << "Removed " << filepath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -19,6 +19,7 @@ public:
|
||||
private:
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void doInitialCleanup(const QString &directory);
|
||||
bool teleShouldBeRemoved(int teleId);
|
||||
QThread *m_cleanerThread;
|
||||
@@ -34,8 +35,10 @@ public:
|
||||
public Q_SLOTS:
|
||||
void onTimeout();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void doCleanup();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QString m_directory;
|
||||
qint64 m_maxAgeSec;
|
||||
bool m_bWarnedOnce;
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ void HlaDispatcher::onHlaConnected()
|
||||
|
||||
void HlaDispatcher::onHlaDisconnected()
|
||||
{
|
||||
INFO_LOG() << "Hla socket disconnected";
|
||||
INFO_LOG(m_logger) << "Hla socket disconnected";
|
||||
m_webSocketReconnectTimer->start(5000);
|
||||
m_sendToHla->onHlaDisconnected();
|
||||
|
||||
@@ -85,7 +85,7 @@ void HlaDispatcher::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;
|
||||
|
||||
+2
@@ -41,8 +41,10 @@ Q_SIGNALS:
|
||||
void broadcastTelegramsRequest(int equipmentNumber, int broadcastIndex, int resetCounter);
|
||||
void wlsTelegramReceived(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QUrl webSocketUrl() const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
std::shared_ptr<HlaHandlerRx> m_recvFromHla;
|
||||
std::shared_ptr<HlaHandlerTx> m_sendToHla;
|
||||
|
||||
+7
-8
@@ -11,11 +11,10 @@ namespace HlaJson
|
||||
{
|
||||
|
||||
HlaHandlerRx::HlaHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
||||
HlaDispatcher *dispatcher)
|
||||
: m_rxHandler(recvFromTabCb)
|
||||
HlaDispatcher *dispatcher) : m_rxHandler(recvFromTabCb)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_bWarnedOnce(false)
|
||||
{}
|
||||
, m_bWarnedOnce(false),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
{
|
||||
@@ -24,7 +23,7 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
if (baJson.isEmpty())
|
||||
return false;
|
||||
const QJsonObject obj = QJsonDocument::fromJson(baJson).object();
|
||||
TRACE_LOG() << "incoming telegram: " << baJson;
|
||||
TRACE_LOG(m_logger) << "incoming telegram: " << baJson;
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +38,7 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
@@ -125,7 +124,7 @@ bool HlaHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -138,7 +137,7 @@ void HlaHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+2
@@ -24,9 +24,11 @@ public:
|
||||
Q_SIGNALS:
|
||||
void participantConnectionState(int equipmentNumber, bool dataCommunicationPossible);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
template<typename T>
|
||||
void rxData(const T &data);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
HlaDispatcher *m_dispatcher;
|
||||
bool m_bWarnedOnce;
|
||||
|
||||
+2
-2
@@ -295,7 +295,7 @@ bool HlaHandlerTx::txData(const TrainingAreaBase::TetraIcd::OcCommand &data)
|
||||
|
||||
void HlaHandlerTx::onParticipantConnectionState(int equipmentNumber, bool dataCommunicationPossible)
|
||||
{
|
||||
INFO_LOG() << "onParticipantConnectionState - " << equipmentNumber
|
||||
INFO_LOG(m_logger) << "onParticipantConnectionState - " << equipmentNumber
|
||||
<< ", communication possible: " << dataCommunicationPossible;
|
||||
if (equipmentNumber == -1)
|
||||
m_dataCommunicationPossible.clear();
|
||||
@@ -314,7 +314,7 @@ bool HlaHandlerTx::sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegr
|
||||
|
||||
const QByteArray ba = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
if (data->id() != TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
m_webSocket->sendTextMessage(QString::fromUtf8(ba));
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
@@ -73,8 +73,10 @@ public:
|
||||
public Q_SLOTS:
|
||||
void onParticipantConnectionState(int equipmentNumber, bool dataCommunicationPossible);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data, bool bForce = false);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QHash<int, bool> m_dataCommunicationPossible;
|
||||
TrainingAreaBase::Plugin::DataProvider *m_pdp;
|
||||
QWebSocket *m_webSocket;
|
||||
|
||||
+2
@@ -31,6 +31,8 @@ public:
|
||||
const char *name() const override { return tr_lts("dds", "HlaJson"); }
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
HlaDispatcher *m_wlsDispatcher;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ public:
|
||||
bool txData(const TrainingAreaBase::TetraIcd::ExConfirmationReport &) override { return false; };
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTxMixin(const T *data);
|
||||
private:
|
||||
|
||||
+2
@@ -31,6 +31,8 @@ public:
|
||||
const char *name() const override { return tr_lts("dds", "Nme"); }
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
NmeaDispatcher *m_tetraDispatcher;
|
||||
NGL::Settings *m_settings;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ public:
|
||||
bool txData(const TrainingAreaBase::TetraIcd::SetDevicePowerRequest &data) override;
|
||||
bool txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTxMixin(const T *data);
|
||||
private:
|
||||
|
||||
+12
-12
@@ -29,7 +29,7 @@ NmeaDispatcher::NmeaDispatcher(TrainingAreaBase::Plugin::DataProvider *pdp,
|
||||
m_nmeaHost = getNmeaHost();
|
||||
m_nmeaPort = getNmeaPort();
|
||||
|
||||
DEBUG_LOG() << "Host: " << m_nmeaHost << " Port: " << m_nmeaPort;
|
||||
DEBUG_LOG(m_logger) << "Host: " << m_nmeaHost << " Port: " << m_nmeaPort;
|
||||
m_socket = new QUdpSocket(this);
|
||||
connect(m_socket, &QUdpSocket::connected, this, &NmeaDispatcher::connected);
|
||||
connect(m_socket, &QUdpSocket::disconnected, this, &NmeaDispatcher::disconnected);
|
||||
@@ -59,12 +59,12 @@ void NmeaDispatcher::exerciseChanged()
|
||||
|
||||
void NmeaDispatcher::reconnect()
|
||||
{
|
||||
INFO_LOG() << "Connecting,.." << " host = " << m_nmeaHost
|
||||
INFO_LOG(m_logger) << "Connecting,.." << " host = " << m_nmeaHost
|
||||
<< " port = " << m_nmeaPort;;
|
||||
|
||||
if(!m_socket->bind(m_nmeaPort, QAbstractSocket::BindFlag::ShareAddress | QAbstractSocket::BindFlag::ReuseAddressHint))
|
||||
{
|
||||
ERROR_LOG() << "Error from Socket: " << m_socket->errorString();
|
||||
ERROR_LOG(m_logger) << "Error from Socket: " << m_socket->errorString();
|
||||
m_reconnectTimer->start(10000);
|
||||
}
|
||||
else
|
||||
@@ -77,25 +77,25 @@ void NmeaDispatcher::connected()
|
||||
{
|
||||
m_reconnectTimer->stop();
|
||||
m_txHandler->onUdpSocketConnected(m_socket, m_nmeaPort, m_nmeaHost);
|
||||
DEBUG_LOG() << "Connected!";
|
||||
DEBUG_LOG(m_logger) << "Connected!";
|
||||
}
|
||||
|
||||
|
||||
void NmeaDispatcher::disconnected()
|
||||
{
|
||||
m_reconnectTimer->start();
|
||||
DEBUG_LOG() << "Disconnected!";
|
||||
DEBUG_LOG(m_logger) << "Disconnected!";
|
||||
}
|
||||
|
||||
void NmeaDispatcher::bytesWritten(qint64 bytes)
|
||||
{
|
||||
DEBUG_LOG() << "We wrote: " << bytes;
|
||||
DEBUG_LOG(m_logger) << "We wrote: " << bytes;
|
||||
}
|
||||
|
||||
void NmeaDispatcher::reconnectTimerSlot()
|
||||
{
|
||||
m_reconnectTimer->stop();
|
||||
INFO_LOG() << "Reconnect NMEA-Socket "
|
||||
INFO_LOG(m_logger) << "Reconnect NMEA-Socket "
|
||||
<< " host = " << m_nmeaHost
|
||||
<< " port = " << m_nmeaPort;
|
||||
reconnect();
|
||||
@@ -104,7 +104,7 @@ void NmeaDispatcher::reconnectTimerSlot()
|
||||
|
||||
void NmeaDispatcher::readyRead()
|
||||
{
|
||||
DEBUG_LOG() << "Reading...";
|
||||
DEBUG_LOG(m_logger) << "Reading...";
|
||||
|
||||
|
||||
QByteArray ba;
|
||||
@@ -114,18 +114,18 @@ void NmeaDispatcher::readyRead()
|
||||
|
||||
ba.resize(int(m_socket->pendingDatagramSize()));
|
||||
m_socket->readDatagram(ba.data(), ba.size());
|
||||
INFO_LOG() << ba;
|
||||
INFO_LOG(m_logger) << ba;
|
||||
QByteArray nmeaDataBa = ba;
|
||||
std::string nmeaDataStd = nmeaDataBa.toStdString() ;
|
||||
QString nmeaData = QString::fromLocal8Bit(nmeaDataStd.c_str());
|
||||
|
||||
|
||||
DEBUG_LOG() << "nmeaDecoder :" << nmeaData;
|
||||
DEBUG_LOG(m_logger) << "nmeaDecoder :" << nmeaData;
|
||||
|
||||
m_rxHandler->handleTelegram(nmeaData);
|
||||
|
||||
DEBUG_LOG() << "NMEA-Data=" << nmeaData;
|
||||
DEBUG_LOG() << "NMEA-Data ba=" << ba;
|
||||
DEBUG_LOG(m_logger) << "NMEA-Data=" << nmeaData;
|
||||
DEBUG_LOG(m_logger) << "NMEA-Data ba=" << ba;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -42,10 +42,12 @@ private slots:
|
||||
void readyRead();
|
||||
void reconnectTimerSlot();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void reconnect();
|
||||
QString getNmeaHost();
|
||||
int getNmeaPort();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<NmeaHandlerRx> m_rxHandler;
|
||||
std::shared_ptr<NmeaHandlerTx> m_txHandler;
|
||||
TrainingAreaBase::Plugin::DataProvider *m_dataProvider;
|
||||
|
||||
+22
-23
@@ -11,10 +11,9 @@
|
||||
namespace Nmea
|
||||
{
|
||||
|
||||
NmeaHandlerRx::NmeaHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &rxHandler)
|
||||
: m_rxHandler(rxHandler)
|
||||
, m_bWarnedOnce(false)
|
||||
{
|
||||
NmeaHandlerRx::NmeaHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &rxHandler) : m_rxHandler(rxHandler)
|
||||
, m_bWarnedOnce(false),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +47,7 @@ void NmeaHandlerRx::decode(QString nmeaPackage)
|
||||
nmeaPackage.remove(0, startingPoint);
|
||||
|
||||
nmeaType = nmeaPackage.mid(1, 5);
|
||||
INFO_LOG() << "nmeaType=" << nmeaType;
|
||||
INFO_LOG(m_logger) << "nmeaType=" << nmeaType;
|
||||
|
||||
if (nmeaType == QStringLiteral("IIXDR"))
|
||||
{
|
||||
@@ -57,10 +56,10 @@ void NmeaHandlerRx::decode(QString nmeaPackage)
|
||||
|
||||
if (nmeaType == QStringLiteral("GPGGA"))
|
||||
{
|
||||
INFO_LOG() << "Eigenposition";
|
||||
INFO_LOG(m_logger) << "Eigenposition";
|
||||
if (checksum(nmeaPackage))
|
||||
{
|
||||
INFO_LOG() << "Eigenposition checksum ok";
|
||||
INFO_LOG(m_logger) << "Eigenposition checksum ok";
|
||||
GPGGA(nmeaPackage);
|
||||
}
|
||||
}
|
||||
@@ -132,29 +131,29 @@ void NmeaHandlerRx::IIXDR(const QString &package)
|
||||
ServiceControl serviceControl;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
INFO_LOG() << "----------------------------------------------------";
|
||||
INFO_LOG() << "batteryState pkt_data.size=" << pkt_data.size();
|
||||
INFO_LOG(m_logger) << "----------------------------------------------------";
|
||||
INFO_LOG(m_logger) << "batteryState pkt_data.size=" << pkt_data.size();
|
||||
for (int i = 0; i < pkt_data.size(); i++)
|
||||
INFO_LOG() << "i=" << i << "Value=" << pkt_data[i];
|
||||
INFO_LOG(m_logger) << "i=" << i << "Value=" << pkt_data[i];
|
||||
|
||||
|
||||
int index = pkt_data.indexOf(QLatin1String("S")) + 1;
|
||||
if ( index >= 1)
|
||||
{
|
||||
INFO_LOG() << "Ausschalten!!!";
|
||||
INFO_LOG(m_logger) << "Ausschalten!!!";
|
||||
if (pkt_data[4] == QStringLiteral("SERVICE_CONTROL_PRESHUTDOWN"))
|
||||
{
|
||||
INFO_LOG() << "SERVICE_CONTROL_PRESHUTDOWN";
|
||||
INFO_LOG(m_logger) << "SERVICE_CONTROL_PRESHUTDOWN";
|
||||
serviceControl.serviceControlState = ServiceControlEnum::PRESHUTDOWN;
|
||||
}
|
||||
if (pkt_data[4] == QStringLiteral("SERVICE_CONTROL_SHUTDOWN"))
|
||||
{
|
||||
INFO_LOG() << "SERVICE_CONTROL_SHUTDOWN";
|
||||
INFO_LOG(m_logger) << "SERVICE_CONTROL_SHUTDOWN";
|
||||
serviceControl.serviceControlState = ServiceControlEnum::SHUTDOWN;
|
||||
}
|
||||
if (pkt_data[4] == QStringLiteral("SERVICE_CONTROL_STOP"))
|
||||
{
|
||||
INFO_LOG() << "SERVICE_CONTROL_STOP";
|
||||
INFO_LOG(m_logger) << "SERVICE_CONTROL_STOP";
|
||||
serviceControl.serviceControlState = ServiceControlEnum::STOP;
|
||||
}
|
||||
serviceControl.header.equipmentNumber = 1;
|
||||
@@ -229,7 +228,7 @@ void NmeaHandlerRx::IIXDR(const QString &package)
|
||||
batteryState.voltage = voltage;
|
||||
|
||||
batteryState.serialNumber = serialNumber;
|
||||
INFO_LOG() << "publish batteryState serialNumber=" << serialNumber;
|
||||
INFO_LOG(m_logger) << "publish batteryState serialNumber=" << serialNumber;
|
||||
batteryInfo.batteryStates = {batteryState};
|
||||
batteryInfo.header.equipmentNumber = 1;
|
||||
batteryInfo.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -243,7 +242,7 @@ void NmeaHandlerRx::IIALR(const QString &package)
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
alarm_state packageData;
|
||||
INFO_LOG() << "pkt_data.size=" << pkt_data.size();
|
||||
INFO_LOG(m_logger) << "pkt_data.size=" << pkt_data.size();
|
||||
|
||||
|
||||
|
||||
@@ -262,7 +261,7 @@ void NmeaHandlerRx::IIALR(const QString &package)
|
||||
|
||||
qint64 timeAlarm = getDateTime(packageData.time);
|
||||
|
||||
INFO_LOG() << "time=" << packageData.time
|
||||
INFO_LOG(m_logger) << "time=" << packageData.time
|
||||
<< " timeAlarm=" << timeAlarm
|
||||
<< " number=" << packageData.number
|
||||
<< " condition=" << packageData.condition
|
||||
@@ -339,9 +338,9 @@ void NmeaHandlerRx::GPGGA(const QString &package)
|
||||
lonDeg *= -1;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "RAW Nmea Position: " << packageData.D_longitude << " | " << packageData.B_latitude;
|
||||
DEBUG_LOG() << "Lat: " << latDeg;
|
||||
DEBUG_LOG() << "Lon: " << lonDeg;
|
||||
DEBUG_LOG(m_logger) << "RAW Nmea Position: " << packageData.D_longitude << " | " << packageData.B_latitude;
|
||||
DEBUG_LOG(m_logger) << "Lat: " << latDeg;
|
||||
DEBUG_LOG(m_logger) << "Lon: " << lonDeg;
|
||||
|
||||
PositionExcon.geoPosition.lat = latDeg * M_PI / 180.0;
|
||||
PositionExcon.geoPosition.lon = lonDeg * M_PI / 180.0;
|
||||
@@ -371,7 +370,7 @@ void NmeaHandlerRx::GPRMC(const QString &package)
|
||||
packageData.K_variacao_magnetica_coord = pkt_data[11].toStdString()[0];
|
||||
|
||||
|
||||
INFO_LOG() << "velocidade=" << QString::number(packageData.G_velocity * 1.852);
|
||||
INFO_LOG(m_logger) << "velocidade=" << QString::number(packageData.G_velocity * 1.852);
|
||||
|
||||
}
|
||||
|
||||
@@ -404,7 +403,7 @@ void NmeaHandlerRx::sendTestMessages()
|
||||
batteryState.generic = 1;
|
||||
batteryState.serialNumber = QStringLiteral("Test");
|
||||
batteryState.temperature = 38.8;
|
||||
DEBUG_LOG() << "Send BatteryInfo Message";
|
||||
DEBUG_LOG(m_logger) << "Send BatteryInfo Message";
|
||||
batteryInfo.batteryStates = {batteryState};
|
||||
batteryInfo.header.equipmentNumber = 1;
|
||||
batteryInfo.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -419,7 +418,7 @@ void NmeaHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+1
@@ -123,6 +123,7 @@ private:
|
||||
qint64 getDateTime(QString receivedTimeStr);
|
||||
QStringList m_batteries;
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
bool m_bWarnedOnce;
|
||||
};
|
||||
|
||||
+2
@@ -69,6 +69,8 @@ signals:
|
||||
void outgoingMessage(const QByteArray &msg);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
QUdpSocket *m_udpSocket;
|
||||
QString m_nmeaHost;
|
||||
int m_nmeaPort;
|
||||
|
||||
+8
-9
@@ -11,11 +11,10 @@ namespace TetraRadio
|
||||
{
|
||||
|
||||
ConvertFromJson::ConvertFromJson(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &rxHandler,
|
||||
const char *loggerName)
|
||||
: m_rxHandler(rxHandler)
|
||||
const char *loggerName) : m_rxHandler(rxHandler)
|
||||
, m_bWarnedOnce(false)
|
||||
.getNGLLogger(loggerName))
|
||||
{}
|
||||
.getNGLLogger(loggerName)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool ConvertFromJson::handleTelegram(const QByteArray &baJson, int &recvCounter)
|
||||
{
|
||||
@@ -30,14 +29,14 @@ bool ConvertFromJson::handleTelegram(const QByteArray &baJson, int &recvCounter)
|
||||
if (!sendCounter.isDouble())
|
||||
return false;
|
||||
recvCounter = sendCounter.toInt(-1);
|
||||
DEBUG_LOG() << "Incoming telegram with Id " << obj.value(QStringLiteral("type")).toString();
|
||||
DEBUG_LOG(m_logger) << "Incoming telegram with Id " << obj.value(QStringLiteral("type")).toString();
|
||||
if (recvCounter < 0)
|
||||
return false;
|
||||
}
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
@@ -163,14 +162,14 @@ bool ConvertFromJson::handleTelegram(const QByteArray &baJson, int &recvCounter)
|
||||
|
||||
break;
|
||||
default:
|
||||
WARNING_LOG() << "Handler for telegram Id " << typeId.toInt()
|
||||
WARNING_LOG(m_logger) << "Handler for telegram Id " << typeId.toInt()
|
||||
<< " not yet implemented (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -183,7 +182,7 @@ void ConvertFromJson::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+2
@@ -16,6 +16,7 @@ public:
|
||||
virtual ~ConvertFromJson() = default;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool handleTelegram(const QByteArray &baJson, int &recvCounter);
|
||||
virtual void handleAcknowledge(qint64 timeStamp, int counter) = 0;
|
||||
virtual void handleTetraConnectionChanged(bool bConnected) = 0;
|
||||
@@ -28,6 +29,7 @@ private:
|
||||
static TrainingAreaBase::TetraIcd::BiteError convertBiteError(const QJsonObject &obj);
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_bWarnedOnce;
|
||||
};
|
||||
|
||||
|
||||
+3
-3
@@ -240,7 +240,7 @@ bool ConvertToJson::txData(const TrainingAreaBase::TetraIcd::Sanitation &data)
|
||||
|
||||
bool ConvertToJson::txData(const TrainingAreaBase::TetraIcd::SelectiveReammunition &data)
|
||||
{
|
||||
DEBUG_LOG() << "ConvertToJson::txData SelectiveReammunition";
|
||||
DEBUG_LOG(m_logger) << "ConvertToJson::txData SelectiveReammunition";
|
||||
return sendToTx(&data);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ bool ConvertToJson::txData(const TrainingAreaBase::TetraIcd::SetDevicePowerReque
|
||||
|
||||
bool ConvertToJson::txData(const TrainingAreaBase::TetraIcd::OcCommand &data)
|
||||
{
|
||||
DEBUG_LOG() << "ConvertToJson::txData OcCommand";
|
||||
DEBUG_LOG(m_logger) << "ConvertToJson::txData OcCommand";
|
||||
return sendToTx(&data);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ bool ConvertToJson::sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTeleg
|
||||
obj[QStringLiteral("counter")] = m_sendCounter++;
|
||||
const QByteArray ba = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
if (data->id() != TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
emit outgoingMessage(ba);
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
@@ -72,7 +72,9 @@ public:
|
||||
Q_SIGNALS:
|
||||
void outgoingMessage(const QByteArray &msg);
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_sendCounter;
|
||||
bool m_bConnected;
|
||||
};
|
||||
|
||||
+7
-7
@@ -45,7 +45,7 @@ TetraJsonInterfaceImpl::TetraJsonInterfaceImpl(TrainingAreaBase::Plugin::DataPro
|
||||
settings->settings()->value(QLatin1String("AES/use2BytesForSingleFireDiameter"), true).toBool());
|
||||
N_CoPrtCnv::CoPrtCnvTelegramConverter::setUsePvSan(
|
||||
settings->settings()->value(QLatin1String("TrainingAreaBase/UsePvSan"), false).toBool());
|
||||
ERROR_LOG() << "hello i got this!";
|
||||
ERROR_LOG(m_logger) << "hello i got this!";
|
||||
}
|
||||
|
||||
TetraJsonInterfaceImpl::~TetraJsonInterfaceImpl()
|
||||
@@ -70,7 +70,7 @@ void TetraJsonInterfaceImpl::exerciseChanged()
|
||||
NOTICE_LOG(m_logger) << "TetraJsonInterfaceImpl::exerciseChanged";
|
||||
if (m_pdp->exerciseRadioGroup().id() != m_radioGrpId)
|
||||
if (!updatePrtCnv())
|
||||
ERROR_LOG() << "Error changing PrtCnv state from radio grp id: "
|
||||
ERROR_LOG(m_logger) << "Error changing PrtCnv state from radio grp id: "
|
||||
<< m_radioGrpId
|
||||
<< " to " << m_pdp->exerciseRadioGroup().id();
|
||||
}
|
||||
@@ -92,7 +92,7 @@ bool TetraJsonInterfaceImpl::updatePrtCnv()
|
||||
QFile::remove(iniFileOut());
|
||||
if (!QFile::copy(iniFileIn(), iniFileOut()))
|
||||
{
|
||||
ERROR_LOG() << "Error creating ini file for PrtCnv: " << iniFileOut();
|
||||
ERROR_LOG(m_logger) << "Error creating ini file for PrtCnv: " << iniFileOut();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -133,10 +133,10 @@ bool TetraJsonInterfaceImpl::checkConfigTemplates()
|
||||
{
|
||||
if (!QFile::exists(iniFileIn()))
|
||||
{
|
||||
INFO_LOG() << "Creating " << iniFileIn();
|
||||
INFO_LOG(m_logger) << "Creating " << iniFileIn();
|
||||
if (!QFile::copy(QStringLiteral(":/PrtCnv.dat"), iniFileIn()))
|
||||
{
|
||||
ERROR_LOG() << "Error creating " << iniFileIn();
|
||||
ERROR_LOG(m_logger) << "Error creating " << iniFileIn();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -145,10 +145,10 @@ bool TetraJsonInterfaceImpl::checkConfigTemplates()
|
||||
|
||||
if (!QFile::exists(playerIdsFile()))
|
||||
{
|
||||
INFO_LOG() << "Creating " << playerIdsFile();
|
||||
INFO_LOG(m_logger) << "Creating " << playerIdsFile();
|
||||
if (!QFile::copy(QStringLiteral(":/playerIds.dat"), playerIdsFile()))
|
||||
{
|
||||
ERROR_LOG() << "Error creating " << playerIdsFile();
|
||||
ERROR_LOG(m_logger) << "Error creating " << playerIdsFile();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
private Q_SLOTS:
|
||||
void onTetraConnectionChanged(bool bConnected);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void cleanupProcess();
|
||||
static QString iniFileIn();
|
||||
QString iniFileOut() const;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ void Dispatcher::ReportCBitStatus(const std::string &KeyId, const M_BuiltInTest:
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportCBitStatus(const std::string &KeyId, const M_BuiltInTest::BitStatusType &status, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -37,23 +37,23 @@ Dispatcher::Dispatcher()
|
||||
|
||||
void Dispatcher::ReportDeviceStatus(M_Device::DeviceStatusType const& status, bool IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "start";
|
||||
DEBUG_LOG(m_logger) << "start";
|
||||
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.OperationStatus.Mode.empty())
|
||||
{
|
||||
DEBUG_LOG() << "no mode!";
|
||||
DEBUG_LOG(m_logger) << "no mode!";
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.OperationStatus.Mode.front().EnumeratedValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "no enum value in mode!";
|
||||
DEBUG_LOG(m_logger) << "no enum value in mode!";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void Dispatcher::ReportDeviceStatus(M_Device::DeviceStatusType const& status, bo
|
||||
Message msg;
|
||||
msg.Status = operationModeStateKindFromTms(val);
|
||||
|
||||
DEBUG_LOG() << "dispatch!";
|
||||
DEBUG_LOG(m_logger) << "dispatch!";
|
||||
|
||||
dispatch(msg);
|
||||
}
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportDeviceStatus(M_Device::DeviceStatusType const& status, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -47,19 +47,19 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (MissionStatus.CurrentAction.CurrentTask.EnumeratedValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
DEBUG_LOG(m_logger) << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MissionStatus.CurrentAction.CurrentTask.TextualValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "text: " << QString::fromStdString(MissionStatus.CurrentAction.CurrentTask.TextualValue.front());
|
||||
DEBUG_LOG(m_logger) << "text: " << QString::fromStdString(MissionStatus.CurrentAction.CurrentTask.TextualValue.front());
|
||||
}
|
||||
const Task currentTask = taskFromTms(MissionStatus.CurrentAction.CurrentTask.EnumeratedValue.front());
|
||||
|
||||
@@ -81,7 +81,7 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
}
|
||||
|
||||
std::string missionName = MissionStatus.CurrentMissionName;
|
||||
DEBUG_LOG() << "missionName before: " << missionName;
|
||||
DEBUG_LOG(m_logger) << "missionName before: " << missionName;
|
||||
if (missionName.empty())
|
||||
{
|
||||
for (const auto &additionalInfo : std::as_const(MissionStatus.CurrentAction.CurrentTask.AdditionalInfo))
|
||||
@@ -93,7 +93,7 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG() << "missionName after: " << missionName;
|
||||
DEBUG_LOG(m_logger) << "missionName after: " << missionName;
|
||||
|
||||
dispatch({ missionName, currentTask, currentlyAllowedTasks, {} });
|
||||
}
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportMissionStatus(M_MissionCtrl::MissionStatusType const& MissionStatus, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@ Dispatcher::Dispatcher()
|
||||
|
||||
void Dispatcher::ReportPoint(const M_Common::ObjectIdType &KeyId, const M_ObjectManager::PointObjectType &, bool IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "start";
|
||||
DEBUG_LOG(m_logger) << "start";
|
||||
|
||||
Message msg;
|
||||
|
||||
@@ -25,13 +25,13 @@ void Dispatcher::ReportPoint(const M_Common::ObjectIdType &KeyId, const M_Object
|
||||
msg.uasId = std::stoi(KeyId);
|
||||
}catch(...)
|
||||
{
|
||||
ERROR_LOG() << "KeyId not an int !";
|
||||
ERROR_LOG(m_logger) << "KeyId not an int !";
|
||||
return;
|
||||
}
|
||||
|
||||
msg.isRemoved = IsRemoved;
|
||||
|
||||
DEBUG_LOG() << "dispatch!";
|
||||
DEBUG_LOG(m_logger) << "dispatch!";
|
||||
|
||||
dispatch(msg);
|
||||
}
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportPoint(const M_Common::ObjectIdType &KeyId, const M_ObjectManager::PointObjectType &Obj, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,14 +19,14 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (KeyId != "UTM_GLOBAL_POSITION" && KeyId != "CURRENT_AIRFRAME_RAW" && KeyId != "CURRENT_AIRFRAME")
|
||||
{
|
||||
DEBUG_LOG() << "KeyId unwanted (is '" << QString::fromStdString(KeyId) << "')";
|
||||
DEBUG_LOG(m_logger) << "KeyId unwanted (is '" << QString::fromStdString(KeyId) << "')";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (PositionList.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (pos.Ellipsoidal.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList.Ellipsoidal is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList.Ellipsoidal is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (elip.Altitude.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList.Ellipsoidal.Altitude is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList.Ellipsoidal.Altitude is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (pos.Timestamp.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList[0].Timestamp is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList[0].Timestamp is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportPositions(const std::string &KeyId, const M_Common::PositionListType &PositionList, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,13 +34,13 @@ void Dispatcher::ReportRadioConnectionStatus(const std::string &, const M_Teleop
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (RadioConnectionStatus.LinkConnectionState == M_Teleoperation::RadioLinkConnectionState::Undefined)
|
||||
{
|
||||
DEBUG_LOG() << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
DEBUG_LOG(m_logger) << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportRadioConnectionStatus(std::string const& KeyId, M_Teleoperation::RadioConnectionStatusType const& RadioConnectionStatus, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -67,7 +67,7 @@ public:
|
||||
, m_reader(m_master.dispatcher())
|
||||
, m_writer(m_master.client())
|
||||
{
|
||||
ERROR_LOG() << "ctor";
|
||||
ERROR_LOG(m_logger) << "ctor";
|
||||
|
||||
connect(m_reader.readerSignal(), &ReaderSignal::dataReady, this, &InterfaceAdapterInitializer::updatePoint);
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
{
|
||||
if (m_activeUas.empty())
|
||||
{
|
||||
ERROR_LOG() << "trying to stop active uas - DONE!";
|
||||
ERROR_LOG(m_logger) << "trying to stop active uas - DONE!";
|
||||
|
||||
t->stop();
|
||||
m_parent->setReady();
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
ERROR_LOG() << "trying to stop active uas:" << m_activeUas.size();
|
||||
ERROR_LOG(m_logger) << "trying to stop active uas:" << m_activeUas.size();
|
||||
|
||||
for (const int activeUas : m_activeUas)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
TmsIfAdapterImpl::TmsIfAdapterImpl()
|
||||
: m_iai(new InterfaceAdapterInitializer(this))
|
||||
{
|
||||
ERROR_LOG() << "TmsIfAdapter running!";
|
||||
ERROR_LOG(m_logger) << "TmsIfAdapter running!";
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ TmsIfAdapterImpl::~TmsIfAdapterImpl()
|
||||
{
|
||||
delete m_iai;
|
||||
delete m_guard;
|
||||
ERROR_LOG() << "!!! TmsIfAdapterImpl DTOR!";
|
||||
ERROR_LOG(m_logger) << "!!! TmsIfAdapterImpl DTOR!";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+60
-61
@@ -15,9 +15,8 @@ using namespace LtsUtils;
|
||||
|
||||
namespace UAS
|
||||
{
|
||||
Resolver::Resolver(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
Resolver::Resolver(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(this, &Resolver::resolve, this, &QObject::deleteLater);
|
||||
connect(this, &Resolver::reject, this, [this](){deleteLater();});
|
||||
}
|
||||
@@ -33,7 +32,7 @@ UAVCommanderImpl::UAVCommanderImpl(int domainId, int uasId, QObject *parent)
|
||||
, m_Device(std::string("UAV_Device_") + std::to_string(uasId), domainId)
|
||||
, m_CoordinateFrame(std::string("UAV_CoordinateFrame_") + std::to_string(uasId), domainId)
|
||||
{
|
||||
ERROR_LOG() << "ctor: " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "ctor: " << (quintptr)this;
|
||||
|
||||
connect(m_MissionCtrl.reader.readerSignal(), &ReaderSignal::dataReady, this, &UAVCommanderImpl::updateMissionStatus);
|
||||
connect(m_TeleOperation.reader.readerSignal(), &ReaderSignal::dataReady, this, &UAVCommanderImpl::updateOperationalState);
|
||||
@@ -81,7 +80,7 @@ UAVCommanderImpl::MissionCtrlContainer::MissionCtrlContainer(const std::string &
|
||||
|
||||
UAVCommanderImpl::~UAVCommanderImpl()
|
||||
{
|
||||
ERROR_LOG() << "dtor: " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "dtor: " << (quintptr)this;
|
||||
|
||||
if (m_createInterfaceAdapterInstance)
|
||||
{
|
||||
@@ -108,13 +107,13 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
|
||||
const auto oldTask = m_MissionCtrl.currentTask;
|
||||
m_MissionCtrl.currentTask = msg.currentTask;
|
||||
ERROR_LOG() << "currentTask = " << (int)m_MissionCtrl.currentTask;
|
||||
ERROR_LOG(m_logger) << "currentTask = " << (int)m_MissionCtrl.currentTask;
|
||||
|
||||
const auto oldMission = m_MissionCtrl.currentMission;
|
||||
m_MissionCtrl.currentMission = QString::fromStdString(msg.currentMissionName);
|
||||
ERROR_LOG() << "oldTask = " << (int)oldTask;
|
||||
ERROR_LOG(m_logger) << "oldTask = " << (int)oldTask;
|
||||
|
||||
ERROR_LOG() << "currentMission = " << QString::fromStdString(msg.currentMissionName);
|
||||
ERROR_LOG(m_logger) << "currentMission = " << QString::fromStdString(msg.currentMissionName);
|
||||
|
||||
m_MissionCtrl.currentlyAllowedTasks.swap(msg.currentlyAllowedTasks);
|
||||
|
||||
@@ -122,7 +121,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
{
|
||||
|
||||
|
||||
ERROR_LOG() << "Old Task" << oldTask << "new task " << m_MissionCtrl.currentTask ;
|
||||
ERROR_LOG(m_logger) << "Old Task" << oldTask << "new task " << m_MissionCtrl.currentTask ;
|
||||
if (oldTask != m_MissionCtrl.currentTask)
|
||||
{
|
||||
if (!oldMission.isEmpty() && m_MissionCtrl.currentMission.isEmpty())
|
||||
@@ -131,11 +130,11 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
}
|
||||
|
||||
m_MissionCtrl.ReportMissionStatus_Callback(msg);
|
||||
ERROR_LOG() << "################################# sending " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "################################# sending " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "################################# VERWERFING ! " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "################################# VERWERFING ! " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
case MissionCtrl::Shutdown:
|
||||
{
|
||||
m_isReady = false;
|
||||
ERROR_LOG() << "UAV not ready yet! currentTask: " << (int)m_MissionCtrl.currentTask;
|
||||
ERROR_LOG(m_logger) << "UAV not ready yet! currentTask: " << (int)m_MissionCtrl.currentTask;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -166,7 +165,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
{
|
||||
m_isReady_Callback();
|
||||
}
|
||||
ERROR_LOG() << "UAV now ready!";
|
||||
ERROR_LOG(m_logger) << "UAV now ready!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -253,7 +252,7 @@ void UAVCommanderImpl::updateCBitStaus()
|
||||
|
||||
void UAVCommanderImpl::updateDeviceModeState()
|
||||
{
|
||||
ERROR_LOG() << "start";
|
||||
ERROR_LOG(m_logger) << "start";
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -264,10 +263,10 @@ void UAVCommanderImpl::updateDeviceModeState()
|
||||
m_Device.currentMessage.clear();
|
||||
m_Device.currentMessage.emplace_back(msg);
|
||||
|
||||
ERROR_LOG() << "before callback";
|
||||
ERROR_LOG(m_logger) << "before callback";
|
||||
if (m_Device.ReportDeviceStatus_Callback)
|
||||
{
|
||||
ERROR_LOG() << "callback!";
|
||||
ERROR_LOG(m_logger) << "callback!";
|
||||
m_Device.ReportDeviceStatus_Callback(msg);
|
||||
}
|
||||
}
|
||||
@@ -281,11 +280,11 @@ void UAVCommanderImpl::updateDeviceModeState()
|
||||
|
||||
void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
{
|
||||
ERROR_LOG() << "resolver = " << (quintptr)resolver;
|
||||
ERROR_LOG(m_logger) << "resolver = " << (quintptr)resolver;
|
||||
|
||||
if (isTaskAllowed(MissionCtrl::Task::Observe) || m_MissionCtrl.currentTask == MissionCtrl::Task::Connect )
|
||||
{
|
||||
ERROR_LOG() << "DONE! resolving " << (quintptr)resolver;
|
||||
ERROR_LOG(m_logger) << "DONE! resolving " << (quintptr)resolver;
|
||||
emit resolver->resolve();
|
||||
return;
|
||||
}
|
||||
@@ -294,7 +293,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
connect(r, &Resolver::reject, resolver, &Resolver::reject);
|
||||
connect(r, &Resolver::resolve, resolver, [this, resolver]()
|
||||
{
|
||||
ERROR_LOG() << "r ("<<(quintptr)resolver<<")! resolving!";
|
||||
ERROR_LOG(m_logger) << "r ("<<(quintptr)resolver<<")! resolving!";
|
||||
Resolver *r2 = new Resolver(this);
|
||||
connect(r2, &Resolver::reject, resolver, &Resolver::reject);
|
||||
connect(r2, &Resolver::resolve, resolver, &Resolver::resolve);
|
||||
@@ -303,7 +302,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
|
||||
if (!m_MissionCtrl.currentMission.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << " > mission '"<< m_MissionCtrl.currentMission << "' currently active - aborting mission and waiting for loitering";
|
||||
ERROR_LOG(m_logger) << " > mission '"<< m_MissionCtrl.currentMission << "' currently active - aborting mission and waiting for loitering";
|
||||
sendCommand(r, {QStringLiteral("mission:abort (%1)").arg(m_MissionCtrl.currentMission), MissionCtrl::Task::Connect, [this]() { _abortMission(m_MissionCtrl.currentMission); }});
|
||||
return;
|
||||
}
|
||||
@@ -312,28 +311,28 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
{
|
||||
case MissionCtrl::Task::Disarm:
|
||||
{
|
||||
ERROR_LOG() << " > arm";
|
||||
ERROR_LOG(m_logger) << " > arm";
|
||||
arm(r);
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Arm:
|
||||
{
|
||||
ERROR_LOG() << " > takeoff";
|
||||
ERROR_LOG(m_logger) << " > takeoff";
|
||||
takeoff(r);
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Takeoff:
|
||||
{
|
||||
ERROR_LOG() << " > waiting for Loiter ...";
|
||||
ERROR_LOG(m_logger) << " > waiting for Loiter ...";
|
||||
sendCommand(r, {QStringLiteral("loiter"), MissionCtrl::Task::Loiter, nullptr});
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Loiter:
|
||||
{
|
||||
ERROR_LOG() << " >WE loiter start to resolve";
|
||||
ERROR_LOG(m_logger) << " >WE loiter start to resolve";
|
||||
emit resolver->resolve();
|
||||
break;
|
||||
}
|
||||
@@ -342,7 +341,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
|
||||
default:
|
||||
{
|
||||
ERROR_LOG() << "help, I don't know what to do with "<<(int)m_MissionCtrl.currentTask<<" :(";
|
||||
ERROR_LOG(m_logger) << "help, I don't know what to do with "<<(int)m_MissionCtrl.currentTask<<" :(";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +352,7 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
{
|
||||
if (!m_isReady)
|
||||
{
|
||||
ERROR_LOG() << "not ready";
|
||||
ERROR_LOG(m_logger) << "not ready";
|
||||
throw std::runtime_error("UAV not ready");
|
||||
}
|
||||
|
||||
@@ -373,21 +372,21 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
}
|
||||
|
||||
Resolver *r = new Resolver(this);
|
||||
connect(r, &Resolver::reject, this, [this](const QString &msg) { ERROR_LOG() << "rejected: " << msg; });
|
||||
connect(r, &Resolver::reject, this, [this](const QString &msg) { ERROR_LOG(m_logger) << "rejected: " << msg; });
|
||||
connect(r, &Resolver::resolve, [this, lat, lon, alt, missionName]()
|
||||
{
|
||||
ERROR_LOG() << "!!!!!!!!!!!!!!!!!!!!!! going to observe now!!";
|
||||
ERROR_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!! going to observe now!!";
|
||||
|
||||
|
||||
Resolver *r2 = new Resolver(this);
|
||||
connect(r2, &Resolver::reject, [this](const QString &msg) { ERROR_LOG() << "################ failed to start mission :( " << msg; });
|
||||
connect(r2, &Resolver::reject, [this](const QString &msg) { ERROR_LOG(m_logger) << "################ failed to start mission :( " << msg; });
|
||||
connect(r2, &Resolver::resolve, [this, missionName]()
|
||||
{
|
||||
Resolver *r3 = new Resolver(this);
|
||||
connect(r3, &Resolver::reject, [this](const QString &msg) { ERROR_LOG() << "################ failed to wait for loiter :( " << msg; });
|
||||
connect(r3, &Resolver::reject, [this](const QString &msg) { ERROR_LOG(m_logger) << "################ failed to wait for loiter :( " << msg; });
|
||||
connect(r3, &Resolver::resolve, [this, missionName]()
|
||||
{
|
||||
ERROR_LOG() << "################ mission done" << missionName << " " << this << " ";
|
||||
ERROR_LOG(m_logger) << "################ mission done" << missionName << " " << this << " ";
|
||||
|
||||
|
||||
|
||||
@@ -395,7 +394,7 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
|
||||
});
|
||||
sendCommand(r3, {QStringLiteral("wait for mission to end (Loiter)"), MissionCtrl::Task::Loiter, nullptr}, -1);
|
||||
ERROR_LOG() << "################ successfully started mission :)";
|
||||
ERROR_LOG(m_logger) << "################ successfully started mission :)";
|
||||
});
|
||||
sendCommand(r2, { QStringLiteral("mission:observe"), MissionCtrl::Task::Observe, [this, lat, lon, alt, missionName]() { _sendMission(lat, lon, alt, missionName); } });
|
||||
});
|
||||
@@ -419,18 +418,18 @@ void UAVCommanderImpl::_abortMission(const QString &missionName)
|
||||
|
||||
void UAVCommanderImpl::_sendMission(double lat, double lon, double alt, const QString &missionName)
|
||||
{
|
||||
ERROR_LOG() << "lat = " << lat << ", lon = " << lon << ", alt = " << alt << ", missionName = " << missionName;
|
||||
ERROR_LOG(m_logger) << "lat = " << lat << ", lon = " << lon << ", alt = " << alt << ", missionName = " << missionName;
|
||||
|
||||
M_Common::EllipsoidalPositionType pos;
|
||||
|
||||
if (alt <= 0.1)
|
||||
{
|
||||
ERROR_LOG() << "alt very low (<= 0.1) !";
|
||||
ERROR_LOG(m_logger) << "alt very low (<= 0.1) !";
|
||||
}
|
||||
|
||||
pos.Latitude = lat / LtsCoordTrans::deg2rad();
|
||||
pos.Longitude = lon / LtsCoordTrans::deg2rad();
|
||||
ERROR_LOG() << "DEG lat = " << pos.Latitude << ", lon = " << pos.Longitude << ", alt = " << alt << ", missionName = " << missionName;
|
||||
ERROR_LOG(m_logger) << "DEG lat = " << pos.Latitude << ", lon = " << pos.Longitude << ", alt = " << alt << ", missionName = " << missionName;
|
||||
|
||||
pos.Altitude.push_back(alt);
|
||||
|
||||
@@ -447,8 +446,8 @@ void UAVCommanderImpl::_sendMission(double lat, double lon, double alt, const QS
|
||||
void UAVCommanderImpl::returnToHome()
|
||||
{
|
||||
Resolver *r = new Resolver(this);
|
||||
connect(r, &Resolver::reject, this, [this](const QString &error) { ERROR_LOG() << "returnToHome failed: " << error; });
|
||||
connect(r, &Resolver::resolve, this, [this]() { ERROR_LOG() << "returnToHome done :)"; });
|
||||
connect(r, &Resolver::reject, this, [this](const QString &error) { ERROR_LOG(m_logger) << "returnToHome failed: " << error; });
|
||||
connect(r, &Resolver::resolve, this, [this]() { ERROR_LOG(m_logger) << "returnToHome done :)"; });
|
||||
sendCommand(r, { QStringLiteral("return"), MissionCtrl::Task::Return, [this]() { _returnToHome(); } }, -1 );
|
||||
}
|
||||
|
||||
@@ -467,12 +466,12 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
|
||||
if (m_tried != 0)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": another request already running - replacing ("<<m_tried__ACTIVE<<")";
|
||||
ERROR_LOG(m_logger) << commandName << ": another request already running - replacing ("<<m_tried__ACTIVE<<")";
|
||||
}
|
||||
|
||||
if (m_MissionCtrl.currentTask == type)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": current task already matches new task '"<< commandName <<"' - replacing anyways";
|
||||
ERROR_LOG(m_logger) << commandName << ": current task already matches new task '"<< commandName <<"' - replacing anyways";
|
||||
}
|
||||
|
||||
if (m_currentResolver)
|
||||
@@ -481,7 +480,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
}
|
||||
m_currentResolver = resolver;
|
||||
|
||||
ERROR_LOG() << commandName << ": sending '" << commandName <<"' command ...";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '" << commandName <<"' command ...";
|
||||
m_tried = 1;
|
||||
m_tried__ACTIVE = cmd.name;
|
||||
|
||||
@@ -494,14 +493,14 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
if (commandFn)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed - timeout, trying again !";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed - timeout, trying again !";
|
||||
try
|
||||
{
|
||||
commandFn();
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed:" << ex.what();
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed:" << ex.what();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -521,7 +520,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
timeout->stop();
|
||||
guard->deleteLater();
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed - max tries reached, giving up !";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed - max tries reached, giving up !";
|
||||
m_tried = 0;
|
||||
m_currentResolver.clear();
|
||||
emit resolver->reject(QStringLiteral("Sending %1 command timed out!").arg(commandName));
|
||||
@@ -540,7 +539,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
connect(reader->readerSignal(), &ReaderSignal::dataReady,
|
||||
this, [this, reader, guard, timeout, commandName, type, resolver]()
|
||||
{
|
||||
ERROR_LOG() << commandName << ": reader signal for '"<< commandName <<"' !";
|
||||
ERROR_LOG(m_logger) << commandName << ": reader signal for '"<< commandName <<"' !";
|
||||
|
||||
while(true)
|
||||
{
|
||||
@@ -548,14 +547,14 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
const auto msg = reader->getNext();
|
||||
|
||||
ERROR_LOG() << "########## READER SIGNAL (should: " << (int)type << ", is: " << (int)msg.currentTask << ")";
|
||||
ERROR_LOG(m_logger) << "########## READER SIGNAL (should: " << (int)type << ", is: " << (int)msg.currentTask << ")";
|
||||
|
||||
if (msg.currentTask == type
|
||||
|
||||
|| (type == MissionCtrl::Task::Takeoff && msg.currentTask == MissionCtrl::Task::Connect)
|
||||
|| (type == MissionCtrl::Task::Return && (msg.currentTask == MissionCtrl::Task::Disarm || msg.currentTask == MissionCtrl::Task::Land)))
|
||||
{
|
||||
ERROR_LOG() << commandName << ": successfully set new task '"<< commandName <<"' !";
|
||||
ERROR_LOG(m_logger) << commandName << ": successfully set new task '"<< commandName <<"' !";
|
||||
|
||||
|
||||
QTimer *x = new QTimer(guard);
|
||||
@@ -565,7 +564,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
connect(guard, &QObject::destroyed, x, &QTimer::stop);
|
||||
connect(x, &QTimer::timeout, this, [this, timeout, guard, resolver]()
|
||||
{
|
||||
ERROR_LOG() << "############# RESOLVE AFTER 1s";
|
||||
ERROR_LOG(m_logger) << "############# RESOLVE AFTER 1s";
|
||||
|
||||
m_tried = 0;
|
||||
if (timeout != nullptr)
|
||||
@@ -588,7 +587,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
}
|
||||
}
|
||||
|
||||
ERROR_LOG() << commandName << ": command '"<< commandName <<"' not accepted (yet)";
|
||||
ERROR_LOG(m_logger) << commandName << ": command '"<< commandName <<"' not accepted (yet)";
|
||||
|
||||
|
||||
});
|
||||
@@ -642,7 +641,7 @@ void UAVCommanderImpl::sendTryReclaimAutoMode()
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "Failed to send DeviceMode:" << ex.what();
|
||||
ERROR_LOG(m_logger) << "Failed to send DeviceMode:" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,25 +668,25 @@ CreateInterfaceAdapterInstance::CreateInterfaceAdapterInstance(int uasId, const
|
||||
connect(m_reader.readerSignal(), &ReaderSignal::dataReady,
|
||||
this, [this, uasId]()
|
||||
{
|
||||
ERROR_LOG() << "readerSignal for uasId" << m_uasId;
|
||||
ERROR_LOG(m_logger) << "readerSignal for uasId" << m_uasId;
|
||||
|
||||
const auto msgs = readAll<ObjectManager::ReportPoint::Message>(m_reader);
|
||||
ERROR_LOG() << "msgs.size" << msgs.size() << m_uasId;
|
||||
ERROR_LOG(m_logger) << "msgs.size" << msgs.size() << m_uasId;
|
||||
|
||||
for (const auto &msg : msgs)
|
||||
{
|
||||
ERROR_LOG() << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
ERROR_LOG(m_logger) << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
if (msg.uasId == uasId && !msg.isRemoved)
|
||||
{
|
||||
|
||||
ERROR_LOG() << "DONE!!";
|
||||
ERROR_LOG(m_logger) << "DONE!!";
|
||||
m_timeout->stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ERROR_LOG() << "no ia instance for"<<m_uasId<<"found !! starting timeout";
|
||||
ERROR_LOG(m_logger) << "no ia instance for"<<m_uasId<<"found !! starting timeout";
|
||||
if (!m_timeout->isActive())
|
||||
{
|
||||
m_timeout->start();
|
||||
@@ -706,7 +705,7 @@ CreateInterfaceAdapterInstance::CreateInterfaceAdapterInstance(int uasId, const
|
||||
|
||||
void CreateInterfaceAdapterInstance::onStart()
|
||||
{
|
||||
ERROR_LOG() << " -- CreateInterfaceAdapterInstance -- ::onStart() CmdAddUpdatePoint" << m_uasId<<" ip: "<<m_ip<<" use TCP ? "<<m_useTcp;
|
||||
ERROR_LOG(m_logger) << " -- CreateInterfaceAdapterInstance -- ::onStart() CmdAddUpdatePoint" << m_uasId<<" ip: "<<m_ip<<" use TCP ? "<<m_useTcp;
|
||||
|
||||
M_ObjectManager::PointObjectType pot;
|
||||
pot.AdditionalInfo.push_back({ "IP", m_ip, {}, {}, M_Common::PropertyAccessKind::Type::Undefined });
|
||||
@@ -720,7 +719,7 @@ void CreateInterfaceAdapterInstance::onStart()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "CmdAddUpdatePoint FAILED!" << m_uasId << ":" << ex.what();
|
||||
ERROR_LOG(m_logger) << "CmdAddUpdatePoint FAILED!" << m_uasId << ":" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,18 +741,18 @@ KillInterfaceAdapterInstanceAsync::KillInterfaceAdapterInstanceAsync(int uasId)
|
||||
return;
|
||||
}
|
||||
|
||||
ERROR_LOG() << "readerSignal for uasId" << m_uasId;
|
||||
ERROR_LOG(m_logger) << "readerSignal for uasId" << m_uasId;
|
||||
|
||||
const auto msgs = readAll<ObjectManager::ReportPoint::Message>(m_reader);
|
||||
ERROR_LOG() << "msgs.size" << msgs.size() << m_uasId;
|
||||
ERROR_LOG(m_logger) << "msgs.size" << msgs.size() << m_uasId;
|
||||
|
||||
for (const auto &msg : msgs)
|
||||
{
|
||||
ERROR_LOG() << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
ERROR_LOG(m_logger) << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
if (msg.uasId == uasId && msg.isRemoved)
|
||||
{
|
||||
|
||||
ERROR_LOG() << "DONE!!";
|
||||
ERROR_LOG(m_logger) << "DONE!!";
|
||||
m_done = true;
|
||||
deleteLater();
|
||||
return;
|
||||
@@ -778,7 +777,7 @@ void KillInterfaceAdapterInstanceAsync::onStop()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "CmdRemove" << m_uasId << ":" << ex.what();
|
||||
ERROR_LOG(m_logger) << "CmdRemove" << m_uasId << ":" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -48,6 +48,8 @@ private slots:
|
||||
void onStart();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
mutable CommunicationMaster<M_ObjectManager::Client, ObjectManager::ReportPoint::Dispatcher> m_master;
|
||||
Reader<ObjectManager::ReportPoint::Message> m_reader;
|
||||
M_ObjectManager::Client m_writer;
|
||||
|
||||
+9
-9
@@ -115,12 +115,12 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::Init &data)
|
||||
bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data)
|
||||
{
|
||||
const int eqId = data.header.equipmentNumber;
|
||||
DEBUG_LOG() << "eqId: " << eqId;
|
||||
DEBUG_LOG(m_logger) << "eqId: " << eqId;
|
||||
const ParticipantManagement::Participant p = m_dtcPpm->participant(m_dtcPpm->participantIdByEquipmentNumber(eqId));
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data)
|
||||
|
||||
if (!m_uavIAManager->waypoint(p.id(), action.absPosition, QStringLiteral("%1_%2").arg(data.missionId).arg(data.missionName)))
|
||||
{
|
||||
WARNING_LOG() << "sending waypoint failed!";
|
||||
WARNING_LOG(m_logger) << "sending waypoint failed!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVChangeState &data)
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,23 +167,23 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::CesHitRequest &data)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "data.chargeTasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
DEBUG_LOG(m_logger) << "data.chargeTasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
|
||||
|
||||
if (!m_dtcPdm->isJamming(data.chargeTasCodeDirect,0,0))
|
||||
{
|
||||
WARNING_LOG() << "not jamming";
|
||||
WARNING_LOG(m_logger) << "not jamming";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "participantEventChanged: JAMMING! chargetasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
DEBUG_LOG(m_logger) << "participantEventChanged: JAMMING! chargetasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
|
||||
const int eqId = data.header.equipmentNumber;
|
||||
const ParticipantManagement::Participant p = m_dtcPpm->participant(m_dtcPpm->participantIdByEquipmentNumber(eqId));
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::CesHitRequest &data)
|
||||
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::CatastrophicKill;
|
||||
msg.originatorId = data.originatorEquipmentNumber;
|
||||
|
||||
DEBUG_LOG() << "sending state change direct (kill) with jamming for eqId " << msg.header.equipmentNumber;
|
||||
DEBUG_LOG(m_logger) << "sending state change direct (kill) with jamming for eqId " << msg.header.equipmentNumber;
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ Q_SIGNALS:
|
||||
void outgoingMessage(const QByteArray &msg);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_isConnected;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
|
||||
+5
-6
@@ -23,9 +23,8 @@
|
||||
|
||||
namespace UAS
|
||||
{
|
||||
TmsIfModuleHandle::TmsIfModuleHandle()
|
||||
: m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString()))
|
||||
{}
|
||||
TmsIfModuleHandle::TmsIfModuleHandle() : m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString())),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
|
||||
TmsIfModuleHandle::~TmsIfModuleHandle()
|
||||
@@ -55,11 +54,11 @@ PluginInstance::PluginInstance(TrainingAreaBase::Plugin::DataProvider *dataProvi
|
||||
, m_uavIAManager(new UAVInterfaceAdapterManager(m_ddsHandler, m_sendToDds, m_tmsIfAdapter, m_exerciseId, this))
|
||||
, m_fromTab(new FromTab(ddsHandler, m_sendToDds, m_uavIAManager, m_exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "UAS PluginInstance running!";
|
||||
DEBUG_LOG(m_logger) << "UAS PluginInstance running!";
|
||||
|
||||
if (!m_dtcPdm)
|
||||
{
|
||||
WARNING_LOG() << "m_dtcPdm failed";
|
||||
WARNING_LOG(m_logger) << "m_dtcPdm failed";
|
||||
throw std::runtime_error("m_dtcPdm failed");
|
||||
}
|
||||
m_dtcPdm->enableChargeType();
|
||||
@@ -68,7 +67,7 @@ PluginInstance::PluginInstance(TrainingAreaBase::Plugin::DataProvider *dataProvi
|
||||
|
||||
if (!m_dtcPpm)
|
||||
{
|
||||
WARNING_LOG() << "m_dtcPpm failed";
|
||||
WARNING_LOG(m_logger) << "m_dtcPpm failed";
|
||||
throw std::runtime_error("m_dtcPpm failed");
|
||||
}
|
||||
m_dtcPpm->enableParticipant();
|
||||
|
||||
+2
@@ -37,6 +37,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void *m_handle { nullptr };
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ UAVInterfaceAdapter::UAVInterfaceAdapter(UAVInterfaceAdapterConfig uavConfig, UA
|
||||
|
||||
UAVInterfaceAdapter::~UAVInterfaceAdapter()
|
||||
{
|
||||
DEBUG_LOG() << "terminating IA for UAV - " << (quintptr)this;
|
||||
DEBUG_LOG(m_logger) << "terminating IA for UAV - " << (quintptr)this;
|
||||
delete m_commander;
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
UAVCommander &commander() { return *m_commander; }
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
UAVInterfaceAdapterConfig m_config;
|
||||
UAVCommander *m_commander;
|
||||
};
|
||||
|
||||
+42
-43
@@ -25,19 +25,18 @@ const int UAVInterfaceAdapterManager::s_domainId = 4;
|
||||
|
||||
UAVInterfaceAdapterManager::UAVInterfaceAdapterManager(const std::shared_ptr<TrainingAreaBase::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &sendToDds,
|
||||
TmsIfAdapter &tmsIfAdapter, int exerciseId, QObject *parent)
|
||||
: QObject(parent)
|
||||
TmsIfAdapter &tmsIfAdapter, int exerciseId, QObject *parent) : QObject(parent)
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_dtcPpm(ParticipantManagement::Interface::Dtc::create(ddsHandler->ddsConnector()))
|
||||
, m_ftcPpm(ParticipantManagement::Interface::Ftc::create(ddsHandler->ddsConnector()))
|
||||
, m_tmsIfAdapter(tmsIfAdapter)
|
||||
, m_sendToDds(sendToDds)
|
||||
{}
|
||||
, m_sendToDds(sendToDds),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::init()
|
||||
{
|
||||
DEBUG_LOG() << "UAVInterfaceAdapterManager starting for ex " << m_exerciseId;
|
||||
DEBUG_LOG(m_logger) << "UAVInterfaceAdapterManager starting for ex " << m_exerciseId;
|
||||
|
||||
m_dtcPpm->waitForHistoricalDataDynamicParticipantData(3000);
|
||||
m_dtcPpm->waitForHistoricalDataParticipant(3000);
|
||||
@@ -80,7 +79,7 @@ void UAVInterfaceAdapterManager::init()
|
||||
m_dtcPpm->enableUAS();
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "done";
|
||||
DEBUG_LOG(m_logger) << "done";
|
||||
}
|
||||
|
||||
|
||||
@@ -95,21 +94,21 @@ void UAVInterfaceAdapterManager::removed(const ParticipantManagement::UAS &uas)
|
||||
|
||||
if (m_uavs.find(uas.id()) != m_uavs.cend())
|
||||
{
|
||||
WARNING_LOG() << "tried removing participant " << uas.id() << " that doesn't exist";
|
||||
WARNING_LOG(m_logger) << "tried removing participant " << uas.id() << " that doesn't exist";
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found! removing.....";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found! removing.....";
|
||||
stop(uas);
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "modify uas " << uas.id();
|
||||
DEBUG_LOG(m_logger) << "modify uas " << uas.id();
|
||||
|
||||
if (uas.participantId() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "UAV with uas id " << uas.id() << " not a UAV anymore - removing";
|
||||
WARNING_LOG(m_logger) << "UAV with uas id " << uas.id() << " not a UAV anymore - removing";
|
||||
stop(uas);
|
||||
return;
|
||||
}
|
||||
@@ -121,14 +120,14 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
const auto i = m_uavs.find(uasId);
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
WARNING_LOG() << "UAV with uas id " << uas.id() << " was modified but now found in our list - feeding it as 'added' instead as a bail-out";
|
||||
WARNING_LOG(m_logger) << "UAV with uas id " << uas.id() << " was modified but now found in our list - feeding it as 'added' instead as a bail-out";
|
||||
added(uas);
|
||||
return;
|
||||
}
|
||||
|
||||
const UAVInterfaceAdapter &uav2 = *i->second;
|
||||
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -136,7 +135,7 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
|
||||
if (uav2.config() == config)
|
||||
{
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " already running and config has not changed - doing nothing (irrelevant data has changed)";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " already running and config has not changed - doing nothing (irrelevant data has changed)";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,14 +148,14 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
WARNING_LOG() << "Failed to modify UAV: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to modify UAV: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "exId: " << m_exerciseId << ", uas: " << uas.id() << ", participantId: " << uas.participantId()<<" ## use tcp ? "<<uas.useTcp();
|
||||
DEBUG_LOG(m_logger) << "exId: " << m_exerciseId << ", uas: " << uas.id() << ", participantId: " << uas.participantId()<<" ## use tcp ? "<<uas.useTcp();
|
||||
|
||||
const auto participant = m_dtcPpm->participant(uas.participantId());
|
||||
|
||||
@@ -170,17 +169,17 @@ void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "added uav with id " << uas.id() << " for pId " << uas.participantId();
|
||||
DEBUG_LOG(m_logger) << "added uav with id " << uas.id() << " for pId " << uas.participantId();
|
||||
|
||||
if (m_uavs.find(uas.id()) != m_uavs.cend())
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "participant " << uas.id() << " already started - doing nothing";
|
||||
DEBUG_LOG(m_logger) << "participant " << uas.id() << " already started - doing nothing";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "############# ALLES OKAY uas: " << uas.id() << " - pId: " << uas.participantId();
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found";
|
||||
DEBUG_LOG(m_logger) << "############# ALLES OKAY uas: " << uas.id() << " - pId: " << uas.participantId();
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -189,7 +188,7 @@ void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
WARNING_LOG() << "Failed to start uav ia: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to start uav ia: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +211,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
const int droneDomainId = s_domainId;
|
||||
const bool useTcp = uas.useTcp();
|
||||
|
||||
DEBUG_LOG() << "starting IA for eqId = " << droneEqId << ", pid = " << droneParticipantId << ", domain = " << droneDomainId << ", uasId = " << uasId<<" // ** useTcp: "<<uas.useTcp();
|
||||
DEBUG_LOG(m_logger) << "starting IA for eqId = " << droneEqId << ", pid = " << droneParticipantId << ", domain = " << droneDomainId << ", uasId = " << uasId<<" // ** useTcp: "<<uas.useTcp();
|
||||
|
||||
auto *uav = m_tmsIfAdapter.createUAV(droneDomainId, uasId);
|
||||
|
||||
@@ -221,13 +220,13 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
const auto fn = [this, droneDomainId, droneParticipantId, droneEqId, useTcp]()
|
||||
{
|
||||
DEBUG_LOG() << "UAV " << droneDomainId << " / " << droneParticipantId <<" / use TCP ? "<<useTcp<< " ready !!";
|
||||
DEBUG_LOG(m_logger) << "UAV " << droneDomainId << " / " << droneParticipantId <<" / use TCP ? "<<useTcp<< " ready !!";
|
||||
|
||||
const auto pdata = m_dtcPpm->dynamicParticipantData(droneParticipantId);
|
||||
|
||||
if (pdata.participantId() < 1 || pdata.stateHistory().empty())
|
||||
{
|
||||
DEBUG_LOG() << "pdata or state history for pid " << droneParticipantId << " is empty - sending init";
|
||||
DEBUG_LOG(m_logger) << "pdata or state history for pid " << droneParticipantId << " is empty - sending init";
|
||||
|
||||
TrainingAreaBase::TetraIcd::StateChange msg;
|
||||
msg.header.equipmentNumber = droneEqId;
|
||||
@@ -240,11 +239,11 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
|
||||
DEBUG_LOG() << "sent combat ready for " << droneParticipantId << " - done";
|
||||
DEBUG_LOG(m_logger) << "sent combat ready for " << droneParticipantId << " - done";
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG() << "state history for pid " << droneParticipantId << " not empty - nothing to do";
|
||||
WARNING_LOG(m_logger) << "state history for pid " << droneParticipantId << " not empty - nothing to do";
|
||||
}
|
||||
};
|
||||
uav->set_isReady_Callback(fn);
|
||||
@@ -259,7 +258,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
msg.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
msg.geoPosition = { data.lon * LtsCoordTrans::deg2rad(), data.lat * LtsCoordTrans::deg2rad(), data.alt };
|
||||
|
||||
DEBUG_LOG() << "POSITION! sending PositionReport into TAB";
|
||||
DEBUG_LOG(m_logger) << "POSITION! sending PositionReport into TAB";
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
});
|
||||
@@ -317,19 +316,19 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
}
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
DEBUG_LOG() << "RadioLinkConnectionState! sending RadioLinkConnectionState into TAB";
|
||||
DEBUG_LOG(m_logger) << "RadioLinkConnectionState! sending RadioLinkConnectionState into TAB";
|
||||
});
|
||||
|
||||
|
||||
uav->set_ReportRadioLinkConnectionState_Callback([this, droneEqId](const TeleOperation::RadioLinkConnectionState::Message &data)
|
||||
{
|
||||
DEBUG_LOG() << "COULD! send RadioLinkConnectionState! sending RadioLinkConnectionState into TAB << " << droneEqId << " " << data.status;
|
||||
DEBUG_LOG(m_logger) << "COULD! send RadioLinkConnectionState! sending RadioLinkConnectionState into TAB << " << droneEqId << " " << data.status;
|
||||
});
|
||||
|
||||
|
||||
uav->set_ReportMissionStatus_Callback([this, droneEqId](const MissionCtrl::ReportMissionStatus::Message &data)
|
||||
{
|
||||
DEBUG_LOG() << "ReportMissionStatus! sending ReportMissionStatus into TAB << " << droneEqId << " - currentTask = " << (int)data.currentTask << ", currentMission = " << data.currentMissionName;
|
||||
DEBUG_LOG(m_logger) << "ReportMissionStatus! sending ReportMissionStatus into TAB << " << droneEqId << " - currentTask = " << (int)data.currentTask << ", currentMission = " << data.currentMissionName;
|
||||
|
||||
TrainingAreaBase::TetraIcd::UAVMissionStatus msg;
|
||||
msg.header.equipmentNumber = droneEqId;
|
||||
@@ -345,7 +344,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
case MissionCtrl::Task::Connect: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Connect; break;
|
||||
case MissionCtrl::Task::Loiter: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Loiter; break;
|
||||
case MissionCtrl::Task::Return: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Return;
|
||||
DEBUG_LOG() << "Return";
|
||||
DEBUG_LOG(m_logger) << "Return";
|
||||
setMissionActionFulfilled(droneEqId);
|
||||
break;
|
||||
case MissionCtrl::Task::Observe: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Observe; break;
|
||||
@@ -358,23 +357,23 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
uav->startIA(config.m_ip.toStdString(), config.m_port, config.m_useTcp);
|
||||
|
||||
DEBUG_LOG() << "DONE STARTING UAV!";
|
||||
DEBUG_LOG(m_logger) << "DONE STARTING UAV!";
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
|
||||
WARNING_LOG() << "Failed to start UAV: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to start UAV: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::stop(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "############################### STOP !! " << uas.id();
|
||||
DEBUG_LOG(m_logger) << "############################### STOP !! " << uas.id();
|
||||
auto it = m_uavs.find(uas.id());
|
||||
if (it == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav not found - ignoring :/";
|
||||
DEBUG_LOG(m_logger) << "uav not found - ignoring :/";
|
||||
return;
|
||||
}
|
||||
it->second->deleteLater();
|
||||
@@ -388,7 +387,7 @@ bool UAVInterfaceAdapterManager::kill(int participantId)
|
||||
|
||||
if (uas.id() < 1)
|
||||
{
|
||||
DEBUG_LOG() << "uas by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uas by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -396,7 +395,7 @@ bool UAVInterfaceAdapterManager::kill(int participantId)
|
||||
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uav by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -413,7 +412,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (uas.id() < 1)
|
||||
{
|
||||
DEBUG_LOG() << "uas by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uas by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,11 +420,11 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uav by participant id " << participantId << " not found - stop";
|
||||
|
||||
for (const auto &uav : m_uavs)
|
||||
{
|
||||
DEBUG_LOG() << "pid: " << uav.first;
|
||||
DEBUG_LOG(m_logger) << "pid: " << uav.first;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -433,7 +432,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (i->second == nullptr)
|
||||
{
|
||||
WARNING_LOG() << "UAVInterfaceAdapterManager::waypoint: NULLPTR for "<<participantId;
|
||||
WARNING_LOG(m_logger) << "UAVInterfaceAdapterManager::waypoint: NULLPTR for "<<participantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -447,7 +446,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
WARNING_LOG() << "UAVInterfaceAdapterManager::waypoint: " << e.what();
|
||||
WARNING_LOG(m_logger) << "UAVInterfaceAdapterManager::waypoint: " << e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -457,7 +456,7 @@ void UAVInterfaceAdapterManager::setMissionActionFulfilled(int equipmentNumber)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "setMissionActionFulfilled equipmentId=" << equipmentNumber;
|
||||
DEBUG_LOG(m_logger) << "setMissionActionFulfilled equipmentId=" << equipmentNumber;
|
||||
|
||||
const int missionId = m_dtcPpm->uasMissionIdByEquipmentNumber(equipmentNumber);
|
||||
|
||||
@@ -472,7 +471,7 @@ void UAVInterfaceAdapterManager::setMissionActionFulfilled(int equipmentNumber)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << " -- unable to abort mission with planId:"<<abortReq.missionId() << ": " << e.what();
|
||||
WARNING_LOG(m_logger) << " -- unable to abort mission with planId:"<<abortReq.missionId() << ": " << e.what();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
+2
@@ -50,6 +50,8 @@ public:
|
||||
bool tryChangeModeToAuto(int participantId);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void removed(const ParticipantManagement::UAS &uas);
|
||||
void modified(const ParticipantManagement::UAS &uas);
|
||||
void added(const ParticipantManagement::UAS &uas);
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ public:
|
||||
const char *name() const override { return tr_lts("dds", "WlsTetra"); }
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
WlsDispatcher *m_wlsDispatcher;
|
||||
TetraDispatcher *m_tetraDispatcher;
|
||||
|
||||
|
||||
+1
-1
@@ -250,7 +250,7 @@ bool MainHandlerTx::txData(const TetraIcd::Sanitation &data)
|
||||
|
||||
bool MainHandlerTx::txData(const TetraIcd::SelectiveReammunition &data)
|
||||
{
|
||||
DEBUG_LOG() << "MainHandlerTx::txData SelectiveReammunition";
|
||||
DEBUG_LOG(m_logger) << "MainHandlerTx::txData SelectiveReammunition";
|
||||
return sendToTxMixin(&data);
|
||||
}
|
||||
bool MainHandlerTx::txData(const TetraIcd::SetDevicePowerRequest &data)
|
||||
|
||||
+2
@@ -64,9 +64,11 @@ public:
|
||||
bool txData(const TrainingAreaBase::TetraIcd::SetDevicePowerRequest &data) override;
|
||||
bool txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTxMixin(const T *data);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<WlsHandlerTx> m_wlsHandlerTx;
|
||||
std::shared_ptr<TetraHandlerTx> m_tetraHandlerTx;
|
||||
};
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ void TetraDispatcher::onSendInitialData()
|
||||
m_txHandler->setConnected(true);
|
||||
if (m_dataProvider)
|
||||
{
|
||||
INFO_LOG() << "sending initial data";
|
||||
INFO_LOG(m_logger) << "sending initial data";
|
||||
|
||||
if (m_dataProvider->exerciseId() > 0)
|
||||
{
|
||||
|
||||
+3
@@ -39,6 +39,7 @@ public:
|
||||
const char *name() const override { return tr_lts("dds", "TETRA"); }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool init(PrtCnv::PrtCnvApplication *prtCnvApp);
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -46,9 +47,11 @@ private Q_SLOTS:
|
||||
void onSendInitialData();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void disconnectSocket(QWebSocket *s);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TetraHandlerRx> m_rxHandler;
|
||||
std::shared_ptr<TetraHandlerTx> m_txHandler;
|
||||
TetraPrtCnv *m_tetraPrtCnv;
|
||||
|
||||
+9
-10
@@ -10,13 +10,12 @@
|
||||
namespace WlsTetra
|
||||
{
|
||||
|
||||
TetraHandlerRx::TetraHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &rxHandler)
|
||||
: m_rxHandler(rxHandler)
|
||||
TetraHandlerRx::TetraHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &rxHandler) : m_rxHandler(rxHandler)
|
||||
, m_ackTimer(new QTimer(this))
|
||||
, m_receiveCounter(0)
|
||||
, m_bWarnedOnce(false)
|
||||
, m_bWaitForInitialAck(true)
|
||||
{
|
||||
, m_bWaitForInitialAck(true),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
m_ackTimer->setInterval(1000);
|
||||
m_ackTimer->setSingleShot(false);
|
||||
connect(m_ackTimer, &QTimer::timeout,
|
||||
@@ -37,14 +36,14 @@ bool TetraHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
if (!sendCounter.isDouble())
|
||||
return false;
|
||||
m_receiveCounter = sendCounter.toInt(-1);
|
||||
DEBUG_LOG() << "Incoming telegram with Id " << obj.value(QStringLiteral("type")).toString();
|
||||
DEBUG_LOG(m_logger) << "Incoming telegram with Id " << obj.value(QStringLiteral("type")).toString();
|
||||
if (m_receiveCounter < 0)
|
||||
return false;
|
||||
}
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
@@ -167,14 +166,14 @@ bool TetraHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
emit participantLicenseChange(ParticipantLicenseChange::fromJson(data));
|
||||
break;
|
||||
default:
|
||||
WARNING_LOG() << "Handler for telegram Id " << typeId.toInt()
|
||||
WARNING_LOG(m_logger) << "Handler for telegram Id " << typeId.toInt()
|
||||
<< " not yet implemented (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -182,7 +181,7 @@ bool TetraHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
|
||||
void TetraHandlerRx::handleAcknowledge(qint64 timeStamp, int counter)
|
||||
{
|
||||
TRACE_LOG() << "Ack from Socket for time " << timeStamp
|
||||
TRACE_LOG(m_logger) << "Ack from Socket for time " << timeStamp
|
||||
<< " with counter " << counter
|
||||
<< ", initial: " << m_bWaitForInitialAck;
|
||||
if (m_bWaitForInitialAck)
|
||||
@@ -209,7 +208,7 @@ void TetraHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ private:
|
||||
void rxData(const T &data);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
QTimer *m_ackTimer;
|
||||
int m_receiveCounter;
|
||||
|
||||
+4
-4
@@ -40,14 +40,14 @@ bool TetraHandlerTx::sendTele(const QByteArray &ba)
|
||||
const QJsonValue typeId = obj[QStringLiteral("typeId")];
|
||||
if (typeId.toInt() == TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
|
||||
{
|
||||
TRACE_LOG() << "Outgoing ack";
|
||||
TRACE_LOG(m_logger) << "Outgoing ack";
|
||||
emit outgoingMessage(ba);
|
||||
return true;
|
||||
}
|
||||
|
||||
obj[QStringLiteral("counter")] = m_sendCounter++;
|
||||
const QByteArray baToSend = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
DEBUG_LOG() << "Outgoing message: " << typeId.toInt();
|
||||
DEBUG_LOG(m_logger) << "Outgoing message: " << typeId.toInt();
|
||||
emit outgoingMessage(baToSend);
|
||||
return true;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ bool TetraHandlerTx::txData(const TrainingAreaBase::TetraIcd::Sanitation &data)
|
||||
|
||||
bool TetraHandlerTx::txData(const TrainingAreaBase::TetraIcd::SelectiveReammunition &data)
|
||||
{
|
||||
DEBUG_LOG() << " TetraHandlerTx::txData: SelectiveReammunition";
|
||||
DEBUG_LOG(m_logger) << " TetraHandlerTx::txData: SelectiveReammunition";
|
||||
return sendToTx(&data);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ bool TetraHandlerTx::sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTele
|
||||
obj[QStringLiteral("counter")] = m_sendCounter++;
|
||||
const QByteArray ba = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
if (data->id() != TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
emit outgoingMessage(ba);
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
@@ -67,7 +67,9 @@ public:
|
||||
Q_SIGNALS:
|
||||
void outgoingMessage(const QByteArray &msg);
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
int m_sendCounter = 1;
|
||||
bool m_bConnected = false;
|
||||
};
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@ void TetraPrtCnv::onExerciseChanged()
|
||||
{
|
||||
if (m_pdp->exerciseRadioGroup().id() != m_radioGrpId)
|
||||
if (!updatePrtCnv())
|
||||
ERROR_LOG() << "Error changing PrtCnv state from radio grp id: "
|
||||
ERROR_LOG(m_logger) << "Error changing PrtCnv state from radio grp id: "
|
||||
<< m_radioGrpId
|
||||
<< " to " << m_pdp->exerciseRadioGroup().id();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ bool TetraPrtCnv::updatePrtCnv()
|
||||
if (!QFile::copy(QStringLiteral(":/PrtCnv.dat"), iniFileOut()) ||
|
||||
!QFile::setPermissions(iniFileOut(), QFile::ReadOwner | QFile::WriteOwner))
|
||||
{
|
||||
ERROR_LOG() << "Error creating ini file for PrtCnv: " << iniFileOut();
|
||||
ERROR_LOG(m_logger) << "Error creating ini file for PrtCnv: " << iniFileOut();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,10 +112,10 @@ bool TetraPrtCnv::checkConfigTemplates()
|
||||
{
|
||||
if (!QFile::exists(playerIdsFile()))
|
||||
{
|
||||
INFO_LOG() << "Creating " << playerIdsFile();
|
||||
INFO_LOG(m_logger) << "Creating " << playerIdsFile();
|
||||
if (!QFile::copy(QStringLiteral(":/playerIds.dat"), playerIdsFile()))
|
||||
{
|
||||
ERROR_LOG() << "Error creating " << playerIdsFile();
|
||||
ERROR_LOG(m_logger) << "Error creating " << playerIdsFile();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ Q_SIGNALS:
|
||||
void textMessageToPrtCnv(const QByteArray &message);
|
||||
void broadcastTelegramsRequest(int equipmentNumber, int broadcastIndex, int resetCounter);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void cleanupProcess();
|
||||
static QString iniFileIn();
|
||||
QString iniFileOut() const;
|
||||
|
||||
+3
-3
@@ -67,7 +67,7 @@ void WlsDispatcher::onWlsConnected()
|
||||
|
||||
void WlsDispatcher::onWlsDisconnected()
|
||||
{
|
||||
INFO_LOG() << "Wls socket disconnected";
|
||||
INFO_LOG(m_logger) << "Wls socket disconnected";
|
||||
m_webSocketReconnectTimer->start(5000);
|
||||
m_sendToWls->onWlsDisconnected();
|
||||
|
||||
@@ -85,7 +85,7 @@ void WlsDispatcher::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;
|
||||
@@ -101,7 +101,7 @@ void WlsDispatcher::onTextMessageReceived(const QString &message)
|
||||
|
||||
void WlsDispatcher::onParticipantLicenseChange(const TrainingAreaBase::TetraIcd::ParticipantLicenseChange &lc)
|
||||
{
|
||||
INFO_LOG() << "onParticipantLicenseChange id=" << lc.id()
|
||||
INFO_LOG(m_logger) << "onParticipantLicenseChange id=" << lc.id()
|
||||
<< " equipmentNumber=" << lc.equipmentNumber;
|
||||
m_recvFromWls->participantLicenseChange(lc);
|
||||
}
|
||||
|
||||
+2
@@ -43,8 +43,10 @@ Q_SIGNALS:
|
||||
void wlsTelegramReceived(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele);
|
||||
void wlsTelegramSent(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tele);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QUrl webSocketUrl() const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_recvFromTabCb;
|
||||
std::shared_ptr<WlsHandlerRx> m_recvFromWls;
|
||||
std::shared_ptr<WlsHandlerTx> m_sendToWls;
|
||||
|
||||
+10
-11
@@ -15,11 +15,10 @@ namespace WlsTetra
|
||||
{
|
||||
|
||||
WlsHandlerRx::WlsHandlerRx(const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
||||
WlsDispatcher *dispatcher)
|
||||
: m_rxHandler(recvFromTabCb)
|
||||
WlsDispatcher *dispatcher) : m_rxHandler(recvFromTabCb)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_bWarnedOnce(false)
|
||||
{}
|
||||
, m_bWarnedOnce(false),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
bool WlsHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
{
|
||||
@@ -28,7 +27,7 @@ bool WlsHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
if (baJson.isEmpty())
|
||||
return false;
|
||||
const QJsonObject obj = QJsonDocument::fromJson(baJson).object();
|
||||
TRACE_LOG() << "incoming telegram: " << baJson;
|
||||
TRACE_LOG(m_logger) << "incoming telegram: " << baJson;
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +42,7 @@ bool WlsHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
const QJsonValue typeId = obj.value(QStringLiteral("typeId"));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return false;
|
||||
}
|
||||
const QJsonObject data = obj.value(QStringLiteral("data")).toObject();
|
||||
@@ -70,7 +69,7 @@ bool WlsHandlerRx::handleTelegram(const QByteArray &baJson)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -187,7 +186,7 @@ bool WlsHandlerRx::handleTelegram(TrainingAreaBase::TetraIcd::TrainingAreaTelegr
|
||||
rxData(toSpecialized<ParticipantConfigurationReport>(tabTele));
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG() << "WlsHandlerRx::handleTelegram no Handler for " << tabTele->id();
|
||||
ERROR_LOG(m_logger) << "WlsHandlerRx::handleTelegram no Handler for " << tabTele->id();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -210,7 +209,7 @@ void WlsHandlerRx::sfmData(const TrainingAreaBase::TetraIcd::WlsBinarySfmData &d
|
||||
{
|
||||
if (data.payload.size() < 2)
|
||||
{
|
||||
ERROR_LOG() << "Invalid binary data from WLS: " << QJsonDocument(data.toJson()).toJson(QJsonDocument::Compact);
|
||||
ERROR_LOG(m_logger) << "Invalid binary data from WLS: " << QJsonDocument(data.toJson()).toJson(QJsonDocument::Compact);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +221,7 @@ void WlsHandlerRx::sfmData(const TrainingAreaBase::TetraIcd::WlsBinarySfmData &d
|
||||
TrainingAreaBase::TetraIcd::TrainingAreaTelegram *tabTele = CoPrtCnvTelegramConverter::convertToTabTele(&radio);
|
||||
if (!tabTele)
|
||||
{
|
||||
WARNING_LOG() << "Can not convert binary sfm data to a valid tetra telegram - ignoring ("
|
||||
WARNING_LOG(m_logger) << "Can not convert binary sfm data to a valid tetra telegram - ignoring ("
|
||||
<< data.header.equipmentNumber << "): " << QByteArray::fromRawData(reinterpret_cast<const char *>(data.payload.data()),
|
||||
data.payload.size()).toHex();
|
||||
return;
|
||||
@@ -238,7 +237,7 @@ void WlsHandlerRx::rxData(const T &data)
|
||||
{
|
||||
if (!m_bWarnedOnce)
|
||||
{
|
||||
ERROR_LOG() << "No RecvFromTab available";
|
||||
ERROR_LOG(m_logger) << "No RecvFromTab available";
|
||||
m_bWarnedOnce = true;
|
||||
}
|
||||
return;
|
||||
|
||||
+2
@@ -27,11 +27,13 @@ public:
|
||||
Q_SIGNALS:
|
||||
void participantConnectionState(int equipmentNumber, bool dataCommunicationPossible);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void sfmData(const TrainingAreaBase::TetraIcd::WlsBinarySfmData &data);
|
||||
|
||||
template<typename T>
|
||||
void rxData(const T &data);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<TrainingAreaBase::RecvFromTab> m_rxHandler;
|
||||
QSet<int> m_licensedEquipmentNumbers;
|
||||
WlsDispatcher *m_dispatcher;
|
||||
|
||||
+2
-2
@@ -301,7 +301,7 @@ bool WlsHandlerTx::txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &d
|
||||
|
||||
void WlsHandlerTx::onParticipantConnectionState(int equipmentNumber, bool dataCommunicationPossible)
|
||||
{
|
||||
DEBUG_LOG() << "onParticipantConnectionState - " << equipmentNumber
|
||||
DEBUG_LOG(m_logger) << "onParticipantConnectionState - " << equipmentNumber
|
||||
<< ", communication possible: " << dataCommunicationPossible;
|
||||
m_dataCommunicationPossible[equipmentNumber] = dataCommunicationPossible;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ bool WlsHandlerTx::sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegr
|
||||
|
||||
const QByteArray ba = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
if (data->id() != TrainingAreaBase::TetraIcd::TelegramId::BESTAETIGUNG)
|
||||
DEBUG_LOG() << "Sending tele: " << ba;
|
||||
DEBUG_LOG(m_logger) << "Sending tele: " << ba;
|
||||
m_webSocket->sendTextMessage(QString::fromUtf8(ba));
|
||||
if (!bIsAlreadyLogged)
|
||||
emit m_dispatcher->wlsTelegramSent(data);
|
||||
|
||||
+2
@@ -68,12 +68,14 @@ public:
|
||||
public Q_SLOTS:
|
||||
void onParticipantConnectionState(int equipmentNumber, bool dataCommunicationPossible);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
template <typename T>
|
||||
bool sendToTxBinary(const T *data);
|
||||
bool sendToTx(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *data,
|
||||
bool bForce = false,
|
||||
bool bIsAlreadyLogged = false);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QHash<int, bool> m_dataCommunicationPossible;
|
||||
TrainingAreaBase::Plugin::DataProvider *m_pdp;
|
||||
QWebSocket *m_webSocket;
|
||||
|
||||
Reference in new issue
Block a user