initialize all fields (hopefully)

This commit is contained in:
Thomas Kunze 2019-07-15 21:50:04 +02:00
parent c5bf61a44f
commit b3f6a0e3fa
26 changed files with 303 additions and 290 deletions

View File

@ -9,18 +9,18 @@
* See section 4.10 of @cite knx:3/5/1 for further details.
* It implements realisation type 7 (see section 4.10.7 of @cite knx:3/5/1).
*/
class AddressTableObject: public TableObject
class AddressTableObject : public TableObject
{
public:
public:
/**
* The contructor.
*
* @param platform This parameter is only passed to the custructor of TableObject an not used by this class.
*/
AddressTableObject(Platform& platform);
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t *data);
uint8_t *save(uint8_t *buffer);
uint8_t *restore(uint8_t *buffer);
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
uint8_t* save(uint8_t* buffer);
uint8_t* restore(uint8_t* buffer);
/**
* returns the number of group addresses of the object.
*/
@ -49,10 +49,12 @@ public:
* @return true if the address table contains the group address, false otherwise
*/
bool contains(uint16_t groupAddress);
protected:
protected:
virtual void beforeStateChange(LoadState& newState);
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
uint16_t* _groupAddresses;
private:
uint16_t* _groupAddresses = 0;
};

View File

@ -48,6 +48,6 @@ class APDU
APDU(uint8_t* data, CemiFrame& frame);
private:
uint8_t* _data;
uint8_t* _data = 0;
CemiFrame& _frame;
};

View File

@ -146,6 +146,6 @@ class ApplicationLayer
uint16_t _savedAsapResponse;
AssociationTableObject& _assocTable;
BusAccessUnit& _bau;
TransportLayer* _transportLayer;
TransportLayer* _transportLayer = 0;
int32_t _connectedTsap;
};

View File

@ -2,9 +2,9 @@
#include "table_object.h"
class ApplicationProgramObject: public TableObject
class ApplicationProgramObject : public TableObject
{
public:
public:
ApplicationProgramObject(Platform& platform);
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count);
@ -15,9 +15,11 @@ public:
uint32_t getInt(uint32_t addr);
uint8_t* save(uint8_t* buffer);
uint8_t* restore(uint8_t* buffer);
protected:
protected:
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
uint8_t _programVersion[5];
private:
uint8_t _programVersion[5] = {0, 0, 0, 0, 0};
};

View File

@ -2,9 +2,9 @@
#include "table_object.h"
class AssociationTableObject: public TableObject
class AssociationTableObject : public TableObject
{
public:
public:
AssociationTableObject(Platform& platform);
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
uint16_t entryCount();
@ -13,10 +13,12 @@ public:
uint8_t* restore(uint8_t* buffer);
int32_t translateAsap(uint16_t asap);
protected:
protected:
void beforeStateChange(LoadState& newState);
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
uint16_t* _tableData;
private:
uint16_t* _tableData = 0;
};

View File

@ -4,7 +4,7 @@
class BusAccessUnit
{
public:
public:
virtual void groupValueReadLocalConfirm(AckType ack, uint16_t asap, Priority priority, HopCountType hopType, bool status);
virtual void groupValueReadIndication(uint16_t asap, Priority priority, HopCountType hopType);
virtual void groupValueReadResponseConfirm(AckType ack, uint16_t asap, Priority priority, HopCountType hopTtype,

View File

@ -2,17 +2,13 @@
#include <string.h>
#include <stdio.h>
using namespace std;
Bau07B0::Bau07B0(Platform& platform): BauSystemB(platform),
Bau07B0::Bau07B0(Platform& platform)
: BauSystemB(platform),
_dlLayer(_deviceObj, _addrTable, _netLayer, _platform)
{
_netLayer.dataLinkLayer(_dlLayer);
uint8_t descriptor[] = { 0x07, 0xb0 };
_descriptor[0] = descriptor[0];
_descriptor[1] = descriptor[1];
}
InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx)

View File

@ -3,15 +3,17 @@
#include "bau_systemB.h"
#include "tpuart_data_link_layer.h"
class Bau07B0: public BauSystemB
class Bau07B0 : public BauSystemB
{
public:
public:
Bau07B0(Platform& platform);
protected:
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
uint8_t* descriptor();
DataLinkLayer& dataLinkLayer();
private:
private:
TpUartDataLinkLayer _dlLayer;
uint8_t _descriptor[2];
uint8_t _descriptor[2] = {0x07, 0xb0};
};

View File

@ -4,16 +4,13 @@
using namespace std;
Bau57B0::Bau57B0(Platform& platform): BauSystemB(platform),
Bau57B0::Bau57B0(Platform& platform)
: BauSystemB(platform),
_ipParameters(_deviceObj, platform),
_dlLayer(_deviceObj, _addrTable, _ipParameters, _netLayer, _platform)
{
_netLayer.dataLinkLayer(_dlLayer);
_memory.addSaveRestore(&_ipParameters);
uint8_t descriptor[] = { 0x57, 0xb0 };
_descriptor[0] = descriptor[0];
_descriptor[1] = descriptor[1];
}
InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx)

