Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user