Adds immediate migration results in progress

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

No files matched your search

@@ -13,12 +13,11 @@
namespace TrainingAreaBaseOC
{
TxDdlHandler::TxDdlHandler()
: m_state(DdlState::NotStarted)
TxDdlHandler::TxDdlHandler() : m_state(DdlState::NotStarted)
, m_segmentToggle(0)
, m_sentCnt(0)
, m_responseTimer(new QTimer(this))
{
, m_responseTimer(new QTimer(this)),
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
m_responseTimer->setInterval(1000);
m_responseTimer->setSingleShot(true);
connect(m_responseTimer, &QTimer::timeout, this, &TxDdlHandler::sendAbortOrRestartTimeout);
@@ -46,13 +45,13 @@ void TxDdlHandler::process(const QByteArray &data)
{
case 1:
{
DEBUG_LOG() << "Segment download confirmation received";
DEBUG_LOG(m_logger) << "Segment download confirmation received";
qint32 toggle = ((data[0] & 0x10) >> 4);
if (m_segmentToggle != toggle)
{
ERROR_LOG() << "Toggle bit of confirmation not equal to request";
ERROR_LOG(m_logger) << "Toggle bit of confirmation not equal to request";
sendAbort(130);
}
@@ -62,14 +61,14 @@ void TxDdlHandler::process(const QByteArray &data)
}
case 3:
{
DEBUG_LOG() << "Initiate download confirmation received";
DEBUG_LOG(m_logger) << "Initiate download confirmation received";
if (m_dataToSend.isEmpty())
break;
if (DdlState::Initiated != m_state)
{
ERROR_LOG() << "Initiate download confirmation received but ddl wasn't startet yet.";
ERROR_LOG(m_logger) << "Initiate download confirmation received but ddl wasn't startet yet.";
sendAbort();
break;
}
@@ -78,7 +77,7 @@ void TxDdlHandler::process(const QByteArray &data)
}
case 4:
{
WARNING_LOG() << "Error during domain download";
WARNING_LOG(m_logger) << "Error during domain download";
m_state = DdlState::NotStarted;
if (m_dataToSend.isEmpty())
@@ -90,7 +89,7 @@ void TxDdlHandler::process(const QByteArray &data)
}
default:
ERROR_LOG() << "unknown scs value received: " << scs;
ERROR_LOG(m_logger) << "unknown scs value received: " << scs;
break;
}
}
@@ -115,13 +114,13 @@ void TxDdlHandler::initiateDomainDownload()
{
if (m_dataToSend.isEmpty())
{
ERROR_LOG() << "::initiateDomainDownload called, but no data to send available";
ERROR_LOG(m_logger) << "::initiateDomainDownload called, but no data to send available";
return;
}
if (m_sentCnt >= s_maxResendCnt)
{
ERROR_LOG() << "Maximum trys of resending DDL exceeded. ";
ERROR_LOG(m_logger) << "Maximum trys of resending DDL exceeded. ";
m_dataToSend.removeFirst();
m_sentCnt = 0;
startNextDomainDownload();
@@ -137,7 +136,7 @@ void TxDdlHandler::initiateDomainDownload()
data[6] = ((dataSize >> 16) & 0xFF);
data[7] = ((dataSize >> 24) & 0xFF);
DEBUG_LOG() << "Initiate DDL Req";
DEBUG_LOG(m_logger) << "Initiate DDL Req";
m_state = DdlState::Initiated;
m_sentCnt++;
@@ -149,7 +148,7 @@ void TxDdlHandler::domainDownload()
{
if (m_dataToSend.isEmpty())
{
ERROR_LOG() << "::domainDownload called, but no data to send available";
ERROR_LOG(m_logger) << "::domainDownload called, but no data to send available";
return;
}
@@ -202,7 +201,7 @@ void TxDdlHandler::domainDownload()
m_dataToSend.first().offset = newOffset;
DEBUG_LOG() << "Segment DDL Req";
DEBUG_LOG(m_logger) << "Segment DDL Req";
m_state = DdlState::Downloading;
emit send(data);
@@ -214,7 +213,7 @@ void TxDdlHandler::sendAbort(quint8 error)
QByteArray data(8, '\0');
data[0] = 0x80;
data[1] = error;
DEBUG_LOG() << "Abort DDL Req";
DEBUG_LOG(m_logger) << "Abort DDL Req";
m_state = DdlState::NotStarted;
m_dataToSend.first().offset = 0;
@@ -235,7 +234,7 @@ void RxDdlHandler::process(const QByteArray &data)
case 1:
{
DEBUG_LOG() << "initiate download received";
DEBUG_LOG(m_logger) << "initiate download received";
if (m_isMultiplexed)
m_multiplexer = (((data[1] & 0xFF) << 16) | ((data[2] & 0xFF) << 8) | (data[3] & 0xFF));
@@ -251,10 +250,10 @@ void RxDdlHandler::process(const QByteArray &data)
case 0:
{
DEBUG_LOG() << "download segment received";
DEBUG_LOG(m_logger) << "download segment received";
if (m_state == DdlState::NotStarted)
{
WARNING_LOG() << "download segment and data m_state == DdlState::NotStarted, something went wrong!";
WARNING_LOG(m_logger) << "download segment and data m_state == DdlState::NotStarted, something went wrong!";
sendDPConfirmation(4, 0);
return;
}
@@ -284,14 +283,14 @@ void RxDdlHandler::process(const QByteArray &data)
case 4:
{
DEBUG_LOG() << "abort download received";
DEBUG_LOG(m_logger) << "abort download received";
m_messageData.clear();
m_state = DdlState::NotStarted;
break;
}
default:
{
WARNING_LOG() << "Unknown ccs ID: " << ccs;
WARNING_LOG(m_logger) << "Unknown ccs ID: " << ccs;
break;
}
}
@@ -315,7 +314,7 @@ void RxDdlHandler::sendDPConfirmation(const quint32 ccs, const quint32 toggle, c
else if (1 == toggle)
data[0] = 0x30;
else
WARNING_LOG() << "Unknown toggle state: " << toggle;
WARNING_LOG(m_logger) << "Unknown toggle state: " << toggle;
m_state = DdlState::Downloading;
}
else if (4 == ccs)
@@ -365,7 +364,7 @@ bool CanagHandler::init()
if (!m_handlerAesData->init())
{
ERROR_LOG() << "Could not initialise HandlerAesData.";
ERROR_LOG(m_logger) << "Could not initialise HandlerAesData.";
return false;
}
@@ -459,19 +458,19 @@ bool CanagHandler::txData(const TrainingAreaBase::TetraIcd::OpaquePayloadDataBas
{
case TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type::OC:
{
INFO_LOG() << "adding DDL CanId::CAN_ID_DATENVERKEHR_SRT_KOPPELRECHNER_TX";
INFO_LOG(m_logger) << "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() << "adding DDL CanId::CAN_ID_DATENVERKEHR_DMF_KOPPELRECHNER_TX";
INFO_LOG(m_logger) << "adding DDL CanId::CAN_ID_DATENVERKEHR_DMF_KOPPELRECHNER_TX";
m_txDdlHandler[CanId::FireSmokeMarkerExconDataTx]->addData(LtsUtils::toQByteArray(data.payload));
break;
}
default:
{
ERROR_LOG() << "Tryed to send unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(data.payloadType);
ERROR_LOG(m_logger) << "Tryed to send unhandled TrainingAreaBase::TetraIcd::OpaquePayloadDataBase::Type " << static_cast<int>(data.payloadType);
return false;
}
}
@@ -483,22 +482,22 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
{
if (message.id() == 0)
{
ERROR_LOG() << "Error while receiving data from sfm.";
ERROR_LOG(m_logger) << "Error while receiving data from sfm.";
return;
}
DEBUG_LOG() << "Received new CAN-Message with ID: " << message.id() << " RTR: " << message.rtr() << " data: " << message.payload().toHex(' ');
DEBUG_LOG(m_logger) << "Received new CAN-Message with ID: " << message.id() << " RTR: " << message.rtr() << " data: " << message.payload().toHex(' ');
switch (message.id())
{
case CanId::DemandDeviceId:
{
INFO_LOG() << "Received CanId::DemandDeviceId";
INFO_LOG(m_logger) << "Received CanId::DemandDeviceId";
m_deviceMessageTimer->start();
break;
}
case CanId::Time:
{
DEBUG_LOG() << "Received CanId::Time";
DEBUG_LOG(m_logger) << "Received CanId::Time";
QByteArray data = message.payload();
OcTelegrams::TimeSync outData;
@@ -506,7 +505,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
LtsUtils::get4Byte(data, gpsTime);
outData.gpsTimeMsec = gpsTime * 1000ULL;
outData.timezone = data[4];
DEBUG_LOG() << "Received " << gpsTime;
DEBUG_LOG(m_logger) << "Received " << gpsTime;
sendSyncTime(gpsTime);
m_rxHandler->rxData(outData);
@@ -514,7 +513,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::EnterLeaveAes:
{
INFO_LOG() << "Received CanId::EnterLeaveAes";
INFO_LOG(m_logger) << "Received CanId::EnterLeaveAes";
QByteArray data = message.payload();
OcTelegrams::EnterLeaveAes outData;
@@ -535,13 +534,13 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::ParameterOcRx:
{
INFO_LOG() << "Received CanId::ParameterOcRx";
INFO_LOG(m_logger) << "Received CanId::ParameterOcRx";
send(*m_messages[CanId::ParameterOcTx]);
break;
}
case CanId::TechnicalStateSfm:
{
INFO_LOG() << "Received CanId::TechnicalStateSfm";
INFO_LOG(m_logger) << "Received CanId::TechnicalStateSfm";
QByteArray data = message.payload();
OcTelegrams::TechnicalStateSfm outData;
@@ -566,7 +565,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::TechnicalStateOc:
{
INFO_LOG() << "Received CanId::TechnicalStateOc";
INFO_LOG(m_logger) << "Received CanId::TechnicalStateOc";
if (message.rtr())
send(*m_messages[CanId::TechnicalStateOc]);
@@ -574,42 +573,42 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::ExconOcDataRx:
{
INFO_LOG() << "Received CanId::ExconOcDataRx";
INFO_LOG(m_logger) << "Received CanId::ExconOcDataRx";
QByteArray data = message.payload();
m_rxDdlHandler[CanId::ExconOcDataTx]->process(data);
break;
}
case CanId::OcExconDataRx:
{
INFO_LOG() << "Received CanId::OcExconDataRx";
INFO_LOG(m_logger) << "Received CanId::OcExconDataRx";
QByteArray data = message.payload();
m_txDdlHandler[CanId::OcExconDataTx]->process(data);
break;
}
case CanId::ExconFireSmokeMarkerDataRx:
{
INFO_LOG() << "Received CanId::ExconFireSmokeMarkerDataRx";
INFO_LOG(m_logger) << "Received CanId::ExconFireSmokeMarkerDataRx";
QByteArray data = message.payload();
m_rxDdlHandler[CanId::ExconFireSmokeMarkerDataTx]->process(data);
break;
}
case CanId::FireSmokeMarkerExconDataRx:
{
INFO_LOG() << "Received CanId::FireSmokeMarkerExconDataRx";
INFO_LOG(m_logger) << "Received CanId::FireSmokeMarkerExconDataRx";
QByteArray data = message.payload();
m_txDdlHandler[CanId::FireSmokeMarkerExconDataTx]->process(data);
break;
}
case CanId::AwesDataRx:
{
INFO_LOG() << "Received CanId::AwesDataRx";
INFO_LOG(m_logger) << "Received CanId::AwesDataRx";
QByteArray data = message.payload();
m_rxDdlHandler[CanId::AwesDataTx]->process(data);
break;
}
case CanId::Position:
{
INFO_LOG() << "Received CanId::Position";
INFO_LOG(m_logger) << "Received CanId::Position";
QByteArray data = message.payload();
OcTelegrams::OwnPosition outData;
@@ -626,7 +625,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::DisplayMessage:
{
INFO_LOG() << "Received CanId::DisplayMessage";
INFO_LOG(m_logger) << "Received CanId::DisplayMessage";
handleDisplayMessage(message);
@@ -634,7 +633,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::SpecificsExercise:
{
INFO_LOG() << "Received CanId::SpecificsExercise";
INFO_LOG(m_logger) << "Received CanId::SpecificsExercise";
QByteArray data = message.payload();
OcTelegrams::SpecificsExercise outData;
@@ -662,7 +661,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::SpecificsOc:
{
INFO_LOG() << "Received CanId::SpecificsOc";
INFO_LOG(m_logger) << "Received CanId::SpecificsOc";
if (message.rtr())
send(*m_messages[CanId::SpecificsOc]);
@@ -670,7 +669,7 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::SpecificsEquipment:
{
INFO_LOG() << "Received CanId::SpecificsEquipment";
INFO_LOG(m_logger) << "Received CanId::SpecificsEquipment";
QByteArray data = message.payload();
OcTelegrams::SpecificsEquipment outData;
@@ -695,13 +694,13 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
}
case CanId::ParameterSfmRx:
{
INFO_LOG() << "Received CanId::ParameterSfmRx";
INFO_LOG(m_logger) << "Received CanId::ParameterSfmRx";
break;
}
case CanId::ConnectionTestSfmReply:
{
INFO_LOG() << "Received CanId::TestConnectionSfmReply";
INFO_LOG(m_logger) << "Received CanId::TestConnectionSfmReply";
if (!m_sfmConnectionEstablished)
sendDemandDeviceId();
else
@@ -710,21 +709,21 @@ void CanagHandler::handleSfmTelegram(const LtsUtils::SfmMessage &message)
break;
}
default:
DEBUG_LOG() << "message id " << message.id() << " is not handled!";
DEBUG_LOG(m_logger) << "message id " << message.id() << " is not handled!";
break;
}
}
void CanagHandler::sendDemandDeviceId()
{
INFO_LOG() << "Requesting Device ID.";
INFO_LOG(m_logger) << "Requesting Device ID.";
send(*m_messages[CanId::DemandDeviceId]);
m_deviceMessageTimer->start();
}
void CanagHandler::sendDeviceMessage()
{
INFO_LOG() << "Sending Device ID.";
INFO_LOG(m_logger) << "Sending Device ID.";
send(*m_messages[CanId::DeviceId]);
if (!m_technicalStateSfm.sfmConnected)
demandInitialSfmData();
@@ -816,12 +815,12 @@ void CanagHandler::sendFreeText()
void CanagHandler::sendSyncTime(uint32_t syncTimeSec)
{
INFO_LOG() << "sendSyncTime " << syncTimeSec;
INFO_LOG(m_logger) << "sendSyncTime " << syncTimeSec;
if (syncTimeSec > QDateTime::currentSecsSinceEpoch() - 3 &&
syncTimeSec < QDateTime::currentSecsSinceEpoch() + 3)
{
DEBUG_LOG() << "PartitionTime is Still valid";
DEBUG_LOG(m_logger) << "PartitionTime is Still valid";
return;
}
if (!m_syncSocket->isOpen())
@@ -831,7 +830,7 @@ void CanagHandler::sendSyncTime(uint32_t syncTimeSec)
{
m_syncSocket->write(QByteArray::number(syncTimeSec));
m_syncSocket->flush();
DEBUG_LOG() << "Send: " << syncTimeSec << " " << QByteArray::number(syncTimeSec);
DEBUG_LOG(m_logger) << "Send: " << syncTimeSec << " " << QByteArray::number(syncTimeSec);
}
}
@@ -839,13 +838,13 @@ void CanagHandler::send(const LtsUtils::SfmMessage &message)
{
DEBUG_LOG() << "send message - " << message.id() << " RTR: " << message.rtr();
DEBUG_LOG(m_logger) << "send message - " << message.id() << " RTR: " << message.rtr();
if (!message.payload().isEmpty())
DEBUG_LOG() << " size: " << message.payload().size() << " data: " << message.payload().toHex(' ');
DEBUG_LOG(m_logger) << " size: " << message.payload().size() << " data: " << message.payload().toHex(' ');
if (!m_connectionHandler->send(message))
ERROR_LOG() << "Could not send message!";
ERROR_LOG(m_logger) << "Could not send message!";
else
emit sendMessage(message);
}
@@ -865,15 +864,15 @@ void CanagHandler::openSocket()
m_syncSocket->connectToHost(Settings::hostName(), 13777);
if (!m_syncSocket->waitForConnected())
WARNING_LOG() << "Could not (re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort() << ", error: " << m_syncSocket->errorString();
WARNING_LOG(m_logger) << "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() << "Disconnected from Host";
DEBUG_LOG(m_logger) << "Disconnected from Host";
m_syncSocket->close();
});
DEBUG_LOG() << "(re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort();
DEBUG_LOG(m_logger) << "(re)open tcp destination " << m_syncSocket->peerName() << ":" << m_syncSocket->peerPort();
}
}