Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2785 files changed
+18754
-18316
No files matched your search
@@ -34,7 +34,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# generate taboc_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcTabocCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcTabocCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabocCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -63,7 +63,7 @@ SET(SRCS_client
|
||||
# generate taboc_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV WS svcTabocClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY2(AAR SV WS svcTabocClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabocClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -93,7 +93,7 @@ CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
||||
# Generate taboc_db_impl.cpp/.h, taboc_db.h
|
||||
#CODEGEN_DATABASE(SRCS_server ${xml_FILE})
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV svcTabocServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY2(AAR SV svcTabocServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabocServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
@@ -18,7 +18,6 @@ TxDdlHandler::TxDdlHandler()
|
||||
, m_segmentToggle(0)
|
||||
, m_sentCnt(0)
|
||||
, m_responseTimer(new QTimer(this))
|
||||
, m_logger(getLogger("TxDdlHandler"))
|
||||
{
|
||||
m_responseTimer->setInterval(1000);
|
||||
m_responseTimer->setSingleShot(true);
|
||||
@@ -47,13 +46,13 @@ void TxDdlHandler::process(const QByteArray &data)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Segment download confirmation received";
|
||||
DEBUG_LOG() << "Segment download confirmation received";
|
||||
|
||||
qint32 toggle = ((data[0] & 0x10) >> 4);
|
||||
|
||||
if (m_segmentToggle != toggle)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Toggle bit of confirmation not equal to request";
|
||||
ERROR_LOG() << "Toggle bit of confirmation not equal to request";
|
||||
sendAbort(130);
|
||||
}
|
||||
|
||||
@@ -63,14 +62,14 @@ void TxDdlHandler::process(const QByteArray &data)
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Initiate download confirmation received";
|
||||
DEBUG_LOG() << "Initiate download confirmation received";
|
||||
|
||||
if (m_dataToSend.isEmpty())
|
||||
break;
|
||||
|
||||
if (DdlState::Initiated != m_state)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initiate download confirmation received but ddl wasn't startet yet.";
|
||||
ERROR_LOG() << "Initiate download confirmation received but ddl wasn't startet yet.";
|
||||
sendAbort();
|
||||
break;
|
||||
}
|
||||
@@ -79,7 +78,7 @@ void TxDdlHandler::process(const QByteArray &data)
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error during domain download";
|
||||
WARNING_LOG() << "Error during domain download";
|
||||
|
||||
m_state = DdlState::NotStarted;
|
||||
if (m_dataToSend.isEmpty())
|
||||
@@ -91,7 +90,7 @@ void TxDdlHandler::process(const QByteArray &data)
|
||||
}
|
||||
default:
|
||||
|
||||
ERROR_LOG(m_logger) << "unknown scs value received: " << scs;
|
||||
ERROR_LOG() << "unknown scs value received: " << scs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -116,13 +115,13 @@ void TxDdlHandler::initiateDomainDownload()
|
||||
{
|
||||
if (m_dataToSend.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "::initiateDomainDownload called, but no data to send available";
|
||||
ERROR_LOG() << "::initiateDomainDownload called, but no data to send available";
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_sentCnt >= s_maxResendCnt)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Maximum trys of resending DDL exceeded. ";
|
||||
ERROR_LOG() << "Maximum trys of resending DDL exceeded. ";
|
||||
m_dataToSend.removeFirst();
|
||||
m_sentCnt = 0;
|
||||
startNextDomainDownload();
|
||||
@@ -138,7 +137,7 @@ void TxDdlHandler::initiateDomainDownload()
|
||||
data[6] = ((dataSize >> 16) & 0xFF);
|
||||
data[7] = ((dataSize >> 24) & 0xFF);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Initiate DDL Req";
|
||||
DEBUG_LOG() << "Initiate DDL Req";
|
||||
|
||||
m_state = DdlState::Initiated;
|
||||
m_sentCnt++;
|
||||
@@ -150,7 +149,7 @@ void TxDdlHandler::domainDownload()
|
||||
{
|
||||
if (m_dataToSend.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "::domainDownload called, but no data to send available";
|
||||
ERROR_LOG() << "::domainDownload called, but no data to send available";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -203,7 +202,7 @@ void TxDdlHandler::domainDownload()
|
||||
|
||||
m_dataToSend.first().offset = newOffset;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Segment DDL Req";
|
||||
DEBUG_LOG() << "Segment DDL Req";
|
||||
m_state = DdlState::Downloading;
|
||||
|
||||
emit send(data);
|
||||
@@ -215,7 +214,7 @@ void TxDdlHandler::sendAbort(quint8 error)
|
||||
QByteArray data(8, '\0');
|
||||
data[0] = 0x80;
|
||||
data[1] = error;
|
||||
DEBUG_LOG(m_logger) << "Abort DDL Req";
|
||||
DEBUG_LOG() << "Abort DDL Req";
|
||||
|
||||
m_state = DdlState::NotStarted;
|
||||
m_dataToSend.first().offset = 0;
|
||||
@@ -225,7 +224,6 @@ void TxDdlHandler::sendAbort(quint8 error)
|
||||
|
||||
RxDdlHandler::RxDdlHandler(bool isMultiplexed)
|
||||
: m_isMultiplexed(isMultiplexed)
|
||||
, m_logger(getLogger("RxDdlHandler"))
|
||||
{}
|
||||
|
||||
void RxDdlHandler::process(const QByteArray &data)
|
||||
@@ -237,7 +235,7 @@ void RxDdlHandler::process(const QByteArray &data)
|
||||
|
||||
case 1:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "initiate download received";
|
||||
DEBUG_LOG() << "initiate download received";
|
||||
if (m_isMultiplexed)
|
||||
m_multiplexer = (((data[1] & 0xFF) << 16) | ((data[2] & 0xFF) << 8) | (data[3] & 0xFF));
|
||||
|
||||
@@ -253,10 +251,10 @@ void RxDdlHandler::process(const QByteArray &data)
|
||||
|
||||
case 0:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "download segment received";
|
||||
DEBUG_LOG() << "download segment received";
|
||||
if (m_state == DdlState::NotStarted)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "download segment and data m_state == DdlState::NotStarted, something went wrong!";
|
||||
WARNING_LOG() << "download segment and data m_state == DdlState::NotStarted, something went wrong!";
|
||||
sendDPConfirmation(4, 0);
|
||||
return;
|
||||
}
|
||||
@@ -286,14 +284,14 @@ void RxDdlHandler::process(const QByteArray &data)
|
||||
|
||||
case 4:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "abort download received";
|
||||
DEBUG_LOG() << "abort download received";
|
||||
m_messageData.clear();
|
||||
m_state = DdlState::NotStarted;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Unknown ccs ID: " << ccs;
|
||||
WARNING_LOG() << "Unknown ccs ID: " << ccs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +315,7 @@ void RxDdlHandler::sendDPConfirmation(const quint32 ccs, const quint32 toggle, c
|
||||
else if (1 == toggle)
|
||||
data[0] = 0x30;
|
||||
else
|
||||
WARNING_LOG(m_logger) << "Unknown toggle state: " << toggle;
|
||||
WARNING_LOG() << "Unknown toggle state: " << toggle;
|
||||
m_state = DdlState::Downloading;
|
||||
}
|
||||
else if (4 == ccs)
|
||||
@@ -347,7 +345,6 @@ CanagHandler::CanagHandler(MainHandler *mainHandler)
|
||||
, m_syncSocket(new QTcpSocket(this))
|
||||
, m_technicalStateSfm(OcTelegrams::TechnicalStateSfm())
|
||||
, m_sfmConnectionEstablished(false)
|
||||
, m_logger(getLogger("CanagHandler"))
|
||||
{}
|
||||
|
||||
CanagHandler::~CanagHandler()
|
||||
@@ -368,7 +365,7 @@ bool CanagHandler::init()
|
||||
|
||||
if (!m_handlerAesData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not initialise HandlerAesData.";
|
||||
ERROR_LOG() << "Could not initialise HandlerAesData.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -462,19 +459,19 @@ bool CanagHandler::txData(const TrainingAreaBase::TetraIcd::OpaquePayloadDataBas
|
||||
{
|
||||
case TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type::OC:
|
||||
{
|
||||
INFO_LOG(m_logger) << "adding DDL CanId::CAN_ID_DATENVERKEHR_SRT_KOPPELRECHNER_TX";
|
||||
INFO_LOG() << "adding DDL CanId::CAN_ID_DATENVERKEHR_SRT_KOPPELRECHNER_TX";
|
||||
m_txDdlHandler[CanId::OcExconDataTx]->addData(LtsUtils::toQByteArray(data.payload));
|
||||
break;
|
||||
}
|
||||
case TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type::FireSmokeMarker:
|
||||
{
|
||||
INFO_LOG(m_logger) << "adding DDL CanId::CAN_ID_DATENVERKEHR_DMF_KOPPELRECHNER_TX";
|
||||
INFO_LOG() << "adding DDL CanId::CAN_ID_DATENVERKEHR_DMF_KOPPELRECHNER_TX";
|
||||
m_txDdlHandler[CanId::FireSmokeMarkerExconDataTx]->addData(LtsUtils::toQByteArray(data.payload));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Tryed to send unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(data.payloadType);
|
||||
ERROR_LOG() << "Tryed to send unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(data.payloadType);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -486,22 +483,22 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
{
|
||||
if (message.id() == 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error while receiving data from sfm.";
|
||||
ERROR_LOG() << "Error while receiving data from sfm.";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Received new CAN-Message with ID: " << message.id() << " RTR: " << message.rtr() << " data: " << message.payload().toHex(' ');
|
||||
DEBUG_LOG() << "Received new CAN-Message with ID: " << message.id() << " RTR: " << message.rtr() << " data: " << message.payload().toHex(' ');
|
||||
switch (message.id())
|
||||
{
|
||||
case CanId::DemandDeviceId:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::DemandDeviceId";
|
||||
INFO_LOG() << "Received CanId::DemandDeviceId";
|
||||
m_deviceMessageTimer->start();
|
||||
break;
|
||||
}
|
||||
case CanId::Time:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Received CanId::Time";
|
||||
DEBUG_LOG() << "Received CanId::Time";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::TimeSync outData;
|
||||
|
||||
@@ -509,7 +506,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
LtsUtils::get4Byte(data, gpsTime);
|
||||
outData.gpsTimeMsec = gpsTime * 1000ULL;
|
||||
outData.timezone = data[4];
|
||||
DEBUG_LOG(m_logger) << "Received " << gpsTime;
|
||||
DEBUG_LOG() << "Received " << gpsTime;
|
||||
sendSyncTime(gpsTime);
|
||||
|
||||
m_rxHandler->rxData(outData);
|
||||
@@ -517,7 +514,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::EnterLeaveAes:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::EnterLeaveAes";
|
||||
INFO_LOG() << "Received CanId::EnterLeaveAes";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::EnterLeaveAes outData;
|
||||
|
||||
@@ -538,13 +535,13 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::ParameterOcRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::ParameterOcRx";
|
||||
INFO_LOG() << "Received CanId::ParameterOcRx";
|
||||
send(*m_messages[CanId::ParameterOcTx]);
|
||||
break;
|
||||
}
|
||||
case CanId::TechnicalStateSfm:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::TechnicalStateSfm";
|
||||
INFO_LOG() << "Received CanId::TechnicalStateSfm";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::TechnicalStateSfm outData;
|
||||
|
||||
@@ -569,7 +566,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::TechnicalStateOc:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::TechnicalStateOc";
|
||||
INFO_LOG() << "Received CanId::TechnicalStateOc";
|
||||
|
||||
if (message.rtr())
|
||||
send(*m_messages[CanId::TechnicalStateOc]);
|
||||
@@ -577,42 +574,42 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::ExconOcDataRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::ExconOcDataRx";
|
||||
INFO_LOG() << "Received CanId::ExconOcDataRx";
|
||||
QByteArray data = message.payload();
|
||||
m_rxDdlHandler[CanId::ExconOcDataTx]->process(data);
|
||||
break;
|
||||
}
|
||||
case CanId::OcExconDataRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::OcExconDataRx";
|
||||
INFO_LOG() << "Received CanId::OcExconDataRx";
|
||||
QByteArray data = message.payload();
|
||||
m_txDdlHandler[CanId::OcExconDataTx]->process(data);
|
||||
break;
|
||||
}
|
||||
case CanId::ExconFireSmokeMarkerDataRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::ExconFireSmokeMarkerDataRx";
|
||||
INFO_LOG() << "Received CanId::ExconFireSmokeMarkerDataRx";
|
||||
QByteArray data = message.payload();
|
||||
m_rxDdlHandler[CanId::ExconFireSmokeMarkerDataTx]->process(data);
|
||||
break;
|
||||
}
|
||||
case CanId::FireSmokeMarkerExconDataRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::FireSmokeMarkerExconDataRx";
|
||||
INFO_LOG() << "Received CanId::FireSmokeMarkerExconDataRx";
|
||||
QByteArray data = message.payload();
|
||||
m_txDdlHandler[CanId::FireSmokeMarkerExconDataTx]->process(data);
|
||||
break;
|
||||
}
|
||||
case CanId::AwesDataRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::AwesDataRx";
|
||||
INFO_LOG() << "Received CanId::AwesDataRx";
|
||||
QByteArray data = message.payload();
|
||||
m_rxDdlHandler[CanId::AwesDataTx]->process(data);
|
||||
break;
|
||||
}
|
||||
case CanId::Position:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::Position";
|
||||
INFO_LOG() << "Received CanId::Position";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::OwnPosition outData;
|
||||
|
||||
@@ -629,7 +626,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::DisplayMessage:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::DisplayMessage";
|
||||
INFO_LOG() << "Received CanId::DisplayMessage";
|
||||
|
||||
handleDisplayMessage(message);
|
||||
|
||||
@@ -637,7 +634,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::SpecificsExercise:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::SpecificsExercise";
|
||||
INFO_LOG() << "Received CanId::SpecificsExercise";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::SpecificsExercise outData;
|
||||
|
||||
@@ -665,7 +662,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::SpecificsOc:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::SpecificsOc";
|
||||
INFO_LOG() << "Received CanId::SpecificsOc";
|
||||
|
||||
if (message.rtr())
|
||||
send(*m_messages[CanId::SpecificsOc]);
|
||||
@@ -673,7 +670,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::SpecificsEquipment:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::SpecificsEquipment";
|
||||
INFO_LOG() << "Received CanId::SpecificsEquipment";
|
||||
QByteArray data = message.payload();
|
||||
OcTelegrams::SpecificsEquipment outData;
|
||||
|
||||
@@ -698,13 +695,13 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
}
|
||||
case CanId::ParameterSfmRx:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::ParameterSfmRx";
|
||||
INFO_LOG() << "Received CanId::ParameterSfmRx";
|
||||
|
||||
break;
|
||||
}
|
||||
case CanId::ConnectionTestSfmReply:
|
||||
{
|
||||
INFO_LOG(m_logger) << "Received CanId::TestConnectionSfmReply";
|
||||
INFO_LOG() << "Received CanId::TestConnectionSfmReply";
|
||||
if (!m_sfmConnectionEstablished)
|
||||
sendDemandDeviceId();
|
||||
else
|
||||
@@ -713,21 +710,21 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DEBUG_LOG(m_logger) << "message id " << message.id() << " is not handled!";
|
||||
DEBUG_LOG() << "message id " << message.id() << " is not handled!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CanagHandler::sendDemandDeviceId()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Requesting Device ID.";
|
||||
INFO_LOG() << "Requesting Device ID.";
|
||||
send(*m_messages[CanId::DemandDeviceId]);
|
||||
m_deviceMessageTimer->start();
|
||||
}
|
||||
|
||||
void CanagHandler::sendDeviceMessage()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Sending Device ID.";
|
||||
INFO_LOG() << "Sending Device ID.";
|
||||
send(*m_messages[CanId::DeviceId]);
|
||||
if (!m_technicalStateSfm.sfmConnected)
|
||||
demandInitialSfmData();
|
||||
@@ -819,12 +816,12 @@ void CanagHandler::sendFreeText()
|
||||
|
||||
void CanagHandler::sendSyncTime(uint32_t syncTimeSec)
|
||||
{
|
||||
INFO_LOG(m_logger) << "sendSyncTime " << syncTimeSec;
|
||||
INFO_LOG() << "sendSyncTime " << syncTimeSec;
|
||||
|
||||
if (syncTimeSec > QDateTime::currentSecsSinceEpoch() - 3 &&
|
||||
syncTimeSec < QDateTime::currentSecsSinceEpoch() + 3)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "PartitionTime is Still valid";
|
||||
DEBUG_LOG() << "PartitionTime is Still valid";
|
||||
return;
|
||||
}
|
||||
if (!m_syncSocket->isOpen())
|
||||
@@ -834,7 +831,7 @@ void CanagHandler::sendSyncTime(uint32_t syncTimeSec)
|
||||
{
|
||||
m_syncSocket->write(QByteArray::number(syncTimeSec));
|
||||
m_syncSocket->flush();
|
||||
DEBUG_LOG(m_logger) << "Send: " << syncTimeSec << " " << QByteArray::number(syncTimeSec);
|
||||
DEBUG_LOG() << "Send: " << syncTimeSec << " " << QByteArray::number(syncTimeSec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -842,13 +839,13 @@ void CanagHandler::send(const LtsUtils::SfmMessage &message)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG(m_logger) << "send message - " << message.id() << " RTR: " << message.rtr();
|
||||
DEBUG_LOG() << "send message - " << message.id() << " RTR: " << message.rtr();
|
||||
if (!message.payload().isEmpty())
|
||||
DEBUG_LOG(m_logger) << " size: " << message.payload().size() << " data: " << message.payload().toHex(' ');
|
||||
DEBUG_LOG() << " size: " << message.payload().size() << " data: " << message.payload().toHex(' ');
|
||||
|
||||
|
||||
if (!m_connectionHandler->send(message))
|
||||
ERROR_LOG(m_logger) << "Could not send message!";
|
||||
ERROR_LOG() << "Could not send message!";
|
||||
else
|
||||
emit sendMessage(message);
|
||||
}
|
||||
@@ -868,15 +865,15 @@ void CanagHandler::openSocket()
|
||||
|
||||
m_syncSocket->connectToHost(Settings::hostName(), 13777);
|
||||
if (!m_syncSocket->waitForConnected())
|
||||
WARNING_LOG(m_logger) << "Could not (re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort() << ", error: " << m_syncSocket->errorString();
|
||||
WARNING_LOG() << "Could not (re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort() << ", error: " << m_syncSocket->errorString();
|
||||
else
|
||||
{
|
||||
connect(m_syncSocket, &QTcpSocket::disconnected, this, [this]
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Disconnected from Host";
|
||||
DEBUG_LOG() << "Disconnected from Host";
|
||||
m_syncSocket->close();
|
||||
});
|
||||
DEBUG_LOG(m_logger) << "(re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort();
|
||||
DEBUG_LOG() << "(re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,6 @@ private:
|
||||
QTimer *m_responseTimer;
|
||||
|
||||
QList<DdlData> m_dataToSend;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
class RxDdlHandler : public QObject
|
||||
@@ -96,8 +94,6 @@ private:
|
||||
|
||||
quint32 m_multiplexer = 0;
|
||||
QByteArray m_messageData;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
class CanagHandler : public QObject
|
||||
@@ -208,8 +204,6 @@ private:
|
||||
QMap<CanId, LtsUtils::SfmMessage *> m_messages;
|
||||
QMap<CanId, TxDdlHandler *> m_txDdlHandler;
|
||||
QMap<CanId, RxDdlHandler *> m_rxDdlHandler;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+10
-11
@@ -13,7 +13,6 @@ namespace TrainingAreaBaseOC
|
||||
ConnectionHandlerSerial::ConnectionHandlerSerial()
|
||||
: m_spQuerry(new LtsSerialPortQuerry::LtsSerialPortQuerry(this))
|
||||
, m_receiveTimeoutTimer(new QTimer(this))
|
||||
, m_logger(getLogger("ConnectionHandlerSerial"))
|
||||
{
|
||||
connect(m_spQuerry, &LtsSerialPortQuerry::LtsSerialPortQuerry::connectionEstablished, this, &ConnectionHandlerSerial::open);
|
||||
m_spQuerry->restartQuerry();
|
||||
@@ -35,25 +34,25 @@ bool ConnectionHandlerSerial::send(const LtsUtils::SfmMessage &message)
|
||||
|
||||
if (!m_serialPort->isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Port is not opened!";
|
||||
ERROR_LOG() << "Port is not opened!";
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray data = LtsUtils::byteStreamFromSfmMessage(message);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Sending frame: " << data.toHex(' ');
|
||||
DEBUG_LOG() << "Sending frame: " << data.toHex(' ');
|
||||
|
||||
const qint64 byteswritten = m_serialPort->write(data);
|
||||
m_serialPort->flush();
|
||||
|
||||
if (byteswritten == -1)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to write data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
ERROR_LOG() << "Failed to write data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
return false;
|
||||
}
|
||||
else if (byteswritten != data.size())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to write all data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
ERROR_LOG() << "Failed to write all data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -84,7 +83,7 @@ void ConnectionHandlerSerial::read()
|
||||
const QByteArray ba = m_serialPort->readAll();
|
||||
m_currentDataRead.append(ba);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Binary data from sfm: " << ba.toHex(' ');
|
||||
DEBUG_LOG() << "Binary data from sfm: " << ba.toHex(' ');
|
||||
|
||||
int idxStart = -1;
|
||||
int idxEnd = -1;
|
||||
@@ -95,21 +94,21 @@ void ConnectionHandlerSerial::read()
|
||||
QByteArray message = m_currentDataRead.mid(idxStart, (idxEnd - idxStart) + 1);
|
||||
|
||||
LtsUtils::SfmMessage sfmMsg;
|
||||
DEBUG_LOG(m_logger) << "Frame from sfm as binary " << message.toHex();
|
||||
DEBUG_LOG() << "Frame from sfm as binary " << message.toHex();
|
||||
try
|
||||
{
|
||||
sfmMsg = LtsUtils::byteStreamToSfmMessage(message);
|
||||
}
|
||||
catch (const LtsUtils::ConversionError &ex)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "Faulty Data from sfm as binary " << message.toHex();
|
||||
ERROR_LOG() << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG() << "Faulty Data from sfm as binary " << message.toHex();
|
||||
m_currentDataRead = m_currentDataRead.mid(idxEnd + 1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
INFO_LOG() << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
|
||||
m_receiveTimeoutTimer->start();
|
||||
|
||||
@@ -119,7 +118,7 @@ void ConnectionHandlerSerial::read()
|
||||
}
|
||||
|
||||
if (m_serialPort->bytesAvailable() > 0)
|
||||
DEBUG_LOG(m_logger) << "Still " << m_serialPort->bytesAvailable() << " available to be read";
|
||||
DEBUG_LOG() << "Still " << m_serialPort->bytesAvailable() << " available to be read";
|
||||
}
|
||||
|
||||
|
||||
|
||||
-2
@@ -42,8 +42,6 @@ private:
|
||||
QTimer *m_receiveTimeoutTimer = nullptr;
|
||||
QByteArray m_currentDataRead;
|
||||
int m_errCnt = 0;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+16
-17
@@ -12,7 +12,6 @@ namespace TrainingAreaBaseOC
|
||||
|
||||
ConnectionHandlerTcp::ConnectionHandlerTcp()
|
||||
: m_timer(new QTimer(this))
|
||||
, m_logger(getLogger("ConnectionHandlerTcp"))
|
||||
{
|
||||
m_timer->setInterval(5000);
|
||||
connect(m_timer, &QTimer::timeout, this, &ConnectionHandlerTcp::open);
|
||||
@@ -45,25 +44,25 @@ bool ConnectionHandlerTcp::send(const LtsUtils::SfmMessage &message)
|
||||
|
||||
if (!m_socket->isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Port is not opened!";
|
||||
ERROR_LOG() << "Port is not opened!";
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray data = LtsUtils::byteStreamFromSfmMessage(message);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Sending frame: " << data.toHex(' ');
|
||||
DEBUG_LOG() << "Sending frame: " << data.toHex(' ');
|
||||
|
||||
const qint64 byteswritten = m_socket->write(data);
|
||||
|
||||
if (byteswritten == -1)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to write data to port " << m_socket->peerPort() << " error: " << m_socket->errorString();
|
||||
ERROR_LOG() << "Failed to write data to port " << m_socket->peerPort() << " error: " << m_socket->errorString();
|
||||
m_timer->start();
|
||||
return false;
|
||||
}
|
||||
else if (byteswritten != data.size())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Failed to write all data to port " << m_socket->peerPort() << " error: " << m_socket->errorString();
|
||||
ERROR_LOG() << "Failed to write all data to port " << m_socket->peerPort() << " error: " << m_socket->errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,10 +75,10 @@ bool ConnectionHandlerTcp::open()
|
||||
m_socket->connectToHost(Settings::hostName(), Settings::port());
|
||||
if (!m_socket->waitForConnected())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not (re)open tcp destination " << m_socket->peerName() << ":" << m_socket->peerPort() << ", error: " << m_socket->errorString();
|
||||
ERROR_LOG() << "Could not (re)open tcp destination " << m_socket->peerName() << ":" << m_socket->peerPort() << ", error: " << m_socket->errorString();
|
||||
return false;
|
||||
}
|
||||
INFO_LOG(m_logger) << "(Re)openend tcp destination " << m_socket->peerName() << ":" << Settings::port();
|
||||
INFO_LOG() << "(Re)openend tcp destination " << m_socket->peerName() << ":" << Settings::port();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,7 +97,7 @@ void ConnectionHandlerTcp::read()
|
||||
const QByteArray ba = m_socket->readAll();
|
||||
m_currentDataRead.append(ba);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Binary data from sfm: " << ba.toHex(' ');
|
||||
DEBUG_LOG() << "Binary data from sfm: " << ba.toHex(' ');
|
||||
|
||||
int idxStart = -1;
|
||||
int idxEnd = -1;
|
||||
@@ -108,7 +107,7 @@ void ConnectionHandlerTcp::read()
|
||||
QByteArray message = m_currentDataRead.mid(idxStart, (idxEnd - idxStart) + 1);
|
||||
|
||||
LtsUtils::SfmMessage sfmMsg;
|
||||
DEBUG_LOG(m_logger) << "Frame from sfm as binary " << message.toHex();
|
||||
DEBUG_LOG() << "Frame from sfm as binary " << message.toHex();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -116,11 +115,11 @@ void ConnectionHandlerTcp::read()
|
||||
}
|
||||
catch (const LtsUtils::ConversionError &ex)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "Faulty Data from sfm as binary " << message.toHex();
|
||||
ERROR_LOG() << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG() << "Faulty Data from sfm as binary " << message.toHex();
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
INFO_LOG() << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
|
||||
m_currentDataRead = m_currentDataRead.mid(idxEnd + 1);
|
||||
|
||||
@@ -128,12 +127,12 @@ void ConnectionHandlerTcp::read()
|
||||
}
|
||||
|
||||
if (m_socket->bytesAvailable() > 0)
|
||||
DEBUG_LOG(m_logger) << "Still " << m_socket->bytesAvailable() << " available to be read";
|
||||
DEBUG_LOG() << "Still " << m_socket->bytesAvailable() << " available to be read";
|
||||
}
|
||||
|
||||
void ConnectionHandlerTcp::handleError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
DEBUG_LOG() << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
|
||||
const QString errStr(QStringLiteral("QTcpSocket::SocketError ") + QString::number(error) +
|
||||
QStringLiteral(" from tcp port ") + QString::number(m_socket->peerPort()) +
|
||||
@@ -145,20 +144,20 @@ void ConnectionHandlerTcp::handleError(QAbstractSocket::SocketError error)
|
||||
case QTcpSocket::SocketError::SocketAccessError:
|
||||
case QTcpSocket::SocketError::SocketResourceError:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Closing port trying to reopen it.";
|
||||
ERROR_LOG() << "Closing port trying to reopen it.";
|
||||
close();
|
||||
m_timer->start();
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QTcpSocket::SocketError::RemoteHostClosedError:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Host closed trying to reopen.";
|
||||
ERROR_LOG() << "Host closed trying to reopen.";
|
||||
m_timer->start();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << errStr;
|
||||
ERROR_LOG() << errStr;
|
||||
close();
|
||||
m_timer->start();
|
||||
break;
|
||||
|
||||
@@ -41,8 +41,6 @@ private:
|
||||
QTcpSocket *m_socket = nullptr;
|
||||
QTimer *m_timer = nullptr;
|
||||
QByteArray m_currentDataRead;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+16
-17
@@ -21,7 +21,6 @@ ConnectionHandlerTcpTtci::ConnectionHandlerTcpTtci()
|
||||
, m_segmentToggle(0)
|
||||
, m_canDevice(new Device(this))
|
||||
, m_canChannel(new Channel(QLatin1Char('@'), true, this))
|
||||
, m_logger(getLogger("TTCI"))
|
||||
{
|
||||
connect(m_canChannel, &Channel::dataAvailable, this, &ConnectionHandlerTcpTtci::slotReadCanFrame);
|
||||
connect(m_canChannel, &Channel::disconnectedFromEq, this, &ConnectionHandlerTcpTtci::disconnectedFromEq);
|
||||
@@ -43,7 +42,7 @@ bool ConnectionHandlerTcpTtci::init()
|
||||
|
||||
void ConnectionHandlerTcpTtci::initCanSocket()
|
||||
{
|
||||
ERROR_LOG(m_logger) << "InitCantSOcket";
|
||||
ERROR_LOG() << "InitCantSOcket";
|
||||
|
||||
m_canChannel->setDevice(m_canDevice);
|
||||
m_canDevice->open();
|
||||
@@ -54,10 +53,10 @@ bool ConnectionHandlerTcpTtci::findNextSyncByte(int &iCurReadPos) const
|
||||
{
|
||||
if (iCurReadPos == m_buffer.size())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No more data available";
|
||||
DEBUG_LOG() << "No more data available";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Searching for next sync byte, start at: " << iCurReadPos;
|
||||
DEBUG_LOG() << "Searching for next sync byte, start at: " << iCurReadPos;
|
||||
NGL::NGLLoggerHelper::hexDumpHelper(m_logger, NGL::LogLevel::Debug, m_buffer);
|
||||
|
||||
while (iCurReadPos < m_buffer.size())
|
||||
@@ -71,7 +70,7 @@ bool ConnectionHandlerTcpTtci::findNextSyncByte(int &iCurReadPos) const
|
||||
|
||||
if (m_buffer.size() < 4 + iCurReadPos)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Could not find sync byte in stream";
|
||||
DEBUG_LOG() << "Could not find sync byte in stream";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -84,11 +83,11 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
int iCurReadPos = 0;
|
||||
while (findNextSyncByte(iCurReadPos))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Found Sync byte at " << iCurReadPos;
|
||||
DEBUG_LOG() << "Found Sync byte at " << iCurReadPos;
|
||||
|
||||
|
||||
unsigned int len = (m_buffer.at(iCurReadPos + 1) & 0xF0) >> 4;
|
||||
DEBUG_LOG(m_logger) << "Payload size: " << len;
|
||||
DEBUG_LOG() << "Payload size: " << len;
|
||||
|
||||
if (len > 8)
|
||||
{
|
||||
@@ -97,22 +96,22 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
{
|
||||
case 9:
|
||||
|
||||
DEBUG_LOG(m_logger) << "Read status data - skipping ";
|
||||
DEBUG_LOG() << "Read status data - skipping ";
|
||||
iCurReadPos += 4;
|
||||
break;
|
||||
case 11:
|
||||
|
||||
DEBUG_LOG(m_logger) << "Read communication SFM - PAN - skipping ";
|
||||
DEBUG_LOG() << "Read communication SFM - PAN - skipping ";
|
||||
iCurReadPos += 5;
|
||||
break;
|
||||
case 12:
|
||||
|
||||
DEBUG_LOG(m_logger) << "Read parameter request - skipping ";
|
||||
DEBUG_LOG() << "Read parameter request - skipping ";
|
||||
iCurReadPos += 5;
|
||||
break;
|
||||
default:
|
||||
|
||||
WARNING_LOG(m_logger) << "Invalid payload size (" << len << " - skipping";
|
||||
WARNING_LOG() << "Invalid payload size (" << len << " - skipping";
|
||||
++iCurReadPos;
|
||||
break;
|
||||
}
|
||||
@@ -125,7 +124,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
int neededBytes = 4 + len + iCurReadPos;
|
||||
if (m_buffer.size() < neededBytes)
|
||||
{
|
||||
INFO_LOG(m_logger) << "To few bytes in buffer - waiting for more (want: "
|
||||
INFO_LOG() << "To few bytes in buffer - waiting for more (want: "
|
||||
<< neededBytes << " have: " << m_buffer.size() << ")";
|
||||
|
||||
break;
|
||||
@@ -135,7 +134,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
unsigned char id2 = m_buffer.at(iCurReadPos + 2);
|
||||
id = ((id << 8) + id2);
|
||||
bool rtr = ((m_buffer.at(iCurReadPos + 1) & 0x08) == 0x08);
|
||||
DEBUG_LOG(m_logger) << "CAN ID: " << id << " rtr: " << rtr;
|
||||
DEBUG_LOG() << "CAN ID: " << id << " rtr: " << rtr;
|
||||
|
||||
|
||||
unsigned char crc = 0;
|
||||
@@ -147,7 +146,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
if (crc != crcSent)
|
||||
{
|
||||
|
||||
WARNING_LOG(m_logger) << "CRC checksum missmatch (is: " << crcSent
|
||||
WARNING_LOG() << "CRC checksum missmatch (is: " << crcSent
|
||||
<< " - calculated: " << crc << ") - skipping";
|
||||
iCurReadPos++;
|
||||
continue;
|
||||
@@ -180,7 +179,7 @@ bool ConnectionHandlerTcpTtci::send(const LtsUtils::SfmMessage &message)
|
||||
if (message.payload().size() > 8)
|
||||
return false;
|
||||
|
||||
INFO_LOG(m_logger) << "start write";
|
||||
INFO_LOG() << "start write";
|
||||
NGL::NGLLoggerHelper::hexDumpHelper(m_logger, NGL::LogLevel::Debug, message.payload());
|
||||
|
||||
QByteArray data(message.payload().size() + 4, Qt::Uninitialized);
|
||||
@@ -197,10 +196,10 @@ bool ConnectionHandlerTcpTtci::send(const LtsUtils::SfmMessage &message)
|
||||
crc += data.at(i);
|
||||
crc = ~crc;
|
||||
data[message.payload().size() + 3] = crc;
|
||||
INFO_LOG(m_logger) << "end write ";
|
||||
INFO_LOG() << "end write ";
|
||||
|
||||
if (!m_canChannel->writeData(data))
|
||||
ERROR_LOG(m_logger) << "Error writing data to can channel";
|
||||
ERROR_LOG() << "Error writing data to can channel";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
-2
@@ -61,8 +61,6 @@ private:
|
||||
Device *m_canDevice;
|
||||
Channel *m_canChannel;
|
||||
QByteArray m_buffer;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -10,16 +10,15 @@ namespace TrainingAreaBaseOC
|
||||
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34,23 +33,23 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
m_dtsTaboc = Interface::Dts::create(m_ddsConnector);
|
||||
bRet &= m_dtsTaboc->enableAll();
|
||||
INFO_LOG(m_logger) << "Dts TrainingAreaBaseOc initialised";
|
||||
INFO_LOG() << "Dts TrainingAreaBaseOc initialised";
|
||||
|
||||
m_dtcTaboc = Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_dtsTaboc->enableSpecificsEquipment();
|
||||
INFO_LOG(m_logger) << "Dtc TrainingAreaBaseOc initialised";
|
||||
INFO_LOG() << "Dtc TrainingAreaBaseOc initialised";
|
||||
|
||||
m_ftsTaboc = Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ftsTaboc->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts TrainingAreaBaseOc initialised";
|
||||
INFO_LOG() << "Fts TrainingAreaBaseOc initialised";
|
||||
|
||||
m_dtsTab = TrainingAreaBase::Interface::Dts::create(m_ddsConnector);
|
||||
bRet &= (m_dtsTab->enableOcData() && m_dtsTab->enableFireSmokeMarkerData());
|
||||
INFO_LOG(m_logger) << "Dts TrainingAreaBase initialised";
|
||||
INFO_LOG() << "Dts TrainingAreaBase initialised";
|
||||
|
||||
m_ftsTab = TrainingAreaBase::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= (m_ftsTab->enableSendOcData() && m_ftsTab->enableSendFireSmokeMarkerData());
|
||||
INFO_LOG(m_logger) << "Fts TrainingAreaBase initialised";
|
||||
INFO_LOG() << "Fts TrainingAreaBase initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,6 @@ private:
|
||||
std::shared_ptr<Interface::Fts> m_ftsTaboc;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_dtsTab;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Fts> m_ftsTab;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
+68
-69
@@ -32,7 +32,6 @@ HandlerAesData::HandlerAesData(const std::shared_ptr<DdsHandler> &dds,
|
||||
, m_aesFtc(aesFtc)
|
||||
, m_pdmDtc(pdmDtc)
|
||||
, m_utmCoord(LtsCoordTrans::UtmCoordinate::fromMgrs(Settings::baseCoord()))
|
||||
, m_logger(getLogger("HandlerAesData"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +41,7 @@ bool HandlerAesData::init()
|
||||
if (!m_aesDtc->enableBCContamination() || !m_aesDtc->enableExplosionArea() || !m_aesDtc->enableExplosionSingle() || !m_aesDtc->enableFunctionalArea()
|
||||
|| !m_aesDtc->enableNContamination() || !m_aesDtc->enableMineArea() || !m_aesDtc->enableExplosionCluster())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error enabling AES Data-Topics.";
|
||||
ERROR_LOG() << "Error enabling AES Data-Topics.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ bool HandlerAesData::init()
|
||||
|| !m_aesFtc->enableMineAreaRemove() || !m_aesFtc->enableExplosionClusterRemove() || !m_aesFtc->enableExplosionAreaPauseResume()
|
||||
|| !m_aesFtc->enableMineAreaReferenceModify())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error enabling AES Function-Topics.";
|
||||
ERROR_LOG() << "Error enabling AES Function-Topics.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ bool HandlerAesData::init()
|
||||
|
||||
if (!m_pdmDtc->enableChargeType() || !m_pdmDtc->enableGearTypeChargeType() || !m_pdmDtc->enableGearType())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error enabling PDM Data-Topic.";
|
||||
ERROR_LOG() << "Error enabling PDM Data-Topic.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,11 +70,11 @@ bool HandlerAesData::init()
|
||||
|| !m_aesDtc->waitForHistoricalDataNContamination(10000) || !m_aesDtc->waitForHistoricalDataMineArea(10000)
|
||||
|| !m_aesDtc->waitForHistoricalDataExplosionCluster(10000))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error waiting for historical data AES.";
|
||||
ERROR_LOG() << "Error waiting for historical data AES.";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Initialisation successful";
|
||||
DEBUG_LOG() << "Initialisation successful";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ void HandlerAesData::process(const QByteArray &data, int multiplexer)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WARNING_LOG(m_logger) << "Got unknown multiplexer.";
|
||||
WARNING_LOG() << "Got unknown multiplexer.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,121 +139,121 @@ void HandlerAesData::specificsExercise(const OcTelegrams::SpecificsExercise &dat
|
||||
void HandlerAesData::onMineAreaModifyFromCtaDataReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Mine area modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "Mine area modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Mine area modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Mine area modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onNContaminationModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "N contamination modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "N contamination modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "N contamination modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "N contamination modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onFunctionalAreaModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Functional area modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "Functional area modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Functional area modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Functional area modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionSingleModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Explosion single modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "Explosion single modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Explosion single modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Explosion single modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionAreaModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Explosion area modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "Explosion area modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Explosion area modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Explosion area modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onBCContaminationModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "BC contamination modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "BC contamination modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "BC contamination modify successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "BC contamination modify successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionClusterOcModifyReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "ExplosionCluster modify failed: " << reply.translated();
|
||||
ERROR_LOG() << "ExplosionCluster modify failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "ExplosionCluster successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "ExplosionCluster successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onMineAreaRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Mine area remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "Mine area remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Mine area remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Mine area remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onNContaminationRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "N contamination remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "N contamination remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "N contamination remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "N contamination remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onFunctionalAreaRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Functional area remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "Functional area remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Functional area remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Functional area remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionSingleRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Explosion single remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "Explosion single remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Explosion single remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Explosion single remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionAreaRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Explosion area remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "Explosion area remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Explosion area remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Explosion area remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onBCContaminationRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "BC contamination remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "BC contamination remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "BC contamination remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "BC contamination remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionClusterRemoveReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "ExplosionCluster remove failed: " << reply.translated();
|
||||
ERROR_LOG() << "ExplosionCluster remove failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "ExplosionCluster remove successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "ExplosionCluster remove successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
void HandlerAesData::onExplosionAreaPauseResumeReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
if (reply.error())
|
||||
ERROR_LOG(m_logger) << "Explosion area pause/resume failed: " << reply.translated();
|
||||
ERROR_LOG() << "Explosion area pause/resume failed: " << reply.translated();
|
||||
else
|
||||
DEBUG_LOG(m_logger) << "Explosion area pause/resume successfull. Id: " << reply.id();
|
||||
DEBUG_LOG() << "Explosion area pause/resume successfull. Id: " << reply.id();
|
||||
}
|
||||
|
||||
template <typename T> static inline void getBasicData(const QByteArray &data, size_t &pos, T &req, bool withoutEffectStart = false)
|
||||
@@ -301,8 +300,8 @@ static inline double mathToCompassAngle(int mathDegree)
|
||||
|
||||
void HandlerAesData::bcContaminations(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new BC contamination data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new BC contamination data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->bCContaminations().keys();
|
||||
|
||||
@@ -341,7 +340,7 @@ void HandlerAesData::bcContaminations(const QByteArray &data)
|
||||
req.chargeTypeId(chargeTypeIdFromChargeTasCode(ProjectDataManagement::GearClass_def::Biological, tmp));
|
||||
LtsUtils::get1Byte(data, pos, tmp);
|
||||
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "BC contamination: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "BC contamination: " << req;
|
||||
|
||||
aesToBeDeleted.removeAll(req.id());
|
||||
req.id(req.id() * -1);
|
||||
@@ -355,7 +354,7 @@ void HandlerAesData::bcContaminations(const QByteArray &data)
|
||||
continue;
|
||||
if (m_aesDtc->bCContamination(id).effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing BC contamination id: " << id;
|
||||
DEBUG_LOG() << "Removing BC contamination id: " << id;
|
||||
m_aesFtc->bCContaminationRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -363,8 +362,8 @@ void HandlerAesData::bcContaminations(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::explosionAreas(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new explosion cluster data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new explosion cluster data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->explosionClusters().keys();
|
||||
|
||||
@@ -442,12 +441,12 @@ void HandlerAesData::explosionAreas(const QByteArray &data)
|
||||
LtsUtils::get3Byte(data, pos, tmp);
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "New ExplosionClusterOcModifyRequest: "
|
||||
DEBUG_LOG() << "New ExplosionClusterOcModifyRequest: "
|
||||
<< "\nid:" << req.id() << "\nname:" << req.name() << "\neffectStart:" << req.effectStart() << "\neffectDuration:" << req.effectDuration()
|
||||
<< "\narea:" << req.area() << "\nmhpCount:" << req.mhpCount() << "\nmhpRotation:" << req.mhpRotation() << "\nimpactCount:" << req.impactCount()
|
||||
<< "\nchargeTypeId:" << req.chargeStruct().chargeTypeId() << "\npartyId:" << req.partyId();
|
||||
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "explosion cluster: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "explosion cluster: " << req;
|
||||
aesToBeDeleted.removeOne(req.id());
|
||||
req.id(req.id() * -1);
|
||||
|
||||
@@ -467,7 +466,7 @@ void HandlerAesData::explosionAreas(const QByteArray &data)
|
||||
||
|
||||
(exp.effectStateId().underlying() == AreaEffectSimulation::AesEffectState::EsPaused))))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing explosion cluster with id: " << id;
|
||||
DEBUG_LOG() << "Removing explosion cluster with id: " << id;
|
||||
m_aesFtc->explosionClusterRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -475,8 +474,8 @@ void HandlerAesData::explosionAreas(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::explosionSingles(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new explosion single data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new explosion single data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->explosionSingles().keys();
|
||||
|
||||
@@ -503,7 +502,7 @@ void HandlerAesData::explosionSingles(const QByteArray &data)
|
||||
req.chargeTypeId(chargeTypeIdFromChargeTasCode(ProjectDataManagement::GearClass_def::Artillery, tmp));
|
||||
if (req.chargeTypeId() == 0)
|
||||
req.chargeTypeId(chargeTypeIdFromChargeTasCode(ProjectDataManagement::GearClass_def::Mortar, tmp));
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "explosion single: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "explosion single: " << req;
|
||||
|
||||
aesToBeDeleted.removeAll(req.id());
|
||||
req.id(req.id() * -1);
|
||||
@@ -518,7 +517,7 @@ void HandlerAesData::explosionSingles(const QByteArray &data)
|
||||
if ((exp.effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
|
||||
&& (exp.effectStart().is_set() && (exp.effectStart().get() > (m_dds->currentPartitionTime() + 5000))))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing explosion single id: " << id;
|
||||
DEBUG_LOG() << "Removing explosion single id: " << id;
|
||||
m_aesFtc->explosionSingleRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -526,8 +525,8 @@ void HandlerAesData::explosionSingles(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::functionalAreas(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got functional area data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got functional area data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->functionalAreas().keys();
|
||||
|
||||
@@ -572,7 +571,7 @@ void HandlerAesData::functionalAreas(const QByteArray &data)
|
||||
req.medicTime(tmp * 10 * 60 * 1000);
|
||||
req.chargeTypeId(411);
|
||||
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "functional area: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "functional area: " << req;
|
||||
|
||||
aesToBeDeleted.removeAll(req.id());
|
||||
req.id(req.id() * -1);
|
||||
@@ -586,7 +585,7 @@ void HandlerAesData::functionalAreas(const QByteArray &data)
|
||||
continue;
|
||||
if (m_aesDtc->functionalArea(id).effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing functional area id: " << id;
|
||||
DEBUG_LOG() << "Removing functional area id: " << id;
|
||||
m_aesFtc->functionalAreaRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -594,8 +593,8 @@ void HandlerAesData::functionalAreas(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::nContaminations(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new N contamination data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new N contamination data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->nContaminations().keys();
|
||||
|
||||
@@ -629,7 +628,7 @@ void HandlerAesData::nContaminations(const QByteArray &data)
|
||||
|
||||
req.chargeTypeId(chargeTypeIdFromChargeTasCode(ProjectDataManagement::GearClass_def::Nuclear, 1));
|
||||
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "N contamination: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "N contamination: " << req;
|
||||
|
||||
aesToBeDeleted.removeAll(req.id());
|
||||
req.id(req.id() * -1);
|
||||
@@ -643,7 +642,7 @@ void HandlerAesData::nContaminations(const QByteArray &data)
|
||||
continue;
|
||||
if (m_aesDtc->nContamination(id).effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing N contamination id: " << id;
|
||||
DEBUG_LOG() << "Removing N contamination id: " << id;
|
||||
m_aesFtc->nContaminationRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -651,8 +650,8 @@ void HandlerAesData::nContaminations(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::mineAreas(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new mine area data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new mine area data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
QList<int> aesToBeDeleted = m_aesDtc->mineAreas().keys();
|
||||
|
||||
@@ -701,7 +700,7 @@ void HandlerAesData::mineAreas(const QByteArray &data)
|
||||
|
||||
req.isCenterLine(true);
|
||||
|
||||
DEBUG_LOG(m_logger) << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "mine area: " << req;
|
||||
DEBUG_LOG() << (aesToBeDeleted.contains(req.id()) ? "Modifying " : "Creating ") << "mine area: " << req;
|
||||
|
||||
aesToBeDeleted.removeAll(req.id());
|
||||
req.id(req.id() * -1);
|
||||
@@ -716,7 +715,7 @@ void HandlerAesData::mineAreas(const QByteArray &data)
|
||||
continue;
|
||||
if (m_aesDtc->mineArea(id).effectStateId().underlying() > AreaEffectSimulation::AesEffectState::EsRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing mine area id: " << id;
|
||||
DEBUG_LOG() << "Removing mine area id: " << id;
|
||||
m_aesFtc->mineAreaRemoveRequest(Core::RemoveElementRequest(id), this);
|
||||
}
|
||||
}
|
||||
@@ -724,8 +723,8 @@ void HandlerAesData::mineAreas(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::explosionAreasPause(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new explosion area pause data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new explosion area pause data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
size_t pos = 0;
|
||||
int cnt;
|
||||
@@ -735,7 +734,7 @@ void HandlerAesData::explosionAreasPause(const QByteArray &data)
|
||||
for (int i = 0; i < cnt; ++i)
|
||||
{
|
||||
LtsUtils::get2Byte(data, pos, id);
|
||||
DEBUG_LOG(m_logger) << "Pausing ID: " << id;
|
||||
DEBUG_LOG() << "Pausing ID: " << id;
|
||||
m_aesFtc->explosionAreaPauseResumeRequest(AreaEffectSimulation::ExplosionAreaPauseResumeRequest(id,
|
||||
false,
|
||||
dds::core::optional<rti::core::int64>(),
|
||||
@@ -747,8 +746,8 @@ void HandlerAesData::explosionAreasPause(const QByteArray &data)
|
||||
|
||||
void HandlerAesData::explosionAreasResume(const QByteArray &data)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Got new explosion area resume data";
|
||||
DEBUG_LOG(m_logger) << "Binary data: " << data.toHex(' ');
|
||||
INFO_LOG() << "Got new explosion area resume data";
|
||||
DEBUG_LOG() << "Binary data: " << data.toHex(' ');
|
||||
|
||||
size_t pos = 0;
|
||||
int cnt;
|
||||
@@ -767,7 +766,7 @@ void HandlerAesData::explosionAreasResume(const QByteArray &data)
|
||||
req.timeToResume(dds::core::optional<rti::core::int64>(tmp * 1000));
|
||||
LtsUtils::get2Byte(data, pos, tmp);
|
||||
req.remainingDuration(dds::core::optional<int32_t>(tmp));
|
||||
DEBUG_LOG(m_logger) << "Resuming: " << req;
|
||||
DEBUG_LOG() << "Resuming: " << req;
|
||||
m_aesFtc->explosionAreaPauseResumeRequest(req, this);
|
||||
}
|
||||
}
|
||||
@@ -780,7 +779,7 @@ int HandlerAesData::chargeTypeIdFromChargeTasCode(ProjectDataManagement::GearCla
|
||||
{
|
||||
if (!m_pdmDtc->waitForHistoricalDataChargeType(20000))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not read charge types from PDM";
|
||||
ERROR_LOG() << "Can not read charge types from PDM";
|
||||
QCoreApplication::exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "taboc_export.h"
|
||||
#include "svctaboccommon_export.h"
|
||||
|
||||
namespace TrainingAreaBaseOC
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ MainHandler::MainHandler(QObject *parent)
|
||||
, m_rxHandler(nullptr)
|
||||
, m_ftsHandler(nullptr)
|
||||
, m_websocketHandler(nullptr)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
@@ -41,28 +40,28 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not initialise DdsHandler.";
|
||||
ERROR_LOG() << "Could not initialise DdsHandler.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_aesDtc = AreaEffectSimulation::Interface::Dtc::create(m_ddsHandler->ddsConnector());
|
||||
DEBUG_LOG(m_logger) << "Created AES Dtc";
|
||||
DEBUG_LOG() << "Created AES Dtc";
|
||||
|
||||
|
||||
m_aesFtc = AreaEffectSimulation::Interface::Ftc::create(m_ddsHandler->ddsConnector());
|
||||
DEBUG_LOG(m_logger) << "Created AES Ftc";
|
||||
DEBUG_LOG() << "Created AES Ftc";
|
||||
|
||||
|
||||
m_pdmDtc = ProjectDataManagement::Interface::Dtc::create(m_ddsHandler->ddsConnector());
|
||||
DEBUG_LOG(m_logger) << "Created PDM Dtc";
|
||||
DEBUG_LOG() << "Created PDM Dtc";
|
||||
|
||||
|
||||
m_connectionHandler = std::make_shared<ConnectionHandler>();
|
||||
|
||||
if (!m_connectionHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not initialise ConnectionHandler.";
|
||||
ERROR_LOG() << "Could not initialise ConnectionHandler.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
|
||||
if (!m_canagHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not initialise CanagHandler.";
|
||||
ERROR_LOG() << "Could not initialise CanagHandler.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,5 @@ private:
|
||||
std::shared_ptr<RecvFromTab> m_rxHandler;
|
||||
std::shared_ptr<RecvFromDdsFts> m_ftsHandler;
|
||||
std::shared_ptr<WebsocketHandler> m_websocketHandler;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -17,7 +17,6 @@ RecvFromDdsFts::RecvFromDdsFts(MainHandler *mainHandler)
|
||||
, m_ftsTaboc(mainHandler->dds()->ftsTaboc())
|
||||
, m_ftsTab(mainHandler->dds()->ftsTab())
|
||||
, m_txCallback(mainHandler->txHandler())
|
||||
, m_logger(getLogger("RecvFromDdsFts"))
|
||||
{}
|
||||
|
||||
void RecvFromDdsFts::onDemandCyclicPositionsRequest(const rti::core::SampleIdentity &cookie, const DemandCyclicPositionsRequest &request)
|
||||
|
||||
@@ -34,7 +34,6 @@ private:
|
||||
std::shared_ptr<Interface::Fts> m_ftsTaboc;
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Fts> m_ftsTab;
|
||||
std::shared_ptr<SendToTab> m_txCallback;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -15,7 +15,6 @@ SendToDds::SendToDds(MainHandler *mainHandler)
|
||||
, m_dtsTab(mainHandler->dds()->dtsTab())
|
||||
, m_utmCoord(LtsCoordTrans::UtmCoordinate())
|
||||
, m_idToSend(1)
|
||||
, m_logger(getLogger("EtsRxDds"))
|
||||
{}
|
||||
|
||||
void SendToDds::rxData(const OcTelegrams::Display &inData)
|
||||
@@ -163,7 +162,7 @@ void SendToDds::rxData(const TrainingAreaBase::TetraIcd::OpaquePayloadDataBase &
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Received unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(inData.payloadType);
|
||||
ERROR_LOG() << "Received unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(inData.payloadType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,5 @@ private:
|
||||
LtsCoordTrans::UtmCoordinate m_utmCoord;
|
||||
|
||||
int m_idToSend;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
}
|
||||
@@ -34,7 +34,7 @@ bool Channel::writeData(const QByteArray &data)
|
||||
{
|
||||
if (!m_device || !m_device->isOpen())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Error writing data - device is not open" ;
|
||||
WARNING_LOG() << "Error writing data - device is not open" ;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ void Channel::onDeviceDestroyed()
|
||||
|
||||
void Channel::onDataAvailable(const QByteArray &data)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "Data available from "
|
||||
TRACE_LOG() << "Data available from "
|
||||
<< ", we are: " << m_channel
|
||||
<< ", data: '" << data << "'" ;
|
||||
emit dataAvailable(data);
|
||||
|
||||
@@ -39,6 +39,5 @@ protected:
|
||||
QChar m_channel;
|
||||
bool m_bIsBinary;
|
||||
Device *m_device;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
@@ -36,7 +36,7 @@ Device::~Device()
|
||||
|
||||
void Device::reOpen()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ConnectionHandlerSerial::reOpen";
|
||||
DEBUG_LOG() << "ConnectionHandlerSerial::reOpen";
|
||||
close();
|
||||
QTimer::singleShot(2000, this, &Device::open);
|
||||
}
|
||||
@@ -52,19 +52,19 @@ bool Device::open()
|
||||
m_socket->connectToHost(Settings::hostName(), Settings::portTtci());
|
||||
if (!m_socket->waitForConnected())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not (re)open tcp destination " << m_socket->peerName() << ":" << m_socket->peerPort() << ", error: " << m_socket->errorString();
|
||||
ERROR_LOG() << "Could not (re)open tcp destination " << m_socket->peerName() << ":" << m_socket->peerPort() << ", error: " << m_socket->errorString();
|
||||
return false;
|
||||
}
|
||||
connect(m_socket, &QTcpSocket::readyRead, this, &Device::onDataAvailable);
|
||||
connect(m_socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), this, &Device::handleError);
|
||||
connect(m_socket, &QTcpSocket::disconnected, this, &Device::open);
|
||||
DEBUG_LOG(m_logger) << "(Re)openend tcp destination " << m_socket->peerName() << ":" << Settings::portTtci();
|
||||
DEBUG_LOG() << "(Re)openend tcp destination " << m_socket->peerName() << ":" << Settings::portTtci();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
m_serialPort = m_spQuerry->currentSerialPort();
|
||||
DEBUG_LOG(m_logger) << "(Re)openend serial destination " << m_serialPort->portName() << ":";
|
||||
DEBUG_LOG() << "(Re)openend serial destination " << m_serialPort->portName() << ":";
|
||||
|
||||
connect(m_serialPort, &QSerialPort::readyRead, this, &Device::onDataAvailable);
|
||||
|
||||
@@ -79,7 +79,7 @@ bool Device::close()
|
||||
{
|
||||
if (m_socket->isOpen())
|
||||
m_socket->close();
|
||||
DEBUG_LOG(m_logger) << "Closing TCP Port";
|
||||
DEBUG_LOG() << "Closing TCP Port";
|
||||
delete m_socket;
|
||||
m_socket = nullptr;
|
||||
m_receiveTimeoutTimer->stop();
|
||||
@@ -110,7 +110,7 @@ void Device::onDataAvailable()
|
||||
|
||||
void Device::parseBuffer()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Buffer - size: " << m_buffer.size()
|
||||
DEBUG_LOG() << "Buffer - size: " << m_buffer.size()
|
||||
<< ", data: " << m_buffer.toHex() ;
|
||||
|
||||
|
||||
@@ -118,21 +118,21 @@ void Device::parseBuffer()
|
||||
int idxStart = -1;
|
||||
while ((idxStart = m_buffer.indexOf(0x02)) >= 0)
|
||||
{
|
||||
TRACE_LOG(m_logger) << "idxStart: " << idxStart ;
|
||||
TRACE_LOG() << "idxStart: " << idxStart ;
|
||||
|
||||
int idxLen = idxStart + 1;
|
||||
if (idxLen >= m_buffer.size())
|
||||
return;
|
||||
|
||||
unsigned char len = static_cast<unsigned char>(m_buffer.at(idxLen));
|
||||
TRACE_LOG(m_logger) << "idxLen: " << idxLen
|
||||
TRACE_LOG() << "idxLen: " << idxLen
|
||||
<< ", len: " << len
|
||||
<< " = 0x" << QByteArray::number(len, 16);
|
||||
int idxCrc = idxLen + len + 1;
|
||||
int idxEnd = idxCrc + 1;
|
||||
if (idxEnd >= m_buffer.size())
|
||||
return;
|
||||
TRACE_LOG(m_logger) << "idxCrc: " << idxCrc
|
||||
TRACE_LOG() << "idxCrc: " << idxCrc
|
||||
<< ", idxEnd: " << idxEnd ;
|
||||
if (idxEnd >= m_buffer.size())
|
||||
return;
|
||||
@@ -141,7 +141,7 @@ void Device::parseBuffer()
|
||||
if (m_buffer.at(idxEnd) != 0x03)
|
||||
{
|
||||
|
||||
WARNING_LOG(m_logger) << "Could not find valid end marker - searching new start marker"
|
||||
WARNING_LOG() << "Could not find valid end marker - searching new start marker"
|
||||
;
|
||||
m_buffer = m_buffer.mid(1);
|
||||
continue;
|
||||
@@ -149,12 +149,12 @@ void Device::parseBuffer()
|
||||
|
||||
unsigned char crc = static_cast<unsigned char>(m_buffer.at(idxCrc));
|
||||
unsigned char crcCalc = calcChecksum(m_buffer.mid(idxStart, idxCrc - idxStart));
|
||||
TRACE_LOG(m_logger) << "crc: " << crc
|
||||
TRACE_LOG() << "crc: " << crc
|
||||
<< ", calculated: " << crcCalc
|
||||
;
|
||||
if (crc != crcCalc)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Invalid checksum - is: " << crcCalc
|
||||
WARNING_LOG() << "Invalid checksum - is: " << crcCalc
|
||||
<< " - should be: " << crc ;
|
||||
}
|
||||
|
||||
@@ -163,15 +163,15 @@ void Device::parseBuffer()
|
||||
|
||||
if (len == 255 || !m_payload.isEmpty())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "telegram with more than 254 bytes ..." ;
|
||||
DEBUG_LOG() << "telegram with more than 254 bytes ..." ;
|
||||
|
||||
if (len == 255 && m_payload.isEmpty())
|
||||
DEBUG_LOG(m_logger) << "Remember the payload destination: " << destination ;
|
||||
DEBUG_LOG() << "Remember the payload destination: " << destination ;
|
||||
m_payload += payload;
|
||||
if (len != 255)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "destination: " << destination
|
||||
DEBUG_LOG() << "destination: " << destination
|
||||
<< ", data: " << m_payload.toHex() ;
|
||||
emit dataAvailable(m_payload);
|
||||
m_payload.clear();
|
||||
@@ -180,7 +180,7 @@ void Device::parseBuffer()
|
||||
else
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "destination: " << destination
|
||||
DEBUG_LOG() << "destination: " << destination
|
||||
<< ", data: " << payload.toHex() ;
|
||||
emit dataAvailable(payload);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ bool Device::writeData(const QChar destination, const QByteArray &payload)
|
||||
if ((m_tcpMode && !m_socket->isOpen()) || (!m_tcpMode && !m_serialPort->isOpen()))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Writing " << payload.size()
|
||||
DEBUG_LOG() << "Writing " << payload.size()
|
||||
<< " Bytes to channel " << destination ;
|
||||
|
||||
QByteArray data = payload;
|
||||
@@ -215,7 +215,7 @@ bool Device::writeData(const QChar destination, const QByteArray &payload)
|
||||
buf.append(calcChecksum(buf));
|
||||
buf.append(0x03);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Writing: " << buf.toHex() ;
|
||||
DEBUG_LOG() << "Writing: " << buf.toHex() ;
|
||||
if (m_tcpMode)
|
||||
m_socket->write(buf);
|
||||
else
|
||||
@@ -245,7 +245,7 @@ unsigned char Device::calcChecksum(const QByteArray &checksumData)
|
||||
|
||||
void Device::handleError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
DEBUG_LOG() << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
|
||||
const QString errStr(QStringLiteral("QTcpSocket::SocketError ") + QString::number(error) +
|
||||
QStringLiteral(" from tcp port ") + QString::number(m_socket->peerPort()) +
|
||||
@@ -257,20 +257,20 @@ void Device::handleError(QAbstractSocket::SocketError error)
|
||||
case QTcpSocket::SocketError::SocketAccessError:
|
||||
case QTcpSocket::SocketError::SocketResourceError:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Closing port trying to reopen it.";
|
||||
ERROR_LOG() << "Closing port trying to reopen it.";
|
||||
close();
|
||||
m_restartTimer->start();
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QTcpSocket::SocketError::RemoteHostClosedError:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Host closed trying to reopen.";
|
||||
ERROR_LOG() << "Host closed trying to reopen.";
|
||||
m_restartTimer->start();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << errStr;
|
||||
ERROR_LOG() << errStr;
|
||||
close();
|
||||
m_restartTimer->start();
|
||||
break;
|
||||
@@ -280,7 +280,7 @@ void Device::handleError(QAbstractSocket::SocketError error)
|
||||
|
||||
void Device::handleSerialError(QSerialPort::SerialPortError error)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
DEBUG_LOG() << "Spontaneous error " << error << " doesn't have to be an error ...";
|
||||
|
||||
const QString errStr(QStringLiteral("QSerialPort::SerialPortError ") + QString::number(error) +
|
||||
QStringLiteral(" error: ") + m_serialPort->errorString());
|
||||
@@ -293,13 +293,13 @@ void Device::handleSerialError(QSerialPort::SerialPortError error)
|
||||
case QSerialPort::SerialPortError::PermissionError:
|
||||
case QSerialPort::SerialPortError::WriteError:
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Closing port trying to reopen it.";
|
||||
WARNING_LOG() << "Closing port trying to reopen it.";
|
||||
m_restartTimer->start();
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
default:
|
||||
{
|
||||
WARNING_LOG(m_logger) << errStr;
|
||||
WARNING_LOG() << errStr;
|
||||
m_restartTimer->start();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,5 @@ private:
|
||||
QTimer *m_receiveTimeoutTimer = nullptr;
|
||||
int m_errCnt = 0;
|
||||
bool m_tcpMode = false;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
+9
-10
@@ -17,7 +17,6 @@ WebsocketHandler::WebsocketHandler(QObject *parent, int exerciseId,
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_dtsTaboc(dtsTabOc)
|
||||
, m_dtcTaboc(dtcTabOc)
|
||||
, m_logger(getLogger("WebSocketHandler"))
|
||||
{
|
||||
m_tryConnectionTimer = new QTimer(this);
|
||||
connect(m_tryConnectionTimer, &QTimer::timeout, this, &WebsocketHandler::onTryConnectionTimerTimeout);
|
||||
@@ -132,12 +131,12 @@ void WebsocketHandler::onSendOwnPosition(const QString &message)
|
||||
QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
if (!doc.isObject())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No Valid Object in " << message;
|
||||
WARNING_LOG() << "No Valid Object in " << message;
|
||||
return;
|
||||
}
|
||||
if (doc.object().value(QStringLiteral("data")).toObject().isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No Data Array in" << message;
|
||||
WARNING_LOG() << "No Data Array in" << message;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +149,7 @@ void WebsocketHandler::onSendOwnPosition(const QString &message)
|
||||
|
||||
if (obj.contains(QStringLiteral("lon")) && obj.contains(QStringLiteral("lat")))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Got message with position";
|
||||
DEBUG_LOG() << "Got message with position";
|
||||
outData.position(Core::GeoPosition(obj.value(QStringLiteral("lon")).toDouble(),obj.value(QStringLiteral("lat")).toDouble(),obj.value(QStringLiteral("height")).toDouble()));
|
||||
outData.timeStamp(QDateTime::currentMSecsSinceEpoch());
|
||||
if (obj.contains(QStringLiteral("buildingId")) && obj.contains(QStringLiteral("roomId")) )
|
||||
@@ -169,32 +168,32 @@ void WebsocketHandler::onSendOwnPosition(const QString &message)
|
||||
void WebsocketHandler::connectToServer()
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "Try connect to servicemanagement " << QUrl(QStringLiteral("ws://")+Settings::remoteServerHostname()+QStringLiteral(":")+ QString::number(7300)).toString();
|
||||
DEBUG_LOG() << "Try connect to servicemanagement " << QUrl(QStringLiteral("ws://")+Settings::remoteServerHostname()+QStringLiteral(":")+ QString::number(7300)).toString();
|
||||
m_socket->open(QUrl(QStringLiteral("ws://")+Settings::remoteServerHostname()+QStringLiteral(":")+ QString::number(7300)));
|
||||
}
|
||||
|
||||
void WebsocketHandler::sendServicePortRequest()
|
||||
{
|
||||
m_socket->sendTextMessage(QStringLiteral("{\"type\": \"servicePortsInformationRequest\",\"uuid\": \"7777\"}"));
|
||||
DEBUG_LOG(m_logger) << "Wait For Services Reply";
|
||||
DEBUG_LOG() << "Wait For Services Reply";
|
||||
}
|
||||
|
||||
void WebsocketHandler::parseServices(const QString &message)
|
||||
{
|
||||
m_tryConnectionTimer->stop();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Received SERVICES MESSAGE: " << message;
|
||||
DEBUG_LOG() << "Received SERVICES MESSAGE: " << message;
|
||||
m_socket->close();
|
||||
int exPort = -1;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
if (!doc.isObject())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No Valid Object in " << message;
|
||||
WARNING_LOG() << "No Valid Object in " << message;
|
||||
return;
|
||||
}
|
||||
if (!doc.object().value(QStringLiteral("data")).isArray())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No Data Array in" << message;
|
||||
WARNING_LOG() << "No Data Array in" << message;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,7 +227,7 @@ void WebsocketHandler::parseServices(const QString &message)
|
||||
|
||||
if (exPort > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Connect To ppm ON: " << exPort;
|
||||
DEBUG_LOG() << "Connect To ppm ON: " << exPort;
|
||||
connectToExPPM(exPort);
|
||||
m_state = WebSocketState::CONNECTTOPPM;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user