View File

@ -4,16 +4,18 @@
#include "ip_parameter_object.h"
#include "ip_data_link_layer.h"
class Bau57B0: public BauSystemB
class Bau57B0 : public BauSystemB
{
public:
public:
Bau57B0(Platform& platform);
protected:
protected:
InterfaceObject* getInterfaceObject(uint8_t idx);
uint8_t* descriptor();
DataLinkLayer& dataLinkLayer();
private:
private:
IpParameterObject _ipParameters;
IpDataLinkLayer _dlLayer;
uint8_t _descriptor[2];
uint8_t _descriptor[2] = {0x57, 0xb0};
};

View File

@ -13,9 +13,9 @@
#include "platform.h"
#include "memory.h"
class BauSystemB: protected BusAccessUnit
class BauSystemB : protected BusAccessUnit
{
public:
public:
BauSystemB(Platform& platform);
virtual void loop();
DeviceObject& deviceObject();
@ -28,7 +28,8 @@ public:
void writeMemory();
void addSaveRestore(SaveRestore* obj);
void restartRequest(uint16_t asap);
protected:
protected:
virtual DataLinkLayer& dataLinkLayer() = 0;
virtual uint8_t* descriptor() = 0;
void memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number,
@ -58,7 +59,6 @@ protected:
void groupValueWriteIndication(uint16_t asap, Priority priority, HopCountType hopType,
uint8_t* data, uint8_t dataLength) override;
virtual InterfaceObject* getInterfaceObject(uint8_t idx) = 0;
void sendNextGroupTelegram();
void updateGroupObject(GroupObject& go, uint8_t* data, uint8_t length);

View File

@ -15,11 +15,12 @@
class CemiFrame
{
friend class DataLinkLayer;
public:
public:
CemiFrame(uint8_t* data, uint16_t length);
CemiFrame(uint8_t apduLength);
CemiFrame(const CemiFrame& other);
CemiFrame& operator= (CemiFrame other);
CemiFrame& operator=(CemiFrame other);
MessageCode messageCode() const;
void messageCode(MessageCode value);
@ -52,12 +53,13 @@ public:
uint8_t calcCRC(uint8_t* buffer, uint16_t len);
bool valid() const;
private:
uint8_t buffer[0xff + NPDU_LPDU_DIFF]; //only valid of add info is zero
uint8_t* _data;
uint8_t* _ctrl1;
private:
uint8_t buffer[0xff + NPDU_LPDU_DIFF] = {0}; //only valid of add info is zero
uint8_t* _data = 0;
uint8_t* _ctrl1 = 0;
NPDU _npdu;
TPDU _tpdu;
APDU _apdu;
uint16_t _length; // only set if created from byte array
uint16_t _length = 0; // only set if created from byte array
};

View File

@ -8,7 +8,7 @@
class DataLinkLayer
{
public:
public:
DataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, NetworkLayer& layer,
Platform& platform);
@ -19,10 +19,11 @@ public:
virtual void loop() = 0;
virtual void enabled(bool value) = 0;
virtual bool enabled() const = 0;
protected:
protected:
void frameRecieved(CemiFrame& frame);
void dataConReceived(CemiFrame& frame, bool success);
bool sendTelegram(NPDU &npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority);
virtual bool sendFrame(CemiFrame& frame) = 0;
uint8_t* frameData(CemiFrame& frame);
DeviceObject& _deviceObject;

View File

@ -39,13 +39,13 @@ protected:
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
uint8_t _deviceControl;
uint8_t _routingCount;
uint8_t _prgMode;
uint16_t _ownAddress;
uint8_t _deviceControl = 0;
uint8_t _routingCount = 0;
uint8_t _prgMode = 0;
uint16_t _ownAddress = 0;
uint16_t _manufacturerId = 0xfa; //Default to KNXA
uint32_t _bauNumber;
char _orderNumber[10];
uint8_t _hardwareType[6];
uint16_t _version;
uint32_t _bauNumber = 0;
char _orderNumber[10] = "";
uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0};
uint16_t _version = 0;
};

