mirror of
https://github.com/thelsing/knx.git
synced 2025-06-08 01:16:45 +02:00
initialize all fields (hopefully)
This commit is contained in:
parent
c5bf61a44f
commit
b3f6a0e3fa
@ -49,10 +49,12 @@ public:
|
||||
* @return true if the address table contains the group address, false otherwise
|
||||
*/
|
||||
bool contains(uint16_t groupAddress);
|
||||
|
||||
protected:
|
||||
virtual void beforeStateChange(LoadState& newState);
|
||||
uint8_t propertyCount();
|
||||
PropertyDescription* propertyDescriptions();
|
||||
|
||||
private:
|
||||
uint16_t* _groupAddresses;
|
||||
uint16_t* _groupAddresses = 0;
|
||||
};
|
||||
|
@ -48,6 +48,6 @@ class APDU
|
||||
APDU(uint8_t* data, CemiFrame& frame);
|
||||
|
||||
private:
|
||||
uint8_t* _data;
|
||||
uint8_t* _data = 0;
|
||||
CemiFrame& _frame;
|
||||
};
|
@ -146,6 +146,6 @@ class ApplicationLayer
|
||||
uint16_t _savedAsapResponse;
|
||||
AssociationTableObject& _assocTable;
|
||||
BusAccessUnit& _bau;
|
||||
TransportLayer* _transportLayer;
|
||||
TransportLayer* _transportLayer = 0;
|
||||
int32_t _connectedTsap;
|
||||
};
|
||||
|
@ -15,9 +15,11 @@ public:
|
||||
uint32_t getInt(uint32_t addr);
|
||||
uint8_t* save(uint8_t* buffer);
|
||||
uint8_t* restore(uint8_t* buffer);
|
||||
|
||||
protected:
|
||||
uint8_t propertyCount();
|
||||
PropertyDescription* propertyDescriptions();
|
||||
|
||||
private:
|
||||
uint8_t _programVersion[5];
|
||||
uint8_t _programVersion[5] = {0, 0, 0, 0, 0};
|
||||
};
|
@ -13,10 +13,12 @@ public:
|
||||
uint8_t* restore(uint8_t* buffer);
|
||||
|
||||
int32_t translateAsap(uint16_t asap);
|
||||
|
||||
protected:
|
||||
void beforeStateChange(LoadState& newState);
|
||||
uint8_t propertyCount();
|
||||
PropertyDescription* propertyDescriptions();
|
||||
|
||||
private:
|
||||
uint16_t* _tableData;
|
||||
uint16_t* _tableData = 0;
|
||||
};
|
@ -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)
|
||||
|
@ -7,11 +7,13 @@ class Bau07B0: public BauSystemB
|
||||
{
|
||||
public:
|
||||
Bau07B0(Platform& platform);
|
||||
|
||||
protected:
|
||||
InterfaceObject* getInterfaceObject(uint8_t idx);
|
||||
uint8_t* descriptor();
|
||||
DataLinkLayer& dataLinkLayer();
|
||||
|
||||
private:
|
||||
TpUartDataLinkLayer _dlLayer;
|
||||
uint8_t _descriptor[2];
|
||||
uint8_t _descriptor[2] = {0x07, 0xb0};
|
||||
};
|
@ -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)
|
||||
|
@ -8,12 +8,14 @@ class Bau57B0: public BauSystemB
|
||||
{
|
||||
public:
|
||||
Bau57B0(Platform& platform);
|
||||
|
||||
protected:
|
||||
InterfaceObject* getInterfaceObject(uint8_t idx);
|
||||
uint8_t* descriptor();
|
||||
DataLinkLayer& dataLinkLayer();
|
||||
|
||||
private:
|
||||
IpParameterObject _ipParameters;
|
||||
IpDataLinkLayer _dlLayer;
|
||||
uint8_t _descriptor[2];
|
||||
uint8_t _descriptor[2] = {0x57, 0xb0};
|
||||
};
|
@ -28,6 +28,7 @@ public:
|
||||
void writeMemory();
|
||||
void addSaveRestore(SaveRestore* obj);
|
||||
void restartRequest(uint16_t asap);
|
||||
|
||||
protected:
|
||||
virtual DataLinkLayer& dataLinkLayer() = 0;
|
||||
virtual uint8_t* descriptor() = 0;
|
||||
@ -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);
|
||||
|
@ -15,6 +15,7 @@
|
||||
class CemiFrame
|
||||
{
|
||||
friend class DataLinkLayer;
|
||||
|
||||
public:
|
||||
CemiFrame(uint8_t* data, uint16_t length);
|
||||
CemiFrame(uint8_t apduLength);
|
||||
@ -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;
|
||||
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
|
||||
};
|
@ -19,6 +19,7 @@ public:
|
||||
virtual void loop() = 0;
|
||||
virtual void enabled(bool value) = 0;
|
||||
virtual bool enabled() const = 0;
|
||||
|
||||
protected:
|
||||
void frameRecieved(CemiFrame& frame);
|
||||
void dataConReceived(CemiFrame& frame, bool success);
|
||||
|
@ -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;
|
||||
};
|
@ -19,7 +19,6 @@ enum ComFlag
|
||||
|
||||
class GroupObject;
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#include <functional>
|
||||
typedef std::function<void(GroupObject&)> GroupObjectUpdatedHandler;
|
||||
@ -33,6 +32,7 @@ typedef void(*GroupObjectUpdatedHandler)(GroupObject& go);
|
||||
class GroupObject
|
||||
{
|
||||
friend class GroupObjectTableObject;
|
||||
|
||||
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;
|
||||
};
|
||||
|
@ -18,10 +18,12 @@ public:
|
||||
|
||||
virtual uint8_t* save(uint8_t* buffer);
|
||||
virtual uint8_t* restore(uint8_t* buffer);
|
||||
|
||||
protected:
|
||||
virtual void beforeStateChange(LoadState& newState);
|
||||
uint8_t propertyCount();
|
||||
PropertyDescription* propertyDescriptions();
|
||||
|
||||
private:
|
||||
void freeGroupObjects();
|
||||
bool initGroupObjects();
|
||||
|
@ -114,6 +114,7 @@ public:
|
||||
*/
|
||||
|
||||
void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns the number of properties the interface object has.
|
||||
|
@ -7,6 +7,7 @@
|
||||
class IpDataLinkLayer : public DataLinkLayer
|
||||
{
|
||||
using DataLinkLayer::_deviceObject;
|
||||
|
||||
public:
|
||||
IpDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, IpParameterObject& ipParam, NetworkLayer& layer,
|
||||
Platform& platform);
|
||||
@ -14,6 +15,7 @@ public:
|
||||
void loop();
|
||||
void enabled(bool value);
|
||||
bool enabled() const;
|
||||
|
||||
private:
|
||||
bool _enabled = false;
|
||||
bool sendFrame(CemiFrame& frame);
|
||||
|
@ -17,9 +17,11 @@ public:
|
||||
|
||||
uint32_t multicastAddress() const;
|
||||
uint8_t ttl() const { return _ttl; }
|
||||
|
||||
protected:
|
||||
uint8_t propertyCount();
|
||||
PropertyDescription* propertyDescriptions();
|
||||
|
||||
private:
|
||||
uint16_t _projectInstallationId = 0;
|
||||
uint8_t _ipAssignmentMethod = 0;
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -33,6 +33,6 @@ public:
|
||||
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;
|
||||
};
|
||||
|
@ -22,6 +22,6 @@ class NPDU
|
||||
NPDU(uint8_t* data, CemiFrame& frame);
|
||||
|
||||
private:
|
||||
uint8_t* _data;
|
||||
uint8_t* _data = 0;
|
||||
CemiFrame& _frame;
|
||||
};
|
@ -31,6 +31,6 @@ class TPDU
|
||||
TPDU(uint8_t* data, CemiFrame& frame);
|
||||
|
||||
private:
|
||||
uint8_t* _data;
|
||||
uint8_t* _data = 0;
|
||||
CemiFrame& _frame;
|
||||
};
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user