Adds q2 repos to migrate

This commit is contained in:
torsten committed 2026-07-14 12:07:36 +02:00
1 parent ad1f62c4ee
commit 17f1c61c9e
991 files changed
+178451

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#
# $Id$
# $HeadURL$
# $Author$
#
SET(my_SRCS
tetra_telegram_ids.h
CoPrtCnvCentralTelegram.cpp
CoPrtCnvCentralTelegram.hpp
CoPrtCnvHexDumpHelper.cpp
CoPrtCnvHexDumpHelper.hpp
CoPrtCnvInjectionHeader.hpp
CoPrtCnvLogHeader.hpp
CoPrtCnvRadioTelegram.cpp
CoPrtCnvRadioTelegram.hpp
CoPrtCnvTelegramConverter.hpp
CoPrtCnvTelegramConverterNewIcd.cpp
)
NGL_ADD_LIBRARY2(AAR SV CoPrtCnv SHARED ${my_SRCS} ${my_HDRS})
NGL_TARGET_LINK_LIBRARIES(CoPrtCnv
PUBLIC
NGLLogger
tabTelegrams
)
NGL_TARGET_INCLUDE_DIRECTORIES(CoPrtCnv
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/../
)
@@ -0,0 +1,82 @@
#include "CoPrtCnvCentralTelegram.hpp"
#include <QJsonDocument>
namespace N_CoPrtCnv
{
void CoPrtCnvCentralTelegram::setData(const QByteArray &data)
{
m_data = data;
m_json = QJsonObject();
}
QByteArray CoPrtCnvCentralTelegram::data()
{
ensureByteArray();
return m_data;
}
QJsonObject CoPrtCnvCentralTelegram::json()
{
ensureJson();
return m_json;
}
QJsonObject CoPrtCnvCentralTelegram::jsonData()
{
return json()[QStringLiteral("data")].toObject();
}
TrainingAreaBase::TetraIcd::TelegramId CoPrtCnvCentralTelegram::telegramId()
{
if (m_telegramId != TrainingAreaBase::TetraIcd::UNKNOWN)
return m_telegramId;
ensureJson();
m_telegramId = static_cast<TrainingAreaBase::TetraIcd::TelegramId>(m_json[QStringLiteral("typeId")].toInt());
return m_telegramId;
}
void CoPrtCnvCentralTelegram::setCounter(qint32 counter)
{
if (m_json.isEmpty())
m_json = QJsonDocument::fromJson(m_data).object();
m_json[QStringLiteral("counter")] = counter;
m_data.clear();
}
qint32 CoPrtCnvCentralTelegram::counter()
{
ensureJson();
const QString key(QStringLiteral("counter"));
const QJsonValue sendCounter(m_json[key]);
if (!sendCounter.isDouble())
throw TrainingAreaBase::TetraIcd::JsonException(m_json, key);
return sendCounter.toInt(-1);
}
void CoPrtCnvCentralTelegram::ensureJson()
{
if (m_json.isEmpty())
{
if (m_data.isEmpty())
return;
m_json = QJsonDocument::fromJson(m_data).object();
}
}
void CoPrtCnvCentralTelegram::ensureByteArray()
{
if (m_data.isEmpty())
{
if (m_json.isEmpty())
return;
m_data = QJsonDocument(m_json).toJson(QJsonDocument::Compact);
}
}
}
@@ -0,0 +1,60 @@
#pragma once
#include <QJsonObject>
#include <QByteArray>
#include <CoPrtCnv/coprtcnv_export.h>
#include <TrainingAreaBase/training_area_telegrams.h>
namespace N_CoPrtCnv
{
class COPRTCNV_EXPORT CoPrtCnvCentralTelegram final
{
public:
explicit CoPrtCnvCentralTelegram(TrainingAreaBase::TetraIcd::TelegramId telegramId)
: m_telegramId(telegramId)
{}
explicit CoPrtCnvCentralTelegram(const QByteArray &data)
: m_data(data)
, m_telegramId(TrainingAreaBase::TetraIcd::UNKNOWN)
{}
CoPrtCnvCentralTelegram(const QByteArray &data, TrainingAreaBase::TetraIcd::TelegramId telegramId)
: m_data(data)
, m_telegramId(telegramId)
{}
CoPrtCnvCentralTelegram(const QByteArray &data, const QJsonObject &json, TrainingAreaBase::TetraIcd::TelegramId telegramId)
: m_data(data)
, m_json(json)
, m_telegramId(telegramId)
{}
explicit CoPrtCnvCentralTelegram(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram &tele)
: m_telegramId(tele.id())
{
m_json[QStringLiteral("type")] = tele.type();
m_json[QStringLiteral("typeId")] = tele.id();
m_json[QStringLiteral("data")] = tele.toJson();
}
void setData(const QByteArray &data);
QByteArray data();
QJsonObject json();
QJsonObject jsonData();
TrainingAreaBase::TetraIcd::TelegramId telegramId();
void setCounter(qint32 counter);
qint32 counter();
private:
void ensureJson();
void ensureByteArray();
private:
QByteArray m_data;
QJsonObject m_json;
TrainingAreaBase::TetraIcd::TelegramId m_telegramId;
};
}
+240
View File
@@ -0,0 +1,240 @@
#include "CoPrtCnvHexDumpHelper.hpp"
#include "CoPrtCnvRadioTelegram.hpp"
#include <QtCore/QByteArray>
#include <NGLLogger/NGLLoggerBootstrap.h>
static std::string dumpSammeldeaktivierung(const N_CoPrtCnv::CoPrtCnvRadioTelegram* sammelTelegram)
{
const int ANZAHL_POS = 5;
const int SIZE_POS = sammelTelegram->getTelID() == GEF_WF_SAMMELDEAKTIVIERUNG_DUS_MINEN ? 2 : 1;
std::stringstream sstream;
unsigned int cnt = sammelTelegram->getPayloadDataUInt32(ANZAHL_POS, SIZE_POS);
for (unsigned int i = 0; i < cnt; ++i) {
uint16_t telId = sammelTelegram->getPayloadDataUInt32(ANZAHL_POS + SIZE_POS + 2 * i, 2);
sstream << telId << " ";
}
return sstream.str();
}
QByteArray telegramId2String(gef_telegramm_id_et telId)
{
const char *str = nullptr;
switch (telId)
{
case GEF_BESTAETIGUNG: str = "GEF_BESTAETIGUNG"; break;
case GEF_INIT: str = "GEF_INIT"; break;
case GEF_MANIPULATIONSMELDUNG: str = "GEF_MANIPULATIONSMELDUNG"; break;
case GEF_UMGEBUNGS_MELDUNG2: str = "GEF_UMGEBUNGS_MELDUNG2"; break;
case GEF_AUFFORDERUNG_BITE_MELDUNG: str = "GEF_AUFFORDERUNG_BITE_MELDUNG"; break;
case GEF_BITE_MELDUNG2: str = "GEF_BITE_MELDUNG2"; break;
case GEF_LIZENSIERUNG_TNE: str = "GEF_LIZENSIERUNG_TNE"; break;
case GEF_BETRIEBSZUSTAND_AUSSTATTUNG: str = "GEF_BETRIEBSZUSTAND_AUSSTATTUNG"; break;
case GEF_KONFIGURATION_WIRKMODELL: str = "GEF_KONFIGURATION_WIRKMODELL"; break;
case GEF_ANFORDERUNG_KONFIGURATIONSDATEN: str = "GEF_ANFORDERUNG_KONFIGURATIONSDATEN"; break;
case GEF_KONFIGURATIONSMELDUNG: str = "GEF_KONFIGURATIONSMELDUNG"; break;
case GEF_FEHLERMELDUNG_GFD: str = "GEF_FEHLERMELDUNG_GFD"; break;
case GEF_WIEDERHERSTELLUNG_FUNKBEREITSCHAFT: str = "GEF_WIEDERHERSTELLUNG_FUNKBEREITSCHAFT"; break;
case GEF_POSITIONS_MELDUNG: str = "GEF_POSITIONS_MELDUNG"; break;
case GEF_POSITIONS_MELDUNG_MIT_TEILNEHMER: str = "GEF_POSITIONS_MELDUNG_MIT_TEILNEHMER"; break;
case GEF_POSITIONS_MELDUNG_LFZ: str = "GEF_POSITIONS_MELDUNG_LFZ"; break;
case GEF_IPS_POSITIONSDATEN: str = "GEF_IPS_POSITIONSDATEN"; break;
case GEF_SCHIEDSRICHTERKOMMANDO: str = "GEF_SCHIEDSRICHTERKOMMANDO"; break;
case GEF_WIRKFELD_EINZELGESCHOSS: str = "GEF_WIRKFELD_EINZELGESCHOSS"; break;
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER: str = "GEF_WIRKFELD_FLAECHENDECKENDES_FEUER"; break;
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_STOP: str = "GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_STOP"; break;
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_FORTSETZEN: str = "GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_FORTSETZEN"; break;
case GEF_WIRKFELD_MINENSPERRE: str = "GEF_WIRKFELD_MINENSPERRE"; break;
case GEF_WIRKFELD_STATUS_MINENSPERRE: str = "GEF_WIRKFELD_STATUS_MINENSPERRE"; break;
case GEF_WIRKFELD_A_KAMPFMITTEL: str = "GEF_WIRKFELD_A_KAMPFMITTEL"; break;
case GEF_WIRKFELD_C_KAMPFMITTEL: str = "GEF_WIRKFELD_C_KAMPFMITTEL"; break;
case GEF_DEAKTIVIERUNG_WIRKFELD: str = "GEF_DEAKTIVIERUNG_WIRKFELD"; break;
case GEF_WIRKFELD_AENDERUNG_BEZEICHNER: str = "GEF_WIRKFELD_AENDERUNG_BEZEICHNER"; break;
case GEF_DEAKTIVIERUNG_EINZELMINE: str = "GEF_DEAKTIVIERUNG_EINZELMINE"; break;
case GEF_REAKTIVIERUNG_DUS_MINE: str = "GEF_REAKTIVIERUNG_DUS_MINE"; break;
case GEF_DEFINITION_IED: str = "GEF_DEFINITION_IED"; break;
case GEF_ZUSTAND_IED: str = "GEF_ZUSTAND_IED"; break;
case GEF_STATUS_EINZELMINENSIMULATOR: str = "GEF_STATUS_EINZELMINENSIMULATOR"; break;
case GEF_WIRKFELD_EINZELMINENSIMULATOR: str = "GEF_WIRKFELD_EINZELMINENSIMULATOR"; break;
case GEF_TREFFER_EREIGNIS_DUS: str = "GEF_TREFFER_EREIGNIS_DUS"; break;
case GEF_TREFFER_EREIGNIS_WIRKSIMULATION: str = "GEF_TREFFER_EREIGNIS_WIRKSIMULATION"; break;
case GEF_TREFFER_AUSLOESUNG: str = "GEF_TREFFER_AUSLOESUNG"; break;
case GEF_SCHIEDSRICHTEREINGRIFF: str = "GEF_SCHIEDSRICHTEREINGRIFF"; break;
case GEF_SELEKTIVE_AUFMUNITIONIERUNG: str = "GEF_SELEKTIVE_AUFMUNITIONIERUNG"; break;
case GEF_TREFFER_EREIGNIS_SEKUNDAERWIRKUNG: str = "GEF_TREFFER_EREIGNIS_SEKUNDAERWIRKUNG"; break;
case GEF_TREFFER_EREIGNIS_DUS_IPS: str = "GEF_TREFFER_EREIGNIS_DUS_IPS"; break;
case GEF_TREFFER_EREIGNIS_WIRKSIMULATION_IPS: str = "GEF_TREFFER_EREIGNIS_WIRKSIMULATION_IPS"; break;
case GEF_TAKTISCHER_STATUS: str = "GEF_TAKTISCHER_STATUS"; break;
case GEF_FUNKTIONSRAUM: str = "GEF_FUNKTIONSRAUM"; break;
case GEF_EINTRETEN_FUNKTIONSRAUM: str = "GEF_EINTRETEN_FUNKTIONSRAUM"; break;
case GEF_DEAKTIVIEREN_FUNKTIONSRAUM: str = "GEF_DEAKTIVIEREN_FUNKTIONSRAUM"; break;
case GEF_DATENVERKEHR_SRT_TDS: str = "GEF_DATENVERKEHR_SRT_TDS"; break;
case GEF_DATENVERKEHR_TDS_SRT: str = "GEF_DATENVERKEHR_TDS_SRT"; break;
case GEF_DATENVERKEHR_DMF_TDS: str = "GEF_DATENVERKEHR_DMF_TDS"; break;
case GEF_DATENVERKEHR_TDS_DMF: str = "GEF_DATENVERKEHR_TDS_DMF"; break;
case GEF_NACHFORDERUNG_BROADCAST_TELEGRAMME: str = "GEF_NACHFORDERUNG_BROADCAST_TELEGRAMME"; break;
case GEF_NOP: str = "GEF_NOP"; break;
case GEF_SONDERSENSORIK_BETRIEBSZUSTAND: str = "GEF_SONDERSENSORIK_BETRIEBSZUSTAND"; break;
case GEF_SONDERSENSORIK_FAHRSPUR: str = "GEF_SONDERSENSORIK_FAHRSPUR"; break;
case GEF_SONDERSENSORIK_DATEN: str = "GEF_SONDERSENSORIK_DATEN"; break;
case GEF_SONDERSENSORIK_MIVANH_VERLEGEDATEN: str = "GEF_SONDERSENSORIK_MIVANH_VERLEGEDATEN"; break;
case GEF_SONDERSENSORIK_WMIV_VERLEGEDATEN: str = "GEF_SONDERSENSORIK_WMIV_VERLEGEDATEN"; break;
case GEF_SONDERSENSORIK_MIVANH_VERLEGEPOSITION: str = "GEF_SONDERSENSORIK_MIVANH_VERLEGEPOSITION"; break;
case GEF_SPRACHAUSWAHL: str = "GEF_SPRACHAUSWAHL"; break;
case GEF_ALLGEMEINE_NACHRICHT: str = "GEF_ALLGEMEINE_NACHRICHT"; break;
case GEF_ECHO_ON_OFF: str = "GEF_ECHO_ON_OFF"; break;
case GEF_ESW_MELDUNG: str = "GEF_ESW_MELDUNG"; break;
case GEF_WF_SAMMELDEAKTIVIERUNG: str = "GEF_WF_SAMMELDEAKTIVIERUNG"; break;
case GEF_WF_SAMMELDEAKTIVIERUNG_DUS_MINEN: str = "GEF_WF_SAMMELDEAKTIVIERUNG_DUS_MINEN"; break;
case GEF_WF_SAMMELDEAKTIVIERUNG_FUNKTIONSRAUM: str = "GEF_WF_SAMMELDEAKTIVIERUNG_FUNKTIONSRAUM"; break;
case GEF_DATENVERKEHR_GEOP_TDS: str = "GEF_DATENVERKEHR_GEOP_TDS"; break;
case GEF_DATENVERKEHR_TDS_GEOP: str = "GEF_DATENVERKEHR_TDS_GEOP"; break;
case GEF_DATENVERKEHR_TGTC_TDS: str = "GEF_DATENVERKEHR_TGTC_TDS"; break;
case GEF_DATENVERKEHR_TDS_TGTC: str = "GEF_DATENVERKEHR_TDS_TGTC"; break;
case GEF_GERAETEEREIGNIS: str = "GEF_GERAETEEREIGNIS"; break;
case GEF_WAFFENZUORDNUNG: str = "GEF_WAFFENZUORDNUNG"; break;
case GEF_MUNITIONSVORRAT_EINER_ZUGEORDNETEN_WAFFE: str = "GEF_MUNITIONSVORRAT_EINER_ZUGEORDNETEN_WAFFE"; break;
case GEF_FEUEREREIGNIS_MIT_WAFFENZUORDNUNG: str = "GEF_FEUEREREIGNIS_MIT_WAFFENZUORDNUNG"; break;
case GEF_AUSLOESUNG_DUS_TREFFER: str = "GEF_AUSLOESUNG_DUS_TREFFER"; break;
case GEF_ANFORDERUNG_SW_VERSION: str = "GEF_ANFORDERUNG_SW_VERSION"; break;
case GEF_SW_VERSIONSMELDUNG: str = "GEF_SW_VERSIONSMELDUNG"; break;
case GEF_TECHNIK_FUNKTIONSRAUM: str = "GEF_TECHNIK_FUNKTIONSRAUM"; break;
case GEF_TEILNEHMERMODE_SETZEN: str = "GEF_TEILNEHMERMODE_SETZEN"; break;
case GEF_TEILNEHMERMODE_MELDUNG: str = "GEF_TEILNEHMERMODE_MELDUNG"; break;
case GEF_TEILNEHMERMODE_ANFORDERN: str = "GEF_TEILNEHMERMODE_ANFORDERN"; break;
case GEF_TEILNEHMER_KONFIG_ANTWORT: str = "GEF_TEILNEHMER_KONFIG_ANTWORT"; break;
case GEF_TEILNEHMER_KONFIG_SETZEN: str = "GEF_TEILNEHMER_KONFIG_SETZEN"; break;
case GEF_TEILNEHMER_KONFIG_ANFORDERN: str = "GEF_TEILNEHMER_KONFIG_ANFORDERN"; break;
case GEF_SANITAETSDIENST_INSTANDSETZUNG: str = "GEF_SANITAETSDIENST_INSTANDSETZUNG"; break;
case GEF_SANITAETSDIENST_INSTANDSETZUNG_PVSAN: str = "GEF_SANITAETSDIENST_INSTANDSETZUNG_PVSAN"; break;
case GEF_BESTANDSMELDUNG_SANITAETSMATERIAL: str = "GEF_BESTANDSMELDUNG_SANITAETSMATERIAL"; break;
case GEF_GEFECHTSFELDTELEGRAMM: str = "GEF_GEFECHTSFELDTELEGRAMM"; break;
}
Q_ASSERT(str);
if (!str)
str = "Unknown";
return str + QByteArray(" (") + QByteArray::number(int(telId)) + ")";
}
QString wirkfeldTyp2Str(TrainingAreaBase::TetraIcd::AreaEffectSimulationType wirkfeldTyp)
{
switch(wirkfeldTyp)
{
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::MineArea:
return QLatin1String("MINENSPERRE");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::ExplosionArea:
return QLatin1String("FLAECHENFEUER");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::ExplosionSingle:
return QLatin1String("EINZELFEUER");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::NContamination:
return QLatin1String("A_KAMPF");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::CContamination:
return QLatin1String("C_KAMPF");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::FunctionalArea:
return QLatin1String("FUNKTIONS_RAUM");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::TechnicalArea:
return QLatin1String("FUNKTIONS_RAUM_TECHNIK");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::GasPipeDetonation:
return QLatin1String("GAS_PIPE_DETONATION");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::SpecialArea:
return QLatin1String("SPECIAL_AREA");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::Unknown:
return QLatin1String("DUS");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::DusSingleMineSimulator:
return QLatin1String("DUS_SINGLE_MINE_SIMULATOR");
case TrainingAreaBase::TetraIcd::AreaEffectSimulationType::BeStillWarning:
return QLatin1String("BE_STILL_WARNING");
}
return QStringLiteral("Unknown Wirkfeldtyp <%1>").arg(static_cast<int>(wirkfeldTyp));
}
static inline QString wirkfeldTyp2Str(int typ)
{
return wirkfeldTyp2Str(static_cast<TrainingAreaBase::TetraIcd::AreaEffectSimulationType>(typ));
}
void dumpTelegram(NGL::INGLLogger &m_logger, int id, N_CoPrtCnv::CoPrtCnvRadioTelegram *a_radioTelegram, const char *prefix)
{
if(!m_logger.isDebugEnabled())
return;
if (!prefix)
prefix = "";
const QByteArray commonLog(prefix + QByteArray("BC: ") + QByteArray::number(id) +
", " + telegramId2String(a_radioTelegram->getTelID()));
switch (a_radioTelegram->getTelID())
{
case GEF_DEAKTIVIERUNG_WIRKFELD:
case GEF_WIRKFELD_AENDERUNG_BEZEICHNER:
{
uint8_t wirkfeldTyp = a_radioTelegram->getPayloadDataUInt32(5, 1);
uint16_t wirkfeldKennung = a_radioTelegram->getPayloadDataUInt32(6, 2);
DEBUG_LOG(m_logger) << commonLog
<< ", type: " << wirkfeldTyp2Str(wirkfeldTyp) << ", kennung: "
<< wirkfeldKennung;
break;
}
case GEF_DEAKTIVIERUNG_EINZELMINE: {
uint32_t wirkfeldKennung = a_radioTelegram->getPayloadDataUInt32(9, 2);
uint32_t minenKennung = a_radioTelegram->getPayloadDataUInt32(11, 2);
DEBUG_LOG(m_logger) << commonLog
<< ", kennung: " << wirkfeldKennung << ", mineId: " << minenKennung;
break;
}
case GEF_WIRKFELD_STATUS_MINENSPERRE:
case GEF_WIRKFELD_A_KAMPFMITTEL:
case GEF_WIRKFELD_MINENSPERRE:
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER:
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_STOP:
case GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_FORTSETZEN:
case GEF_FUNKTIONSRAUM:
case GEF_DEAKTIVIEREN_FUNKTIONSRAUM:
{
uint16_t wirkfeldKennung = a_radioTelegram->getPayloadDataUInt32(5, 2);
DEBUG_LOG(m_logger) << commonLog << ", kennung: " << wirkfeldKennung;
break;
}
case GEF_TECHNIK_FUNKTIONSRAUM:
{
uint16_t funktionsraumkennung = a_radioTelegram->getPayloadDataUInt32(5, 2);
uint8_t funktionsraumtyp = a_radioTelegram->getPayloadDataUInt32(7, 1);
DEBUG_LOG(m_logger) << commonLog
<< ", kennung: " << funktionsraumkennung
<< " type: " << int(funktionsraumtyp);
break;
}
case GEF_WF_SAMMELDEAKTIVIERUNG:
case GEF_WF_SAMMELDEAKTIVIERUNG_DUS_MINEN:
case GEF_WF_SAMMELDEAKTIVIERUNG_FUNKTIONSRAUM:
DEBUG_LOG(m_logger) << commonLog << ", Ids: " << dumpSammeldeaktivierung(a_radioTelegram);
break;
case GEF_NOP:
{
uint16_t bcFrom = a_radioTelegram->getPayloadDataUInt32(3, 2);
uint16_t bcTo = a_radioTelegram->getPayloadDataUInt32(5, 2);
DEBUG_LOG(m_logger) << prefix
<< commonLog
<< ", from BC " << bcFrom << " to " << bcTo;
break;
}
default:
DEBUG_LOG(m_logger) << commonLog;
break;
}
}
@@ -0,0 +1,32 @@
#pragma once
#include <QtCore/QString>
#include <NGLLogger/INGLLogger.h>
#include <TrainingAreaBase/training_area_telegrams.h>
#include <CoPrtCnv/coprtcnv_export.h>
#include "tetra_telegram_ids.h"
namespace N_CoPrtCnv
{
class CoPrtCnvRadioTelegram;
}
COPRTCNV_EXPORT QByteArray telegramId2String(gef_telegramm_id_et telId);
COPRTCNV_EXPORT void dumpTelegram(NGL::INGLLogger &m_logger,
int id,
N_CoPrtCnv::CoPrtCnvRadioTelegram *a_radioTelegram,
const char *prefix = nullptr);
COPRTCNV_EXPORT QString wirkfeldTyp2Str(TrainingAreaBase::TetraIcd::AreaEffectSimulationType wirkfeldTyp);
@@ -0,0 +1,52 @@
#pragma once
#include <stdint.h>
namespace N_CoPrtCnv
{
struct CoPrtCnvInjectionHeader
{
uint32_t m_Id1;
uint32_t m_Id2;
enum Destination
{
eUnknown = 0,
eCentral = 1,
eRadio = 2
} m_Kind;
uint16_t m_Size;
CoPrtCnvInjectionHeader()
: m_Id1(0x12345678),
m_Id2(0x78236239),
m_Kind(eUnknown),
m_Size(0)
{}
bool isIdCorrect() const { return (m_Id1 == 0x12345678 && m_Id2 == 0x78236239); }
};
}
+52
View File
@@ -0,0 +1,52 @@
#pragma once
#include <stdint.h>
namespace N_CoPrtCnv
{
struct CoPrtCnvLogHeader
{
enum E_CoPrtCnvProtocol
{
e_DestProtocolCentral = 0,
e_DestProtocolWls = 1,
e_DestProtocolTetra = 5,
e_DestProtocolMax = 6,
e_DestProtocolMask = 0x0000000F,
e_DestDirectionMask = 0xC0000000,
e_DestReceive = 0x40000000,
e_DestSend = 0xC0000000
};
short m_Length = 0;
short m_Version = 0;
int m_Priority = 0;
int m_Protocol = 0;
int m_Reserved = 0;
uint64_t m_Time = 0;
};
}
File diff suppressed because it is too large. Load diff
+604
View File
@@ -0,0 +1,604 @@
#pragma once
#include <set>
#include <map>
#include <memory>
#include <vector>
#include <QByteArray>
#include <CoPrtCnv/coprtcnv_export.h>
#include "tetra_telegram_ids.h"
namespace NGL
{
class INGLLogger;
}
namespace N_CoPrtCnv
{
enum class E_LicensingKind
{
Success = 0,
Rejected = 1,
Unlicense = 2
};
enum class E_LicensingErrorCode
{
Ok = 0,
Selftest = 1,
Battery = 2,
Configuration = 3,
Unlicense = 4,
IdentityDenied = 5
};
class COPRTCNV_EXPORT CoPrtCnvRadioTelegram
{
public:
enum E_Flags
{
e_FlagsNone = 0x00,
e_StorageAllowed = 0x10,
e_GroupServiceOrOnlyStandardReportAllowed = 0x20,
e_ReceivedConfirmationRequested = 0x40,
e_ConsumedConfirmationRequested = 0x80
};
enum E_ProtocolIdentifier
{
e_SimpleTextMessagingWithoutSDS_TL = 0x02,
e_SimpleGPS_WithoutSDS_TL = 0x03,
e_TDSMessageWithoutSDS_TL = 0x50,
e_UsingSDS_TL = 0x80,
e_SimpleTextMessagingUsingSDS_TL = 0x82,
e_SimpleGPS_UsingSDS_TL = 0x83,
e_LoginTest = 0x1D
};
enum E_FragmentStatus
{
e_NotFragmented = 0x00,
e_FirstFragment = 0x40,
e_MiddleFragment = 0xC0,
e_LastFragment = 0x80,
e_FragmentStatusMask = 0xC0,
e_Checksum = 0x20,
e_CounterMask = 0x0F,
e_NormalTelegram = 0x00,
e_LoginTelegram = 0x02,
e_DgpsTelegram = 0x03
};
struct PrtCnvRadioGwHeader
{
uint8_t m_MagicNumber;
uint8_t m_Counter;
uint16_t m_Length;
};
enum E_PDU_Type
{
e_RegisterInd = 0,
e_RegisterRsp = 1,
e_DataIndReq = 2,
e_ReportIndReq = 3,
e_StatusIndReq = 4,
e_GroupMonitorReq = 6,
e_AirInterfaceLoadReq = 8,
e_AirLoadHyterra = 19
};
enum E_RegistrationStatus
{
e_IssiSuccessfulRegistered = 0,
e_DuplicateISSI = 1,
e_InvalidISSI = 2,
e_InvalidIpAddress = 3
};
enum E_DeliveryStatusForTL_Report
{
e_SDS_ReceiptAcknowledgedByDestination = 0x00,
e_SDS_ConsumedByDestination = 0x02,
e_SourceIsNotAuthorizedForSDS = 0x43,
e_DestinationIsNotAuthorizedForSDS = 0x44,
e_UnknownDestinationAddress = 0x45,
e_DeliveryFailed = 0x4A,
e_DestinationNotRegisteredOnSystem = 0x4B,
e_DestinationQueueFull = 0x4C,
e_MessageTooLong = 0x4D,
e_DestinationHostPC_NotConnected = 0x4F,
e_ProtocolNotSupported = 0x50,
e_DataCodingSchemeNotSupported = 0x51,
e_DestinationNotReachable = 0x5A
};
enum E_LoginStatus
{
e_LoginRequest = 0x40,
e_LoginAccept = 0x80,
e_LoginReject = 0xC0,
e_LoginStatusMask = 0xC0,
e_LoginMastering = 0x20,
e_LoginNoExerciseAssignment = 0x00,
e_LoginOtherEqId = 0x02,
e_LoginOtherISSI = 0x04,
e_LoginOtherExercise = 0x06,
};
static constexpr uint8_t MAGIC_NUMBER = 0xA5;
static constexpr uint16_t DATA_IND_REQ_WITH_TL_HEADER_LENGTH = 22;
static constexpr uint16_t DATA_IND_REQ_HEADER_LENGTH = 27;
static constexpr uint16_t DATA_IND_REQ_HEADER_LENGTH_WITHOUT_PAYLOAD_HEADER = DATA_IND_REQ_HEADER_LENGTH -1;
static constexpr uint16_t DATA_IND_REQ_NO_TL_HEADER_LENGTH = 14;
static constexpr uint16_t MAX_RADIO_TELEGRAM_PAYLOAD_LENGTH = 249;
static constexpr uint16_t PAYLOAD_STATUS_LENGTH = 1;
static constexpr uint8_t MAX_NBR_OF_FRAGMENTS = 16;
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI);
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI, const std::set<uint32_t> &groups);
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI, const E_DeliveryStatusForTL_Report a_delivery);
explicit CoPrtCnvRadioTelegram(const QByteArray &a_data);
explicit CoPrtCnvRadioTelegram(const gef_telegramm_id_et a_telegramId, const uint16_t a_payloadSize, const uint16_t a_identity);
explicit CoPrtCnvRadioTelegram(const E_LoginStatus a_loginTelegramStatus, const uint16_t a_identity, uint32_t a_issi);
void setLoginIssis(int hostIssi, int groupIssi1, int groupIssi2);
explicit CoPrtCnvRadioTelegram(const std::shared_ptr<CoPrtCnvRadioTelegram> &a_bigTelegram,
const uint8_t a_fragmentIndex, bool &a_error);
virtual ~CoPrtCnvRadioTelegram();
void fixupTelegramIdForEts(bool convertToEtsId);
static void setEtsMode(bool bIsEtsMode);
void setPayload1Byte(uint8_t a_value);
void setPayload2Byte(uint16_t a_value);
void setPayload3Byte(uint32_t a_value);
void setPayload4Byte(uint32_t a_value);
void setPayloadData(uint32_t a_value, const uint8_t a_size);
void setPayloadData(const uint8_t a_value) { return setPayload1Byte(a_value); }
void setPayloadData(const uint8_t *a_data, const uint16_t a_size);
const char *getData() const { return m_data.data(); }
char *getData() { return m_data.data(); }
QByteArray data() const { return m_data; }
int getSize() const { return m_data.size(); }
gef_telegramm_id_et getTelID() const;
uint8_t zaehler() const;
void setZaehler(const uint8_t a_counter);
uint32_t getPayloadDataUInt32(size_t a_offset, uint16_t a_size) const;
uint8_t getPayloadDataUInt8(size_t a_offset) const;
uint32_t getDestISSI() const;
uint16_t getIdentity() const;
void setSrcISSI(const uint32_t a_ISSI);
bool mustBroadcastBeSet() const;
void setBroadcastIndex(const uint16_t a_broadcastIndex);
void setDestISSI(const uint32_t a_ISSI);
CoPrtCnvRadioTelegram::E_PDU_Type getPDU_Type() const;
CoPrtCnvRadioTelegram::E_FragmentStatus getFragmentStatus() const;
uint8_t getFragmentCounter() const;
bool isCrcOk() const;
uint32_t getSrcISSI() const;
bool isLoginTelegram() const;
bool mustBeFragmented() const;
const uint8_t *getPayloadDataPtr(uint16_t a_offset) const;
uint8_t *getPayloadDataPtr(uint16_t a_offset);
virtual uint16_t getPayloadSize() const;
static QByteArray getUnfragmentedData(const std::multimap<uint16_t, CoPrtCnvRadioTelegram *> &a_fragTelegramList);
static bool isTelegramLengthOk(const uint16_t a_lengthWithoutFrame);
bool isNormalTelegram() const;
uint8_t getPriority() const;
uint16_t getBroadcastIndex() const;
void setPayloadDataWithIndex(const uint16_t a_index, const uint32_t a_value, const uint16_t a_size);
void setPayloadDataComplete(const QByteArray &payload);
void resetPayloadSize(const uint16_t a_newPayloadSize);
void setIdentity(const uint16_t a_identity);
void setProtocolIdentifier(const E_ProtocolIdentifier a_ProtocolIdentifier);
void setMessageReference(const uint8_t a_MessageReference);
bool isSDSTL() const;
CoPrtCnvRadioTelegram::E_RegistrationStatus getRegistrationStatus() const;
std::string getRegistrationStatusAsText() const;
CoPrtCnvRadioTelegram::E_ProtocolIdentifier getProtocolIdentifier() const;
std::string getProtocolIdentifierAsText() const;
uint8_t getMessageReference() const;
uint8_t getAreaSelection() const;
uint8_t getValidityPeriod() const;
uint32_t getForwardAddress() const;
CoPrtCnvRadioTelegram::E_Flags getFlags() const;
std::string getFlagsAsText() const;
uint16_t getLengthInBits() const;
uint16_t getLengthInBytes() const;
bool getWithCrc() const;
CoPrtCnvRadioTelegram::E_DeliveryStatusForTL_Report getDelivery() const;
std::string getDeliveryAsText() const;
int32_t getPayloadDataSInt24(uint16_t a_offset) const;
bool needsLicensing() const;
bool hasExpired() const;
uint32_t getExpireTime() const;
bool isContentValid();
bool mustBeSentAsBroadcast(time_t a_currentTime, bool &a_wasLastBroadcast, const bool a_updateBroadcastCounter = true);
static void setBroadcastDelayTimes(int a_2ndDelay, int a_3rdDelay);
static void setMaxBroadcastSendCnt(int a_maxSendCnt);
bool isMovedToBroadcastList() const;
void setBroadcastOnly(const bool a_doSet = true);
bool isBroadcastOnly() const;
void setBroadcastonlyTelegram(const std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> &a_radioTelegram);
std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> getBroadcastonlyTelegram() const;
uint16_t getBroadcastCounter() const;
protected:
QByteArray m_data;
uint16_t m_PayloadIndex;
uint16_t m_BroadcastCounter;
time_t m_NextSendTime;
static int s_2ndDelay;
static int s_3rdDelay;
static int s_maxBroadcastSendCnt;
bool m_IsBroadcastOnly;
std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> m_BroadcastOnlyTelegram;
static bool s_etsMode;
bool isPayloadLengthOk(uint16_t a_minLength,
const uint16_t a_dataAmountOffset,
const uint8_t a_variableDataElementSize) const;
bool isPayloadLengthOk(uint16_t a_minLength,
uint16_t a_maxLength) const;
bool isPayloadLengthOk(uint16_t a_length) const;
bool isPayloadLengthOk(const std::vector<uint16_t> &a_lengths) const;
static void set1Byte(QByteArray &a_data, uint16_t a_offset, uint8_t a_value);
static void set2Byte(QByteArray &a_data, uint16_t a_offset, uint16_t a_value);
static void set4Byte(QByteArray &a_data, uint16_t a_offset, uint32_t a_value);
uint8_t getUInt8(const uint16_t a_offset) const { return static_cast<uint8_t>(m_data.at(a_offset)); }
uint16_t getUInt16(const uint16_t a_offset) const;
uint32_t getUInt32(const uint16_t a_offset) const;
static void setHeader(QByteArray &data, E_PDU_Type pduType);
static void fillDataIndReqHeader(QByteArray &a_data);
static void setSrcISSI_Internal(QByteArray &data, const uint32_t issi);
static void setDestISSI_Internal(QByteArray &data, const uint32_t issi);
private:
NGL::INGLLogger &m_logger;
};
}
@@ -0,0 +1,57 @@
#pragma once
#include <CoPrtCnv/coprtcnv_export.h>
namespace TrainingAreaBase
{
namespace TetraIcd
{
struct TrainingAreaTelegram;
}
}
namespace N_CoPrtCnv
{
class CoPrtCnvRadioTelegram;
class CoPrtCnvCentralTelegram;
namespace CoPrtCnvTelegramConverter
{
COPRTCNV_EXPORT CoPrtCnvRadioTelegram *convertToRadio(CoPrtCnvCentralTelegram *a_telegram);
COPRTCNV_EXPORT CoPrtCnvRadioTelegram *convertToRadio(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *a_telegram);
COPRTCNV_EXPORT CoPrtCnvCentralTelegram *convertToCentral(const CoPrtCnvRadioTelegram *a_radioTelegram);
COPRTCNV_EXPORT TrainingAreaBase::TetraIcd::TrainingAreaTelegram *convertToTabTele(const CoPrtCnvRadioTelegram *a_radioTelegram);
COPRTCNV_EXPORT void setTetraTextCodec(const char *codecName);
COPRTCNV_EXPORT void setUse2BytesForSingleFireDiameter(bool bUse);
COPRTCNV_EXPORT void setUsePvSan(bool bUse);
}
}
File diff suppressed because it is too large. Load diff
+116
View File
@@ -0,0 +1,116 @@
#pragma once
enum gef_telegramm_id_et
{
GEF_BESTAETIGUNG = 0,
GEF_INIT = 1,
GEF_MANIPULATIONSMELDUNG = 2,
GEF_UMGEBUNGS_MELDUNG2 = 203,
GEF_AUFFORDERUNG_BITE_MELDUNG = 4,
GEF_BITE_MELDUNG2 = 205,
GEF_LIZENSIERUNG_TNE = 6,
GEF_BETRIEBSZUSTAND_AUSSTATTUNG = 7,
GEF_KONFIGURATION_WIRKMODELL = 9,
GEF_ANFORDERUNG_KONFIGURATIONSDATEN = 10,
GEF_KONFIGURATIONSMELDUNG = 11,
GEF_FEHLERMELDUNG_GFD = 12,
GEF_WIEDERHERSTELLUNG_FUNKBEREITSCHAFT = 13,
GEF_POSITIONS_MELDUNG = 21,
GEF_POSITIONS_MELDUNG_MIT_TEILNEHMER = 22,
GEF_POSITIONS_MELDUNG_LFZ = 23,
GEF_IPS_POSITIONSDATEN = 201,
GEF_SCHIEDSRICHTERKOMMANDO = 25,
GEF_WIRKFELD_EINZELGESCHOSS = 31,
GEF_WIRKFELD_FLAECHENDECKENDES_FEUER = 32,
GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_STOP = 33,
GEF_WIRKFELD_FLAECHENDECKENDES_FEUER_FORTSETZEN = 34,
GEF_WIRKFELD_MINENSPERRE = 35,
GEF_WIRKFELD_STATUS_MINENSPERRE = 36,
GEF_WIRKFELD_A_KAMPFMITTEL = 37,
GEF_WIRKFELD_C_KAMPFMITTEL = 38,
GEF_DEAKTIVIERUNG_WIRKFELD = 39,
GEF_WIRKFELD_AENDERUNG_BEZEICHNER = 40,
GEF_DEAKTIVIERUNG_EINZELMINE = 41,
GEF_REAKTIVIERUNG_DUS_MINE = 42,
GEF_DEFINITION_IED = 43,
GEF_ZUSTAND_IED = 44,
GEF_STATUS_EINZELMINENSIMULATOR = 45,
GEF_WIRKFELD_EINZELMINENSIMULATOR = 46,
GEF_SELEKTIVE_AUFMUNITIONIERUNG = 56,
GEF_TREFFER_EREIGNIS_DUS = 52,
GEF_TREFFER_EREIGNIS_WIRKSIMULATION = 53,
GEF_TREFFER_AUSLOESUNG = 54,
GEF_SCHIEDSRICHTEREINGRIFF = 55,
GEF_TREFFER_EREIGNIS_SEKUNDAERWIRKUNG = 218,
GEF_TREFFER_EREIGNIS_DUS_IPS = 228,
GEF_TREFFER_EREIGNIS_WIRKSIMULATION_IPS = 229,
GEF_TAKTISCHER_STATUS = 61,
GEF_FUNKTIONSRAUM = 62,
GEF_EINTRETEN_FUNKTIONSRAUM = 63,
GEF_DEAKTIVIEREN_FUNKTIONSRAUM = 64,
GEF_DATENVERKEHR_SRT_TDS = 71,
GEF_DATENVERKEHR_TDS_SRT = 72,
GEF_DATENVERKEHR_DMF_TDS = 73,
GEF_DATENVERKEHR_TDS_DMF = 74,
GEF_NACHFORDERUNG_BROADCAST_TELEGRAMME = 82,
GEF_NOP = 83,
GEF_SONDERSENSORIK_BETRIEBSZUSTAND = 91,
GEF_SONDERSENSORIK_FAHRSPUR = 92,
GEF_SONDERSENSORIK_DATEN = 93,
GEF_SONDERSENSORIK_MIVANH_VERLEGEDATEN = 95,
GEF_SONDERSENSORIK_WMIV_VERLEGEDATEN = 96,
GEF_SONDERSENSORIK_MIVANH_VERLEGEPOSITION = 97,
GEF_SPRACHAUSWAHL = 101,
GEF_ALLGEMEINE_NACHRICHT = 102,
GEF_ECHO_ON_OFF = 103,
GEF_ESW_MELDUNG = 104,
GEF_WF_SAMMELDEAKTIVIERUNG = 105,
GEF_WF_SAMMELDEAKTIVIERUNG_DUS_MINEN = 106,
GEF_WF_SAMMELDEAKTIVIERUNG_FUNKTIONSRAUM = 107,
GEF_DATENVERKEHR_GEOP_TDS = 181,
GEF_DATENVERKEHR_TDS_GEOP = 182,
GEF_DATENVERKEHR_TGTC_TDS = 183,
GEF_DATENVERKEHR_TDS_TGTC = 184,
GEF_GERAETEEREIGNIS = 185,
GEF_WAFFENZUORDNUNG = 200,
GEF_MUNITIONSVORRAT_EINER_ZUGEORDNETEN_WAFFE = 202,
GEF_FEUEREREIGNIS_MIT_WAFFENZUORDNUNG = 210,
GEF_AUSLOESUNG_DUS_TREFFER = 211,
GEF_ANFORDERUNG_SW_VERSION = 212,
GEF_SW_VERSIONSMELDUNG = 213,
GEF_TECHNIK_FUNKTIONSRAUM = 219,
GEF_TEILNEHMERMODE_SETZEN = 230,
GEF_TEILNEHMERMODE_MELDUNG = 231,
GEF_TEILNEHMERMODE_ANFORDERN = 232,
GEF_TEILNEHMER_KONFIG_ANTWORT = 233,
GEF_TEILNEHMER_KONFIG_SETZEN = 234,
GEF_TEILNEHMER_KONFIG_ANFORDERN = 235,
GEF_SANITAETSDIENST_INSTANDSETZUNG = 240,
GEF_BESTANDSMELDUNG_SANITAETSMATERIAL = 241,
GEF_SANITAETSDIENST_INSTANDSETZUNG_PVSAN = 242,
GEF_LASER_TARGET_DESIGNATOR_UPDATE = 214,
GEF_GEFECHTSFELDTELEGRAMM = 300
};