View File

@ -36,110 +36,110 @@
/**
* Converts the KNX Payload given by the specific DPT and puts the value in the KNXValue struc
*/
int KNX_Decode_Value(uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int KNX_Decode_Value(uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
/**
* Converts the KNXValue struct to the KNX Payload as the specific DPT
*/
int KNX_Encode_Value(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int KNX_Encode_Value(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
//KNX to internal
int busValueToBinary(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToBinaryControl(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToStepControl(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToCharacter(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned8(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned8(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToStatusAndMode(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned16(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTimePeriod(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned16(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTimeDelta(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFloat16(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTime(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToDate(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned32(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned32(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToLongTimePeriod(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFloat32(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToAccess(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToString(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToScene(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneControl(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneInfo(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneConfig(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToDateTime(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnicode(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned64(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToAlarmInfo(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSerialNumber(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToVersion(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToScaling(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTariff(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToLocale(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToRGB(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFlaggedScaling(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToActiveEnergy(const uint8_t *payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToBinary(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToBinaryControl(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToStepControl(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToCharacter(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned8(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned8(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToStatusAndMode(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned16(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTimePeriod(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned16(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTimeDelta(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFloat16(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTime(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToDate(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnsigned32(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned32(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToLongTimePeriod(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFloat32(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToAccess(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToString(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToScene(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneControl(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneInfo(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSceneConfig(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToDateTime(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToUnicode(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSigned64(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToAlarmInfo(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToSerialNumber(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToVersion(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToScaling(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToTariff(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToLocale(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToRGB(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToFlaggedScaling(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
int busValueToActiveEnergy(const uint8_t* payload, int payload_length, const Dpt& datatype, KNXValue& value);
//Internal to KNX
int valueToBusValueBinary(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueBinaryControl(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueStepControl(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueCharacter(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned8(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned8(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueStatusAndMode(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned16(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueTimePeriod(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned16(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueTimeDelta(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueFloat16(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueTime(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueDate(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned32(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned32(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueLongTimePeriod(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueFloat32(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueAccess(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueString(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueScene(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneControl(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneInfo(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneConfig(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueDateTime(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnicode(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned64(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueAlarmInfo(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueSerialNumber(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueVersion(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueScaling(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueTariff(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueLocale(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueRGB(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueFlaggedScaling(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueActiveEnergy(const KNXValue& value, uint8_t *payload, int payload_length, const Dpt& datatype);
int valueToBusValueBinary(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueBinaryControl(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueStepControl(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueCharacter(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned8(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned8(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueStatusAndMode(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned16(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueTimePeriod(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned16(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueTimeDelta(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueFloat16(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueTime(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueDate(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnsigned32(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned32(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueLongTimePeriod(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueFloat32(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueAccess(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueString(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueScene(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneControl(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneInfo(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSceneConfig(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueDateTime(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueUnicode(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSigned64(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueAlarmInfo(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueSerialNumber(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueVersion(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueScaling(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueTariff(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueLocale(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueRGB(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueFlaggedScaling(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
int valueToBusValueActiveEnergy(const KNXValue& value, uint8_t* payload, int payload_length, const Dpt& datatype);
//Payload manipulation
bool bitFromPayload(const uint8_t *payload, int index);
uint8_t unsigned8FromPayload(const uint8_t *payload, int index);
int8_t signed8FromPayload(const uint8_t *payload, int index);
uint16_t unsigned16FromPayload(const uint8_t *payload, int index);
int16_t signed16FromPayload(const uint8_t *payload, int index);
uint32_t unsigned32FromPayload(const uint8_t *payload, int index);
int32_t signed32FromPayload(const uint8_t *payload, int index);
double float16FromPayload(const uint8_t *payload, int index);
float float32FromPayload(const uint8_t *payload, int index);
int64_t signed64FromPayload(const uint8_t *payload, int index);
uint8_t bcdFromPayload(const uint8_t *payload, int index);
bool bitFromPayload(const uint8_t* payload, int index);
uint8_t unsigned8FromPayload(const uint8_t* payload, int index);
int8_t signed8FromPayload(const uint8_t* payload, int index);
uint16_t unsigned16FromPayload(const uint8_t* payload, int index);
int16_t signed16FromPayload(const uint8_t* payload, int index);
uint32_t unsigned32FromPayload(const uint8_t* payload, int index);
int32_t signed32FromPayload(const uint8_t* payload, int index);
double float16FromPayload(const uint8_t* payload, int index);
float float32FromPayload(const uint8_t* payload, int index);
int64_t signed64FromPayload(const uint8_t* payload, int index);
uint8_t bcdFromPayload(const uint8_t* payload, int index);
void bitToPayload(uint8_t *payload, int payload_length, int index, bool value);
void unsigned8ToPayload(uint8_t *payload, int payload_length, int index, uint8_t value, uint8_t mask); //mask 0xFF
void signed8ToPayload(uint8_t *payload, int payload_length, int index, int8_t value, uint8_t mask); //mask 0xFF
void unsigned16ToPayload(uint8_t *payload, int payload_length, int index, uint16_t value, uint16_t mask); //mask 0xFFFF
void signed16ToPayload(uint8_t *payload, int payload_length, int index, int16_t value, uint16_t mask); //mask 0xFFFF
void unsigned32ToPayload(uint8_t *payload, int payload_length, int index, uint32_t value, uint32_t mask); //mask = 0xFFFFFFFF
void signed32ToPayload(uint8_t *payload, int payload_length, int index, int32_t value, uint32_t mask); //mask = 0xFFFFFFFF
void float16ToPayload(uint8_t *payload, int payload_length, int index, double value, uint16_t mask); //mask = 0xFFFF
void float32ToPayload(uint8_t *payload, int payload_length, int index, double value, uint32_t mask); //mask = 0xFFFFFFFF
void signed64ToPayload(uint8_t *payload, int payload_length, int index, int64_t value, uint64_t mask); //mask = UINT64_C(0xFFFFFFFFFFFFFFFF)
void bcdToPayload(uint8_t *payload, int payload_length, int index, uint8_t value);
void bitToPayload(uint8_t* payload, int payload_length, int index, bool value);
void unsigned8ToPayload(uint8_t* payload, int payload_length, int index, uint8_t value, uint8_t mask); //mask 0xFF
void signed8ToPayload(uint8_t* payload, int payload_length, int index, int8_t value, uint8_t mask); //mask 0xFF
void unsigned16ToPayload(uint8_t* payload, int payload_length, int index, uint16_t value, uint16_t mask); //mask 0xFFFF
void signed16ToPayload(uint8_t* payload, int payload_length, int index, int16_t value, uint16_t mask); //mask 0xFFFF
void unsigned32ToPayload(uint8_t* payload, int payload_length, int index, uint32_t value, uint32_t mask); //mask = 0xFFFFFFFF
void signed32ToPayload(uint8_t* payload, int payload_length, int index, int32_t value, uint32_t mask); //mask = 0xFFFFFFFF
void float16ToPayload(uint8_t* payload, int payload_length, int index, double value, uint16_t mask); //mask = 0xFFFF
void float32ToPayload(uint8_t* payload, int payload_length, int index, double value, uint32_t mask); //mask = 0xFFFFFFFF
void signed64ToPayload(uint8_t* payload, int payload_length, int index, int64_t value, uint64_t mask); //mask = UINT64_C(0xFFFFFFFFFFFFFFFF)
void bcdToPayload(uint8_t* payload, int payload_length, int index, uint8_t value);

View File

@ -19,12 +19,11 @@ enum ComFlag
class GroupObject;
#ifdef __linux__
#include <functional>
typedef std::function<void(GroupObject&)> GroupObjectUpdatedHandler;
#else
typedef void(*GroupObjectUpdatedHandler)(GroupObject& go);
typedef void (*GroupObjectUpdatedHandler)(GroupObject& go);
#endif
/**
@ -33,7 +32,8 @@ typedef void(*GroupObjectUpdatedHandler)(GroupObject& go);
class GroupObject
{
friend class GroupObjectTableObject;
public:
public:
/**
* The constructor.
*/
@ -206,10 +206,10 @@ public:
size_t asapValueSize(uint8_t code);
GroupObjectUpdatedHandler _updateHandler;
size_t goSize();
uint16_t _asap;
ComFlag _commFlag;
uint8_t* _data;
uint8_t _dataLength;
GroupObjectTableObject* _table;
uint16_t _asap = 0;
ComFlag _commFlag = Ok;
uint8_t* _data = 0;
uint8_t _dataLength = 0;
GroupObjectTableObject* _table = 0;
Dpt _datapointType;
};

View File

@ -3,11 +3,11 @@
#include "table_object.h"
#include "group_object.h"
class GroupObjectTableObject: public TableObject
class GroupObjectTableObject : public TableObject
{
friend class GroupObject;
public:
public:
GroupObjectTableObject(Platform& platform);
virtual ~GroupObjectTableObject();
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
@ -18,11 +18,13 @@ public:
virtual uint8_t* save(uint8_t* buffer);
virtual uint8_t* restore(uint8_t* buffer);
protected:
protected:
virtual void beforeStateChange(LoadState& newState);
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
private:
void freeGroupObjects();
bool initGroupObjects();
uint16_t* _tableData = 0;

View File

@ -53,9 +53,9 @@ enum ObjectType
/**
* This class represents and interface object. See section 4 of @cite knx:3/4/1.
*/
class InterfaceObject: public SaveRestore
class InterfaceObject : public SaveRestore
{
public:
public:
/**
* Destructor
*/
@ -114,7 +114,8 @@ public:
*/
void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
protected:
protected:
/**
* Returns the number of properties the interface object has.
*/

View File

@ -4,17 +4,19 @@
#include "data_link_layer.h"
#include "ip_parameter_object.h"
class IpDataLinkLayer: public DataLinkLayer
class IpDataLinkLayer : public DataLinkLayer
{
using DataLinkLayer::_deviceObject;
public:
public:
IpDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, IpParameterObject& ipParam, NetworkLayer& layer,
Platform& platform);
void loop();
void enabled(bool value);
bool enabled() const;
private:
private:
bool _enabled = false;
bool sendFrame(CemiFrame& frame);
bool sendBytes(uint8_t* buffer, uint16_t length);

View File

@ -4,9 +4,9 @@
#include "device_object.h"
#include "platform.h"
class IpParameterObject: public InterfaceObject
class IpParameterObject : public InterfaceObject
{
public:
public:
IpParameterObject(DeviceObject& deviceObject, Platform& platform);
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count);
@ -17,10 +17,12 @@ public:
uint32_t multicastAddress() const;
uint8_t ttl() const { return _ttl; }
protected:
protected:
uint8_t propertyCount();
PropertyDescription* propertyDescriptions();
private:
private:
uint16_t _projectInstallationId = 0;
uint8_t _ipAssignmentMethod = 0;
uint8_t _ipCapabilities = 0;
@ -29,7 +31,7 @@ private:
uint32_t _defaultGateway = 0;
uint32_t _multicastAddress = 0;
uint8_t _ttl = 60;
char _friendlyName[30] = { 0 };
char _friendlyName[30] = {0};
DeviceObject& _deviceObject;
Platform& _platform;

View File

@ -18,7 +18,7 @@ public:
private:
Platform& _platform;
bool _modified = false;
SaveRestore* _saveRestores[MAXSAVE];
SaveRestore* _saveRestores[MAXSAVE] = {0};
int _saveCount = 0;
uint8_t* _data = 0;
};

View File

@ -8,7 +8,7 @@ class DataLinkLayer;
class NetworkLayer
{
public:
public:
NetworkLayer(TransportLayer& layer);
void dataLinkLayer(DataLinkLayer& layer);
@ -30,9 +30,9 @@ public:
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
private:
void sendDataRequest(TPDU &tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);
private:
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);
uint8_t _hopCount = 6;
DataLinkLayer* _dataLinkLayer;
DataLinkLayer* _dataLinkLayer = 0;
TransportLayer& _transportLayer;
};

View File

@ -22,6 +22,6 @@ class NPDU
NPDU(uint8_t* data, CemiFrame& frame);
private:
uint8_t* _data;
uint8_t* _data = 0;
CemiFrame& _frame;
};

View File

@ -6,7 +6,7 @@
*/
class SaveRestore
{
public:
public:
/**
* This method is called when the object should save its state to the buffer.
*

View File

@ -31,6 +31,6 @@ class TPDU
TPDU(uint8_t* data, CemiFrame& frame);
private:
uint8_t* _data;
uint8_t* _data = 0;
CemiFrame& _frame;
};

View File

@ -51,15 +51,15 @@ public:
void cmdlineArgs(int argc, char** argv);
private:
uint32_t _multicastAddr;
uint16_t _port;
uint32_t _multicastAddr = -1;
uint16_t _port = -1;
int _socketFd = -1;
void doMemoryMapping();
uint8_t* _mappedFile;
uint8_t* _mappedFile = 0;
int _fd = -1;
uint8_t* _currentMaxMem = 0;
std::string _flashFilePath = "flash.bin";
char** _args;
char** _args = 0;
};
#endif