Fix LogView consistency and LtsUtilsGuiDds link after the merge
- LogView: take the complete XmlPatterns (d327c66c4) file set - the
auto-merged mix (XmlPatterns .cpp + validation .hpp) left duplicated
m_logger members and constructor signature mismatches, because the
two lineages reworked the module differently.
- LogView CMakeLists: the cleanup version (separate LogViewLogger
static library, required by tabPluginTetraJson and present in the
Release 2 target list).
- LtsUtilsGuiDds: link ddscore (BUILD_RTI) for the Core::FunctionReply
symbols, as in story/release-2-cleanup.
Full-scope ninja all is green; ctest 20/22 (the two failures,
GrantleeParserSmoke and utils_test, are out of the driver's 46-target
scope and 'Not Run' in the official baseline).
This commit is contained in:
1 parent
edd5e3ba81
commit
473462cbdb
42 files changed
+2779
-3251
No files matched your search
@@ -17,7 +17,8 @@
|
||||
#include <TrainingAreaBase/training_area_telegrams.h>
|
||||
|
||||
static QSet<int> s_eqIds;
|
||||
template <typename T> bool validEqId(const T &tele)
|
||||
template <typename T>
|
||||
bool validEqId(const T &tele)
|
||||
{
|
||||
if (!s_eqIds.isEmpty() && !s_eqIds.contains(tele.header.equipmentNumber))
|
||||
return false;
|
||||
@@ -38,28 +39,31 @@ int main(int argc, char **argv)
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
// Check alle 30 Sekunden
|
||||
|
||||
NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx_tetra.props", false);
|
||||
|
||||
NGL::INGLLogger &logger(NGL::NGLLoggerBootstrap::getNGLRootLogger());
|
||||
|
||||
if (app.arguments().count() < 3)
|
||||
{
|
||||
ERROR_LOG(logger) << "Usage: " << app.arguments().at(0) << " <logfile> <telId> <equipId>";
|
||||
ERROR_LOG(logger) << "Usage: " << app.arguments().at(0)
|
||||
<< " <logfile> <telId> <equipId>";
|
||||
return 1;
|
||||
}
|
||||
|
||||
QFile telegramFile(app.arguments().at(1));
|
||||
if (!telegramFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
ERROR_LOG(logger) << "Error opening " << telegramFile.fileName() << " for reading: " << telegramFile.errorString();
|
||||
ERROR_LOG(logger) << "Error opening " << telegramFile.fileName()
|
||||
<< " for reading: " << telegramFile.errorString();
|
||||
return 2;
|
||||
}
|
||||
bool bOk;
|
||||
int telIdToSearch = app.arguments().at(2).toUShort(&bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG(logger) << "Error reading telId - not a (valid) number: " << app.arguments().at(2);
|
||||
ERROR_LOG(logger) << "Error reading telId - not a (valid) number: "
|
||||
<< app.arguments().at(2);
|
||||
return 3;
|
||||
}
|
||||
s_eqIds.clear();
|
||||
@@ -68,102 +72,119 @@ int main(int argc, char **argv)
|
||||
int eqId = app.arguments().at(i).toUShort(&bOk);
|
||||
if (!bOk)
|
||||
{
|
||||
ERROR_LOG(logger) << "Error reading equipId - not a (valid) number: " << app.arguments().at(i);
|
||||
ERROR_LOG(logger) << "Error reading equipId - not a (valid) number: "
|
||||
<< app.arguments().at(i);
|
||||
return 4;
|
||||
}
|
||||
s_eqIds += eqId;
|
||||
}
|
||||
|
||||
//fprintf(stdout, "Counter;EqID;TelID;TelTime;LogTime;Diff\n");
|
||||
|
||||
while (true)
|
||||
{
|
||||
// read the header of telegram-entry
|
||||
|
||||
N_CoPrtCnv::CoPrtCnvLogHeader lh;
|
||||
if (sizeof(lh) == telegramFile.read((char *)&lh, sizeof(lh)))
|
||||
{
|
||||
if (lh.m_Version == 3)
|
||||
{
|
||||
// read the telegram itself
|
||||
|
||||
qint64 telegramLength = lh.m_Length - sizeof(lh);
|
||||
QByteArray telegramData(telegramLength, Qt::Uninitialized);
|
||||
if (telegramLength == telegramFile.read(telegramData.data(), telegramLength))
|
||||
{
|
||||
// add the telegram to telegram-list
|
||||
N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol dest =
|
||||
(N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol)(lh.m_Protocol & N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolMask);
|
||||
|
||||
N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol dest = (N_CoPrtCnv::CoPrtCnvLogHeader::E_CoPrtCnvProtocol)
|
||||
(lh.m_Protocol & N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolMask);
|
||||
|
||||
switch (dest)
|
||||
{
|
||||
case N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolCentral:
|
||||
case N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolCentral:
|
||||
{
|
||||
const QJsonObject obj = QJsonDocument::fromJson(telegramData).object();
|
||||
int telId = obj.value(QStringLiteral("typeId")).toInt();
|
||||
if (telIdToSearch != telId)
|
||||
continue;
|
||||
|
||||
const QJsonObject objData = obj.value(QStringLiteral("data")).toObject();
|
||||
|
||||
const QByteArray tBA = formatTime(lh.m_Time);
|
||||
const char *timeStr = tBA.constData();
|
||||
|
||||
switch (telId)
|
||||
{
|
||||
const QJsonObject obj = QJsonDocument::fromJson(telegramData).object();
|
||||
int telId = obj.value(QStringLiteral("typeId")).toInt();
|
||||
if (telIdToSearch != telId)
|
||||
continue;
|
||||
|
||||
const QJsonObject objData = obj.value(QStringLiteral("data")).toObject();
|
||||
case Constraints<CreateFunctionalArea>::id():
|
||||
{
|
||||
const CreateFunctionalArea tele(CreateFunctionalArea::fromJson(objData));
|
||||
if (!validEqId(tele))
|
||||
break;
|
||||
fprintf(stdout, "%s, FUNKTIONSRAUM: '%s', %d, %d\n",
|
||||
timeStr,
|
||||
tele.name.c_str(),
|
||||
tele.aesDdsId,
|
||||
tele.header.equipmentNumber
|
||||
);
|
||||
break;
|
||||
}
|
||||
case Constraints<DeactivateEffectSimulation>::id():
|
||||
{
|
||||
const DeactivateEffectSimulation tele(DeactivateEffectSimulation::fromJson(objData));
|
||||
fprintf(stdout, "%s, DEAKTIVIERUNG_WIRKFELD: typ: %d - kennung: %d\n",
|
||||
timeStr,
|
||||
int(tele.aesType),
|
||||
tele.aesDdsId
|
||||
);
|
||||
break;
|
||||
}
|
||||
case Constraints<PositionReport>::id():
|
||||
{
|
||||
const PositionReport tele(PositionReport::fromJson(objData));
|
||||
if (!validEqId(tele))
|
||||
break;
|
||||
if (tele.opsPosition.opsId == 0)
|
||||
break;
|
||||
fprintf(stdout, "%s, IPS_POSITIONSDATEN: %d - OPS: %d\n",
|
||||
timeStr,
|
||||
tele.header.equipmentNumber,
|
||||
tele.opsPosition.opsId
|
||||
);
|
||||
break;
|
||||
}
|
||||
case BESTAETIGUNG:
|
||||
case UMGEBUNGS_MELDUNG2:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Printing telegram with id %d not implemented\n", telId);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolTetra:
|
||||
{
|
||||
N_CoPrtCnv::CoPrtCnvRadioTelegram radioTelegram(telegramData);
|
||||
gef_telegramm_id_et telId = radioTelegram.getTelID();
|
||||
if (telId == GEF_UMGEBUNGS_MELDUNG2)
|
||||
{
|
||||
const QByteArray tBA = formatTime(lh.m_Time);
|
||||
const char *timeStr = tBA.constData();
|
||||
|
||||
switch (telId)
|
||||
static uint16_t bci = 0xFFFF;
|
||||
if (bci != radioTelegram.getBroadcastIndex())
|
||||
{
|
||||
case Constraints<CreateFunctionalArea>::id():
|
||||
if (bci > radioTelegram.getBroadcastIndex() && bci != 0xFFFF)
|
||||
{
|
||||
const CreateFunctionalArea tele(CreateFunctionalArea::fromJson(objData));
|
||||
if (!validEqId(tele))
|
||||
break;
|
||||
fprintf(stdout, "%s, FUNKTIONSRAUM: '%s', %d, %d\n", timeStr, tele.name.c_str(), tele.aesDdsId, tele.header.equipmentNumber);
|
||||
break;
|
||||
fprintf(stdout, "BCI reset in %s at %s!\n",
|
||||
qPrintable(telegramFile.fileName()),
|
||||
timeStr);
|
||||
}
|
||||
case Constraints<DeactivateEffectSimulation>::id():
|
||||
{
|
||||
const DeactivateEffectSimulation tele(DeactivateEffectSimulation::fromJson(objData));
|
||||
fprintf(stdout, "%s, DEAKTIVIERUNG_WIRKFELD: typ: %d - kennung: %d\n", timeStr, int(tele.aesType), tele.aesDdsId);
|
||||
break;
|
||||
}
|
||||
case Constraints<PositionReport>::id():
|
||||
{
|
||||
const PositionReport tele(PositionReport::fromJson(objData));
|
||||
if (!validEqId(tele))
|
||||
break;
|
||||
if (tele.opsPosition.opsId == 0)
|
||||
break;
|
||||
fprintf(stdout, "%s, IPS_POSITIONSDATEN: %d - OPS: %d\n", timeStr, tele.header.equipmentNumber, tele.opsPosition.opsId);
|
||||
break;
|
||||
}
|
||||
case BESTAETIGUNG:
|
||||
case UMGEBUNGS_MELDUNG2:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Printing telegram with id %d not implemented\n", telId);
|
||||
break;
|
||||
fprintf(stdout, "BCI: %d\n", radioTelegram.getBroadcastIndex());
|
||||
bci = radioTelegram.getBroadcastIndex();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case N_CoPrtCnv::CoPrtCnvLogHeader::e_DestProtocolTetra:
|
||||
{
|
||||
N_CoPrtCnv::CoPrtCnvRadioTelegram radioTelegram(telegramData);
|
||||
gef_telegramm_id_et telId = radioTelegram.getTelID();
|
||||
if (telId == GEF_UMGEBUNGS_MELDUNG2)
|
||||
{
|
||||
const QByteArray tBA = formatTime(lh.m_Time);
|
||||
const char *timeStr = tBA.constData();
|
||||
static uint16_t bci = 0xFFFF;
|
||||
if (bci != radioTelegram.getBroadcastIndex())
|
||||
{
|
||||
if (bci > radioTelegram.getBroadcastIndex() && bci != 0xFFFF)
|
||||
{
|
||||
fprintf(stdout, "BCI reset in %s at %s!\n", qPrintable(telegramFile.fileName()), timeStr);
|
||||
}
|
||||
fprintf(stdout, "BCI: %d\n", radioTelegram.getBroadcastIndex());
|
||||
bci = radioTelegram.getBroadcastIndex();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user