80 lines
1.9 KiB
C++
Executable File
80 lines
1.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Oberklasser der BSM-Telegramme
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Gerlinde Rudolphus, SLSA, 2013-03-05
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QByteArray>
|
|
#include "buildingcontrolbsm_export.h"
|
|
|
|
namespace BuildingControlUnit
|
|
{
|
|
namespace BSM
|
|
{
|
|
namespace Telegrams
|
|
{
|
|
enum class PanTelegramId
|
|
{
|
|
ALIVE = 0x08,
|
|
REQ_BIT_TIMEOUT = 0x09,
|
|
BIT_TIMEOUT_REPORT = 0x0a,
|
|
REQ_SW_VERSION = 0x0e,
|
|
SW_VERSION_REPORT = 0x0f,
|
|
CONFIGURATION_SETUP = 0x20,
|
|
REQ_CONFIGURATION = 0x21,
|
|
CONFIGURATION_REPORT = 0x22,
|
|
ER_DIRECT_FIRE = 0x23,
|
|
ER_OBSERVER_CONTR = 0x24,
|
|
REQ_TECHNICAL_STATUS = 0x27,
|
|
TECHNICAL_STATUS = 0x28,
|
|
SIGNAL_FLASHLIGHT = 0x30, // not described in icd
|
|
CHOPPED_SIGNAL_FLASH = 0x39,
|
|
};
|
|
QByteArray toString(PanTelegramId teleId);
|
|
|
|
class BUILDINGCONTROLBSM_EXPORT Telegram
|
|
{
|
|
protected:
|
|
explicit Telegram(PanTelegramId telId)
|
|
: m_telId(telId)
|
|
{}
|
|
public:
|
|
virtual ~Telegram() = default;
|
|
|
|
virtual QByteArray print() const
|
|
{
|
|
return toString(m_telId);
|
|
}
|
|
QByteArray toBytestream() const;
|
|
|
|
PanTelegramId telId() const
|
|
{
|
|
return m_telId;
|
|
}
|
|
|
|
static Telegram *telegramFromBytestream(const QByteArray &data_);
|
|
static const unsigned char s_stx = 0x02;
|
|
static const unsigned char s_etx = 0x03;
|
|
static const unsigned char s_subMark = 0x80;
|
|
static const unsigned char s_subStx = 0x82;
|
|
static const unsigned char s_subEtx = 0x83;
|
|
static const unsigned char s_subSub = 0x00;
|
|
protected:
|
|
virtual QByteArray payload() const = 0;
|
|
static unsigned short decode_ushort_little(const QByteArray &data, const int start, bool &bOk);
|
|
private:
|
|
static unsigned char calcChecksum(const QByteArray &data);
|
|
static QByteArray substituteData(const QByteArray &data);
|
|
static QByteArray desubstituteData(const QByteArray &data);
|
|
PanTelegramId m_telId;
|
|
};
|
|
|
|
} // namespace Telegrams
|
|
} // namespace BSM
|
|
} // namespace BuildingControlUnit
|