Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

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,87 @@
/**
* Thin wrapper around json telegram data
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-04-22
*/
#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);
}
}
} // namespace N_CoPrtCnv
@@ -0,0 +1,68 @@
/**
* Thin wrapper around json telegram data
* $Id$
* $HeadURL$
* $Author$
* Created by Christian Ehrlicher, SLSE, 2016-04-22
*/
#pragma once
#include <QJsonObject>
#include <QByteArray>
#include <CoPrtCnv/coprtcnv_export.h>
#include <TrainingAreaBase/training_area_telegrams.h>
namespace N_CoPrtCnv
{
/**
* The central-telegram, an subclass of XDR_Wrapper_it used for creation of
* telegrams with telegramId. It also contains the deletion of dynamic allocated
* space within central-telegrams.
*/
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(); // complete json
QJsonObject jsonData(); // json()["data"]
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 @@
// **************************************************************************
//
// @RDE_HEADER@
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// Helper to dump the data in hex
// **************************************************************************
#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); // anzahl
for (unsigned int i = 0; i < cnt; ++i) {
uint16_t telId = sammelTelegram->getPayloadDataUInt32(ANZAHL_POS + SIZE_POS + 2 * i, 2); // add kennung
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 @@
// **************************************************************************
//
// @RDE_HEADER@
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// Helper to dump the data in hex
// **************************************************************************
#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,64 @@
// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
#pragma once
#include <stdint.h>
namespace N_CoPrtCnv
{
/**
* The header used for injection-data
*
* @author alois.wismer
* @version 1.0
* @created 06-Aug-2010 10:27:55
*/
struct CoPrtCnvInjectionHeader
{
/**
* The m_Id1 and m_Id2 are used to detect rubish data.
*/
uint32_t m_Id1;
/**
* The m_Id1 and m_Id2 are used to detect rubish data.
*/
uint32_t m_Id2;
/**
* 0 => unknown
* 1 => central-telegram
* 2 => radio-telegram
* all others: unknown
*/
enum Destination
{
eUnknown = 0,
eCentral = 1,
eRadio = 2
} m_Kind;
/**
* The size of following data
*/
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); }
};
}
+63
View File
@@ -0,0 +1,63 @@
// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
#pragma once
#include <stdint.h>
namespace N_CoPrtCnv
{
/**
* @author alois.wismer
* @version 1.0
* @created 12-Mrz-2010 16:07:19
*/
struct CoPrtCnvLogHeader
{
/**
* @author alois.wismer
* @version 1.0
* @created 12-Mrz-2010 16:04:42
*/
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
};
/**
* length of data, including length of this header
*/
short m_Length = 0;
short m_Version = 0;
int m_Priority = 0;
/**
* We do not use E_CoPrtCnvProtocol here, because we want a size of 4 bytes
*/
int m_Protocol = 0;
/**
* needed for correct alignment when compiling on 64-bit systems
*/
int m_Reserved = 0;
/**
* Upper 4 bytes => seconds
* Lower 4 byte => microseconds
*/
uint64_t m_Time = 0;
};
}
File diff suppressed because it is too large. Load diff
+882
View File
@@ -0,0 +1,882 @@
// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
#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
{
/**
* used for telegram "LizenzierungTNE" to Radio
*/
enum class E_LicensingKind
{
/**
* Anmeldung erfolgreich
*/
Success = 0,
/**
* Anmeldung abgelehnt
*/
Rejected = 1,
/**
* Abmeldung
*/
Unlicense = 2
};
/**
* used for telegram "LizenzierungTNE" to Radio
*/
enum class E_LicensingErrorCode
{
Ok = 0,
Selftest = 1,
Battery = 2,
Configuration = 3,
Unlicense = 4,
IdentityDenied = 5
};
/**
* The radio-telegram, holds the data of telegram and additiional data for filling
* and sending as braodcast.
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:37:23
*/
class COPRTCNV_EXPORT CoPrtCnvRadioTelegram
{
public:
/**
* The radio-telegram flags
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
enum E_Flags
{
e_FlagsNone = 0x00,
e_StorageAllowed = 0x10,
e_GroupServiceOrOnlyStandardReportAllowed = 0x20,
e_ReceivedConfirmationRequested = 0x40,
e_ConsumedConfirmationRequested = 0x80
};
/**
* The transmission-protocoll to be used for radio-telegram
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
enum E_ProtocolIdentifier
{
e_SimpleTextMessagingWithoutSDS_TL = 0x02,
e_SimpleGPS_WithoutSDS_TL = 0x03,
e_TDSMessageWithoutSDS_TL = 0x50, // 80dec
e_UsingSDS_TL = 0x80,
e_SimpleTextMessagingUsingSDS_TL = 0x82,
e_SimpleGPS_UsingSDS_TL = 0x83,
e_LoginTest = 0x1D
};
/**
* The telegram-type:
* Fragmented, normal or login-telegram.
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
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
};
/**
* The header of a radio-telegram
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
struct PrtCnvRadioGwHeader
{
/**
* The first byte must be the magic number A5
*/
uint8_t m_MagicNumber;
/**
* The telegram-counter
*/
uint8_t m_Counter;
/**
* length of the following message in bytes
*/
uint16_t m_Length;
};
/**
* The PDU-type of radio-telegram
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
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
};
/**
* @author alois.wismer
* @version 1.0
* @created 17-Mrz-2010 13:06:40
*/
enum E_RegistrationStatus
{
e_IssiSuccessfulRegistered = 0,
e_DuplicateISSI = 1,
e_InvalidISSI = 2,
e_InvalidIpAddress = 3
};
/**
* The delivery-status (only for SDS-TL)
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:39:54
*/
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
};
/**
* The status of the login-telegram
*
* @author wia
* @version 1.0
* @created 12-Mrz-2010 16:41:22
*/
enum E_LoginStatus
{
e_LoginRequest = 0x40,
e_LoginAccept = 0x80,
e_LoginReject = 0xC0,
e_LoginStatusMask = 0xC0,
e_LoginMastering = 0x20,
// Bits 2 & 3
e_LoginNoExerciseAssignment = 0x00, // none set
e_LoginOtherEqId = 0x02, // bit2 set
e_LoginOtherISSI = 0x04, // bit3 set
e_LoginOtherExercise = 0x06, // bit2+3 set
};
/**
* The first byte of the radio-telegram. Must be A5
*/
static constexpr uint8_t MAGIC_NUMBER = 0xA5;
/**
* length of a data-ind/req-telegram-header with TL and without the 4-byte frame-
* header.
* It contains PDUtype, SourceISSI, DestinationISSI, ProtocolIdentifier,
* LengthInBits and LengthInBytes. Payload-status is not included.
*/
static constexpr uint16_t DATA_IND_REQ_WITH_TL_HEADER_LENGTH = 22;
/**
* frameheader (4) + tetra-header (22) + payloadheader (1)
*/
static constexpr uint16_t DATA_IND_REQ_HEADER_LENGTH = 27;
/**
* frameheader (4) + tetra-header (22)
*/
static constexpr uint16_t DATA_IND_REQ_HEADER_LENGTH_WITHOUT_PAYLOAD_HEADER = DATA_IND_REQ_HEADER_LENGTH -1;
/**
* length of a data-ind/req-telegram-header without TL and without the 4-byte
* frame-header.
* It contains PDUtype, SourceISSI, DestinationISSI, ProtocolIdentifier,
* LengthInBits and LengthInBytes.
*/
static constexpr uint16_t DATA_IND_REQ_NO_TL_HEADER_LENGTH = 14;
/**
* the maximum length of payload-data (including payload-status-byte) of a radio-
* telegram. If payload-data is larger, fragmentation must be made.
*/
static constexpr uint16_t MAX_RADIO_TELEGRAM_PAYLOAD_LENGTH = 249; // 256: 1 Byte Protokoll-ID + 255 Byte Daten
/**
* frameheader (4) + tetra-header (22) + payloadheader (1)
*/
static constexpr uint16_t PAYLOAD_STATUS_LENGTH = 1;
/**
* The protocol allows a max of 16 fragments, but due to definitions in file
* zsksxdit.x it could be less.
*/
static constexpr uint8_t MAX_NBR_OF_FRAGMENTS = 16;
/**
* constructor for a Register-Ind telegram
*
* @param a_sourceISSI
*/
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI);
/**
* constructor for a Group-Monitoring-Ind telegram
*
* @param a_sourceISSI
*/
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI, const std::set<uint32_t> &groups);
/**
* constructor for a Report-Ind telegram
*
* @param a_sourceISSI
* @param a_delivery
*/
explicit CoPrtCnvRadioTelegram(const uint32_t a_sourceISSI, const E_DeliveryStatusForTL_Report a_delivery);
/**
* Constructor for received telegrams (Data-Ind/Req, PDU type = 2)
*
* @param a_data
*/
explicit CoPrtCnvRadioTelegram(const QByteArray &a_data);
/**
* the telegraminformation will be set
*
* @param a_telegramId
* @param a_payloadSize inclusive 3 byte telegraminformation
* @param a_identity
*/
explicit CoPrtCnvRadioTelegram(const gef_telegramm_id_et a_telegramId, const uint16_t a_payloadSize, const uint16_t a_identity);
/**
* for login-telegram
*
* @param a_loginTelegramStatus
* @param a_identity
* @param a_issi
*/
explicit CoPrtCnvRadioTelegram(const E_LoginStatus a_loginTelegramStatus, const uint16_t a_identity, uint32_t a_issi);
// set this issis for a login repsone e_LoginReject | e_LoginOtherExercise
void setLoginIssis(int hostIssi, int groupIssi1, int groupIssi2);
/**
* for generating fragmented telegrams.
* a_error will be true, if the fragmented telegrams cannot be generated.
*
* @param a_bigTelegram
* @param a_fragmentIndex
* @param a_error
*/
explicit CoPrtCnvRadioTelegram(const std::shared_ptr<CoPrtCnvRadioTelegram> &a_bigTelegram,
const uint8_t a_fragmentIndex, bool &a_error);
virtual ~CoPrtCnvRadioTelegram();
/**
* ETS Hack due to +/-1 telegram id on tetra ...
*/
void fixupTelegramIdForEts(bool convertToEtsId);
static void setEtsMode(bool bIsEtsMode);
/**
* Sets the paylaod-data.
*
* @param a_value
* @param a_size
*/
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);
/**
* Sets the paylaod-data.
*
* @param a_value
*/
void setPayloadData(const uint8_t a_value) { return setPayload1Byte(a_value); }
/**
* Sets the paylaod-data.
*
* @param a_data
* @param a_size
*/
void setPayloadData(const uint8_t *a_data, const uint16_t a_size);
/**
* Returns a pointer to data of radio-telegram.
*/
const char *getData() const { return m_data.data(); }
char *getData() { return m_data.data(); }
QByteArray data() const { return m_data; }
/**
* the overall size of telegram, including all headers
*/
int getSize() const { return m_data.size(); }
/**
* Returns the telegramId of radio-telegram.
*/
gef_telegramm_id_et getTelID() const;
/**
* Returns the counter.
*/
uint8_t zaehler() const;
/**
* Sets the counter.
*
* @param a_counter
*/
void setZaehler(const uint8_t a_counter);
/**
* Returns a paylaod-value. Its size depends on a_size.
*
* @param a_offset
* @param a_size
*/
uint32_t getPayloadDataUInt32(size_t a_offset, uint16_t a_size) const;
/**
* Returns a 1-byte paylaod-value.
*
* @param a_offset
*/
uint8_t getPayloadDataUInt8(size_t a_offset) const;
/**
* Returns the destISSI of radio-telegram.
*/
uint32_t getDestISSI() const;
/**
* Returns the identiy of radio-telegram.
*/
uint16_t getIdentity() const;
/**
* Sets the srcISSI.
*
* @param a_ISSI
*/
void setSrcISSI(const uint32_t a_ISSI);
/**
* Returns true if it is broadcast-telegram, which has not yet set a broadcast-
* index.
*/
bool mustBroadcastBeSet() const;
/**
* Sets the broadcast-index.
*
* @param a_broadcastIndex
*/
void setBroadcastIndex(const uint16_t a_broadcastIndex);
/**
* Set the dstISSI.
*
* @param a_ISSI
*/
void setDestISSI(const uint32_t a_ISSI);
/**
* Returns the PDU-type of radio-telegram.
*/
CoPrtCnvRadioTelegram::E_PDU_Type getPDU_Type() const;
/**
* Returns the fragment-status of radio-telegram.
*/
CoPrtCnvRadioTelegram::E_FragmentStatus getFragmentStatus() const;
/**
* Returns the fragment-counter of radio-telegram.
*/
uint8_t getFragmentCounter() const;
/**
* If CRC-bit is set, it checks the CRC and removes CRC-stuff from telegram.
* If CRC-bit is not set, simply true will be returned
*/
bool isCrcOk() const;
/**
* Returns the srcISSI of radio-telegram.
*/
uint32_t getSrcISSI() const;
/**
* returns true if the it is a special login telegram
*/
bool isLoginTelegram() const;
/**
* returns true if the it is a special login telegram
*/
bool mustBeFragmented() const;
/**
* Returns a pointer to payload-data on a certain position of radio-telegram.
*
* @param a_offset
*/
const uint8_t *getPayloadDataPtr(uint16_t a_offset) const;
uint8_t *getPayloadDataPtr(uint16_t a_offset);
/**
* the size of payload-data without payload-status-header
*/
virtual uint16_t getPayloadSize() const;
/**
* Converts the list of fragmented telegrams into 1 big radio-telegram.
* The function allocates a block of data. The caller is responsible to delete
* this block of data, when no longer used.
* If conversion fails NULL will be returned
*
* @param a_fragTelegramList
*/
static QByteArray getUnfragmentedData(const std::multimap<uint16_t, CoPrtCnvRadioTelegram *> &a_fragTelegramList);
/**
* length without frame-header (4 byte)
*
* @param a_lengthWithoutFrame
*/
static bool isTelegramLengthOk(const uint16_t a_lengthWithoutFrame);
/**
* returns true if the it is a normal, unfragmented telegram (but not a login-
* telegram)
*/
bool isNormalTelegram() const;
/**
* Returns the priority of radio-telegram.
*/
uint8_t getPriority() const;
/**
* Returns the broadcast-index of radio-telegram.
*/
uint16_t getBroadcastIndex() const;
/**
* Sets the paylaod-data based on a_index with size a_size.
*
* @param a_index the payload-based position where the byte should be written
* @param a_value
* @param a_size
*/
void setPayloadDataWithIndex(const uint16_t a_index, const uint32_t a_value, const uint16_t a_size);
/**
* Sets the complete paylaod-data.
*
* @param a_data
* @param a_length
*/
void setPayloadDataComplete(const QByteArray &payload);
/**
* ATTENTION with use of this function, because it is a (little) dirty trick to
* resize the sammel-telegrams without memory-allocation.
* It is the responsibity of the user to not overwrite memory!!!
*
* @param a_newPayloadSize
*/
void resetPayloadSize(const uint16_t a_newPayloadSize);
/**
* Set the identity.
*
* @param a_identity
*/
void setIdentity(const uint16_t a_identity);
/**
* Sets the protocol-identifier.
*
* @param a_ProtocolIdentifier
*/
void setProtocolIdentifier(const E_ProtocolIdentifier a_ProtocolIdentifier);
/**
* Sets the message-reference.
*
* @param a_MessageReference
*/
void setMessageReference(const uint8_t a_MessageReference);
/**
* returns true if the it is a SDS/TL telegram
*/
bool isSDSTL() const;
/**
* Returns the registration-status of TETRA-header of SdsGw-Register-Rsp telegram
*/
CoPrtCnvRadioTelegram::E_RegistrationStatus getRegistrationStatus() const;
/**
* Returns the registration-status of TETRA-header of SdsGw-Register-Rsp telegram
* in text-form
*/
std::string getRegistrationStatusAsText() const;
/**
* Returns the protocolIdentifier of radio-telegram.
*/
CoPrtCnvRadioTelegram::E_ProtocolIdentifier getProtocolIdentifier() const;
/**
* Returns the protocolIdentifier of radio-telegram in text-form
*/
std::string getProtocolIdentifierAsText() const;
/**
* Returns the message-reference of radio-telegram.
*/
uint8_t getMessageReference() const;
/**
* Returns the area selection of TETRA-Header
*/
uint8_t getAreaSelection() const;
/**
* Returns the validity period of radio-telegram.
*/
uint8_t getValidityPeriod() const;
/**
* Returns the forward-address of TETRA-Header
*/
uint32_t getForwardAddress() const;
/**
* Returns the flags of TETRA-Header
*/
CoPrtCnvRadioTelegram::E_Flags getFlags() const;
/**
* Returns the flags of TETRA-Header as text
*/
std::string getFlagsAsText() const;
/**
* Returns the length in bits-field of TETRA-Header
*/
uint16_t getLengthInBits() const;
/**
* Returns the length in bytes-field of TETRA-Header
*/
uint16_t getLengthInBytes() const;
/**
* Returns true when the Telegram has a crc checksum.
*/
bool getWithCrc() const;
/**
* Returns the delivery-field of TETRA-Header of SdsGw-Report-Ind/Req telegrams.
*/
CoPrtCnvRadioTelegram::E_DeliveryStatusForTL_Report getDelivery() const;
/**
* Returns the delivery-field of TETRA-Header of SdsGw-Report-Ind/Req telegrams as
* text.
*/
std::string getDeliveryAsText() const;
/**
* Converts a signed 3-byte value into a signed 4-byte-value. I.e. used for
* positions (north and east).
*
* @param a_offset
*/
int32_t getPayloadDataSInt24(uint16_t a_offset) const;
/**
* Returns true if the telegram needs licensing.
*/
bool needsLicensing() const;
/**
* returns true when the telegram has an expiry-date and is expired.
* Returns false if the telegram has no expiry-date
*/
bool hasExpired() const;
/**
* Returns the expire-time of the telegram.
* Returns 0 if the telegram has not expire-time.
*/
uint32_t getExpireTime() const;
/**
* checks whether the content of telegram is valid, but only a few data will be
* checked, i.e. the kennung of wirkfeld and funktionsraum.
* Returns true if content of telegram is vaild (or will not be checked)
*/
bool isContentValid();
/**
* returns true if it is time to send this telegram as normal broadcast.
*
* @param a_currentTime
* @param a_wasLastBroadcast
* @param a_updateBroadcastCounter
*/
bool mustBeSentAsBroadcast(time_t a_currentTime, bool &a_wasLastBroadcast, const bool a_updateBroadcastCounter = true);
/**
* Set the delay-times for 2nd and 3rd broadcast.
*
* @param a_2ndDelay
* @param a_3rdDelay
*/
static void setBroadcastDelayTimes(int a_2ndDelay, int a_3rdDelay);
/**
* Set the max count of how often a Broadcasttelegram will be send (0 is ignored, the telegram is send at least one time.
*
* @brief setMaxBroadcastSendCnt
* @param a_maxSendCnt
*/
static void setMaxBroadcastSendCnt(int a_maxSendCnt);
/**
* returns true if it is a broadcast-telegram and it is moved to broadcast-list
*/
bool isMovedToBroadcastList() const;
/**
* Sets the broadcast-only-flag.
*
* @param a_doSet
*/
void setBroadcastOnly(const bool a_doSet = true);
/**
* Returns the broadcast-only-flag.
*/
bool isBroadcastOnly() const;
/**
* Defines the telegram which will be sent as normal broadcast instead a
* Sammeltelegram.
*
* @param a_radioTelegram
*/
void setBroadcastonlyTelegram(const std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> &a_radioTelegram);
/**
* Returns the telegram which will be sent as normal broadcast instead a
* Sammeltelegram.
*/
std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> getBroadcastonlyTelegram() const;
/**
* nbr of times already sent this normal broadcast (only used for broadcast-
* telegrams)
*/
uint16_t getBroadcastCounter() const;
//begin_public_{ACFD8558-E5A4-4877-B503-41FCB730B678}
//end_public_{ACFD8558-E5A4-4877-B503-41FCB730B678}
protected:
/**
* The telegram-data, including header
*/
QByteArray m_data;
/**
* The internal index for filling telegram with setPayloadData()
*/
uint16_t m_PayloadIndex;
/**
* nbr of times already sent this normal broadcast (only used for broadcast-
* telegrams)
*/
uint16_t m_BroadcastCounter;
/**
* time when sending next normal broadcast (only used for broadcast-telegrams)
*/
time_t m_NextSendTime;
/**
* The delay between 1st and 2nd normal broadcast
*/
static int s_2ndDelay;
/**
* The delay between 2nd and 3rd normal broadcast
*/
static int s_3rdDelay;
/**
* The delay between 2nd and 3rd normal broadcast
*/
static int s_maxBroadcastSendCnt;
/**
* True if the telegram is used only as normal broadcast, not as nachforderung
*/
bool m_IsBroadcastOnly;
/**
* Contains the normal broadcast-telegram, which will be sent instead of
* sammeltelegram for Nachfoderung
*/
std::shared_ptr<N_CoPrtCnv::CoPrtCnvRadioTelegram> m_BroadcastOnlyTelegram;
/**
* For ETS - there al telgram ids are +1, therefore we have to remove 1 to be able
* to work with our ids.
*/
static bool s_etsMode;
/**
* checks the payload-length of telegram. Returns true if the length is ok.
* Logs an error if length not ok.
*/
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;
/**
* Set a 1-byte value at offset a_offset.
*/
static void set1Byte(QByteArray &a_data, uint16_t a_offset, uint8_t a_value);
/**
* Set a 2-byte value at offset a_offset.
*/
static void set2Byte(QByteArray &a_data, uint16_t a_offset, uint16_t a_value);
/**
* Set a 4-byte value at offset a_offset.
*/
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;
/**
* Sets the header with magic-number and size. The length will be 0.
*
* @param a_data
* @param a_size The overall-size including all headers
*/
static void setHeader(QByteArray &data, E_PDU_Type pduType);
/**
* Fills the header with SrcISSI, DstISSI, length in bits and length in bytes. PDU
* will be set for DataIndicationRequest.
* ProtocolIdentifier, message reference, area selection, forward address, flags
* will be filled with default-values.
*
* @param a_data
*/
static void fillDataIndReqHeader(QByteArray &a_data);
/**
* Internal function to set the srcISSI.
*
* @param a_data
* @param a_ISSI
*/
static void setSrcISSI_Internal(QByteArray &data, const uint32_t issi);
/**
* Internal function to set the dstISSI.
*
* @param a_data
* @param a_ISSI
*/
static void setDestISSI_Internal(QByteArray &data, const uint32_t issi);
private:
/**
* The logger object
*/
NGL::INGLLogger &m_logger;
};
}
@@ -0,0 +1,72 @@
// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
#pragma once
#include <CoPrtCnv/coprtcnv_export.h>
namespace TrainingAreaBase
{
namespace TetraIcd
{
struct TrainingAreaTelegram;
}
}
namespace N_CoPrtCnv
{
class CoPrtCnvRadioTelegram;
class CoPrtCnvCentralTelegram;
/**
* This class is responsible to convert radio-telegrams into central-telegrams and
* vice versa.
* @author alois.wismer
* @version 1.0
* @created 19-Mrz-2010 13:32:40
*/
namespace CoPrtCnvTelegramConverter
{
/**
* Converts central-telegrams to radio-telegrams.
* Returns NULL if conversion was failed.
*
* @param a_telegram
*/
COPRTCNV_EXPORT CoPrtCnvRadioTelegram *convertToRadio(CoPrtCnvCentralTelegram *a_telegram);
COPRTCNV_EXPORT CoPrtCnvRadioTelegram *convertToRadio(const TrainingAreaBase::TetraIcd::TrainingAreaTelegram *a_telegram);
/**
* converts a radiotelegram into a central.
* returns nullptr if conversion failed
*
* @param a_radioTelegram
*/
COPRTCNV_EXPORT CoPrtCnvCentralTelegram *convertToCentral(const CoPrtCnvRadioTelegram *a_radioTelegram);
COPRTCNV_EXPORT TrainingAreaBase::TetraIcd::TrainingAreaTelegram *convertToTabTele(const CoPrtCnvRadioTelegram *a_radioTelegram);
/**
* Set the text codec to use for string send to/received from tetra
*/
COPRTCNV_EXPORT void setTetraTextCodec(const char *codecName);
/**
* Set to trueif single fire (WIRKFELD_EINZELGESCHOSS) has two bytes for diameter, otherwise only one byte is used
*/
COPRTCNV_EXPORT void setUse2BytesForSingleFireDiameter(bool bUse);
COPRTCNV_EXPORT void setUsePvSan(bool bUse);
}
}
File diff suppressed because it is too large. Load diff
+121
View File
@@ -0,0 +1,121 @@
/**
* Telegram IDs used in ICD52
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2016-11-14
*/
#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
};