mirror of
https://github.com/thelsing/knx.git
synced 2025-06-04 01:15:26 +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
|
* @return true if the address table contains the group address, false otherwise
|
||||||
*/
|
*/
|
||||||
bool contains(uint16_t groupAddress);
|
bool contains(uint16_t groupAddress);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void beforeStateChange(LoadState& newState);
|
virtual void beforeStateChange(LoadState& newState);
|
||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t* _groupAddresses;
|
uint16_t* _groupAddresses = 0;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,6 @@ class APDU
|
|||||||
APDU(uint8_t* data, CemiFrame& frame);
|
APDU(uint8_t* data, CemiFrame& frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t* _data;
|
uint8_t* _data = 0;
|
||||||
CemiFrame& _frame;
|
CemiFrame& _frame;
|
||||||
};
|
};
|
@ -146,6 +146,6 @@ class ApplicationLayer
|
|||||||
uint16_t _savedAsapResponse;
|
uint16_t _savedAsapResponse;
|
||||||
AssociationTableObject& _assocTable;
|
AssociationTableObject& _assocTable;
|
||||||
BusAccessUnit& _bau;
|
BusAccessUnit& _bau;
|
||||||
TransportLayer* _transportLayer;
|
TransportLayer* _transportLayer = 0;
|
||||||
int32_t _connectedTsap;
|
int32_t _connectedTsap;
|
||||||
};
|
};
|
||||||
|
@ -15,9 +15,11 @@ public:
|
|||||||
uint32_t getInt(uint32_t addr);
|
uint32_t getInt(uint32_t addr);
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer);
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
private:
|
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);
|
uint8_t* restore(uint8_t* buffer);
|
||||||
|
|
||||||
int32_t translateAsap(uint16_t asap);
|
int32_t translateAsap(uint16_t asap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void beforeStateChange(LoadState& newState);
|
void beforeStateChange(LoadState& newState);
|
||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t* _tableData;
|
uint16_t* _tableData = 0;
|
||||||
};
|
};
|
@ -2,17 +2,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Bau07B0::Bau07B0(Platform& platform): BauSystemB(platform),
|
Bau07B0::Bau07B0(Platform& platform)
|
||||||
|
: BauSystemB(platform),
|
||||||
_dlLayer(_deviceObj, _addrTable, _netLayer, _platform)
|
_dlLayer(_deviceObj, _addrTable, _netLayer, _platform)
|
||||||
{
|
{
|
||||||
_netLayer.dataLinkLayer(_dlLayer);
|
_netLayer.dataLinkLayer(_dlLayer);
|
||||||
|
|
||||||
uint8_t descriptor[] = { 0x07, 0xb0 };
|
|
||||||
_descriptor[0] = descriptor[0];
|
|
||||||
_descriptor[1] = descriptor[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx)
|
InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx)
|
||||||
|
@ -7,11 +7,13 @@ class Bau07B0: public BauSystemB
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Bau07B0(Platform& platform);
|
Bau07B0(Platform& platform);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InterfaceObject* getInterfaceObject(uint8_t idx);
|
InterfaceObject* getInterfaceObject(uint8_t idx);
|
||||||
uint8_t* descriptor();
|
uint8_t* descriptor();
|
||||||
DataLinkLayer& dataLinkLayer();
|
DataLinkLayer& dataLinkLayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TpUartDataLinkLayer _dlLayer;
|
TpUartDataLinkLayer _dlLayer;
|
||||||
uint8_t _descriptor[2];
|
uint8_t _descriptor[2] = {0x07, 0xb0};
|
||||||
};
|
};
|
@ -4,16 +4,13 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Bau57B0::Bau57B0(Platform& platform): BauSystemB(platform),
|
Bau57B0::Bau57B0(Platform& platform)
|
||||||
|
: BauSystemB(platform),
|
||||||
_ipParameters(_deviceObj, platform),
|
_ipParameters(_deviceObj, platform),
|
||||||
_dlLayer(_deviceObj, _addrTable, _ipParameters, _netLayer, _platform)
|
_dlLayer(_deviceObj, _addrTable, _ipParameters, _netLayer, _platform)
|
||||||
{
|
{
|
||||||
_netLayer.dataLinkLayer(_dlLayer);
|
_netLayer.dataLinkLayer(_dlLayer);
|
||||||
_memory.addSaveRestore(&_ipParameters);
|
_memory.addSaveRestore(&_ipParameters);
|
||||||
|
|
||||||
uint8_t descriptor[] = { 0x57, 0xb0 };
|
|
||||||
_descriptor[0] = descriptor[0];
|
|
||||||
_descriptor[1] = descriptor[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx)
|
InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx)
|
||||||
|
@ -8,12 +8,14 @@ class Bau57B0: public BauSystemB
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Bau57B0(Platform& platform);
|
Bau57B0(Platform& platform);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InterfaceObject* getInterfaceObject(uint8_t idx);
|
InterfaceObject* getInterfaceObject(uint8_t idx);
|
||||||
uint8_t* descriptor();
|
uint8_t* descriptor();
|
||||||
DataLinkLayer& dataLinkLayer();
|
DataLinkLayer& dataLinkLayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IpParameterObject _ipParameters;
|
IpParameterObject _ipParameters;
|
||||||
IpDataLinkLayer _dlLayer;
|
IpDataLinkLayer _dlLayer;
|
||||||
uint8_t _descriptor[2];
|
uint8_t _descriptor[2] = {0x57, 0xb0};
|
||||||
};
|
};
|
@ -28,6 +28,7 @@ public:
|
|||||||
void writeMemory();
|
void writeMemory();
|
||||||
void addSaveRestore(SaveRestore* obj);
|
void addSaveRestore(SaveRestore* obj);
|
||||||
void restartRequest(uint16_t asap);
|
void restartRequest(uint16_t asap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual DataLinkLayer& dataLinkLayer() = 0;
|
virtual DataLinkLayer& dataLinkLayer() = 0;
|
||||||
virtual uint8_t* descriptor() = 0;
|
virtual uint8_t* descriptor() = 0;
|
||||||
@ -58,7 +59,6 @@ protected:
|
|||||||
void groupValueWriteIndication(uint16_t asap, Priority priority, HopCountType hopType,
|
void groupValueWriteIndication(uint16_t asap, Priority priority, HopCountType hopType,
|
||||||
uint8_t* data, uint8_t dataLength) override;
|
uint8_t* data, uint8_t dataLength) override;
|
||||||
|
|
||||||
|
|
||||||
virtual InterfaceObject* getInterfaceObject(uint8_t idx) = 0;
|
virtual InterfaceObject* getInterfaceObject(uint8_t idx) = 0;
|
||||||
void sendNextGroupTelegram();
|
void sendNextGroupTelegram();
|
||||||
void updateGroupObject(GroupObject& go, uint8_t* data, uint8_t length);
|
void updateGroupObject(GroupObject& go, uint8_t* data, uint8_t length);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
class CemiFrame
|
class CemiFrame
|
||||||
{
|
{
|
||||||
friend class DataLinkLayer;
|
friend class DataLinkLayer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CemiFrame(uint8_t* data, uint16_t length);
|
CemiFrame(uint8_t* data, uint16_t length);
|
||||||
CemiFrame(uint8_t apduLength);
|
CemiFrame(uint8_t apduLength);
|
||||||
@ -52,12 +53,13 @@ public:
|
|||||||
|
|
||||||
uint8_t calcCRC(uint8_t* buffer, uint16_t len);
|
uint8_t calcCRC(uint8_t* buffer, uint16_t len);
|
||||||
bool valid() const;
|
bool valid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t buffer[0xff + NPDU_LPDU_DIFF]; //only valid of add info is zero
|
uint8_t buffer[0xff + NPDU_LPDU_DIFF] = {0}; //only valid of add info is zero
|
||||||
uint8_t* _data;
|
uint8_t* _data = 0;
|
||||||
uint8_t* _ctrl1;
|
uint8_t* _ctrl1 = 0;
|
||||||
NPDU _npdu;
|
NPDU _npdu;
|
||||||
TPDU _tpdu;
|
TPDU _tpdu;
|
||||||
APDU _apdu;
|
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 loop() = 0;
|
||||||
virtual void enabled(bool value) = 0;
|
virtual void enabled(bool value) = 0;
|
||||||
virtual bool enabled() const = 0;
|
virtual bool enabled() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void frameRecieved(CemiFrame& frame);
|
void frameRecieved(CemiFrame& frame);
|
||||||
void dataConReceived(CemiFrame& frame, bool success);
|
void dataConReceived(CemiFrame& frame, bool success);
|
||||||
|
@ -39,13 +39,13 @@ protected:
|
|||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint8_t _deviceControl;
|
uint8_t _deviceControl = 0;
|
||||||
uint8_t _routingCount;
|
uint8_t _routingCount = 0;
|
||||||
uint8_t _prgMode;
|
uint8_t _prgMode = 0;
|
||||||
uint16_t _ownAddress;
|
uint16_t _ownAddress = 0;
|
||||||
uint16_t _manufacturerId = 0xfa; //Default to KNXA
|
uint16_t _manufacturerId = 0xfa; //Default to KNXA
|
||||||
uint32_t _bauNumber;
|
uint32_t _bauNumber = 0;
|
||||||
char _orderNumber[10];
|
char _orderNumber[10] = "";
|
||||||
uint8_t _hardwareType[6];
|
uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0};
|
||||||
uint16_t _version;
|
uint16_t _version = 0;
|
||||||
};
|
};
|
@ -19,7 +19,6 @@ enum ComFlag
|
|||||||
|
|
||||||
class GroupObject;
|
class GroupObject;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <functional>
|
#include <functional>
|
||||||
typedef std::function<void(GroupObject&)> GroupObjectUpdatedHandler;
|
typedef std::function<void(GroupObject&)> GroupObjectUpdatedHandler;
|
||||||
@ -33,6 +32,7 @@ typedef void(*GroupObjectUpdatedHandler)(GroupObject& go);
|
|||||||
class GroupObject
|
class GroupObject
|
||||||
{
|
{
|
||||||
friend class GroupObjectTableObject;
|
friend class GroupObjectTableObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* The constructor.
|
||||||
@ -206,10 +206,10 @@ public:
|
|||||||
size_t asapValueSize(uint8_t code);
|
size_t asapValueSize(uint8_t code);
|
||||||
GroupObjectUpdatedHandler _updateHandler;
|
GroupObjectUpdatedHandler _updateHandler;
|
||||||
size_t goSize();
|
size_t goSize();
|
||||||
uint16_t _asap;
|
uint16_t _asap = 0;
|
||||||
ComFlag _commFlag;
|
ComFlag _commFlag = Ok;
|
||||||
uint8_t* _data;
|
uint8_t* _data = 0;
|
||||||
uint8_t _dataLength;
|
uint8_t _dataLength = 0;
|
||||||
GroupObjectTableObject* _table;
|
GroupObjectTableObject* _table = 0;
|
||||||
Dpt _datapointType;
|
Dpt _datapointType;
|
||||||
};
|
};
|
||||||
|
@ -18,10 +18,12 @@ public:
|
|||||||
|
|
||||||
virtual uint8_t* save(uint8_t* buffer);
|
virtual uint8_t* save(uint8_t* buffer);
|
||||||
virtual uint8_t* restore(uint8_t* buffer);
|
virtual uint8_t* restore(uint8_t* buffer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void beforeStateChange(LoadState& newState);
|
virtual void beforeStateChange(LoadState& newState);
|
||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void freeGroupObjects();
|
void freeGroupObjects();
|
||||||
bool initGroupObjects();
|
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);
|
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.
|
* Returns the number of properties the interface object has.
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
class IpDataLinkLayer : public DataLinkLayer
|
class IpDataLinkLayer : public DataLinkLayer
|
||||||
{
|
{
|
||||||
using DataLinkLayer::_deviceObject;
|
using DataLinkLayer::_deviceObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IpDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, IpParameterObject& ipParam, NetworkLayer& layer,
|
IpDataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, IpParameterObject& ipParam, NetworkLayer& layer,
|
||||||
Platform& platform);
|
Platform& platform);
|
||||||
@ -14,6 +15,7 @@ public:
|
|||||||
void loop();
|
void loop();
|
||||||
void enabled(bool value);
|
void enabled(bool value);
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
bool sendFrame(CemiFrame& frame);
|
bool sendFrame(CemiFrame& frame);
|
||||||
|
@ -17,9 +17,11 @@ public:
|
|||||||
|
|
||||||
uint32_t multicastAddress() const;
|
uint32_t multicastAddress() const;
|
||||||
uint8_t ttl() const { return _ttl; }
|
uint8_t ttl() const { return _ttl; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyCount();
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t _projectInstallationId = 0;
|
uint16_t _projectInstallationId = 0;
|
||||||
uint8_t _ipAssignmentMethod = 0;
|
uint8_t _ipAssignmentMethod = 0;
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Platform& _platform;
|
Platform& _platform;
|
||||||
bool _modified = false;
|
bool _modified = false;
|
||||||
SaveRestore* _saveRestores[MAXSAVE];
|
SaveRestore* _saveRestores[MAXSAVE] = {0};
|
||||||
int _saveCount = 0;
|
int _saveCount = 0;
|
||||||
uint8_t* _data = 0;
|
uint8_t* _data = 0;
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);
|
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);
|
||||||
uint8_t _hopCount = 6;
|
uint8_t _hopCount = 6;
|
||||||
DataLinkLayer* _dataLinkLayer;
|
DataLinkLayer* _dataLinkLayer = 0;
|
||||||
TransportLayer& _transportLayer;
|
TransportLayer& _transportLayer;
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,6 @@ class NPDU
|
|||||||
NPDU(uint8_t* data, CemiFrame& frame);
|
NPDU(uint8_t* data, CemiFrame& frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t* _data;
|
uint8_t* _data = 0;
|
||||||
CemiFrame& _frame;
|
CemiFrame& _frame;
|
||||||
};
|
};
|
@ -31,6 +31,6 @@ class TPDU
|
|||||||
TPDU(uint8_t* data, CemiFrame& frame);
|
TPDU(uint8_t* data, CemiFrame& frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t* _data;
|
uint8_t* _data = 0;
|
||||||
CemiFrame& _frame;
|
CemiFrame& _frame;
|
||||||
};
|
};
|
||||||
|
@ -51,15 +51,15 @@ public:
|
|||||||
void cmdlineArgs(int argc, char** argv);
|
void cmdlineArgs(int argc, char** argv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t _multicastAddr;
|
uint32_t _multicastAddr = -1;
|
||||||
uint16_t _port;
|
uint16_t _port = -1;
|
||||||
int _socketFd = -1;
|
int _socketFd = -1;
|
||||||
void doMemoryMapping();
|
void doMemoryMapping();
|
||||||
uint8_t* _mappedFile;
|
uint8_t* _mappedFile = 0;
|
||||||
int _fd = -1;
|
int _fd = -1;
|
||||||
uint8_t* _currentMaxMem = 0;
|
uint8_t* _currentMaxMem = 0;
|
||||||
std::string _flashFilePath = "flash.bin";
|
std::string _flashFilePath = "flash.bin";
|
||||||
char** _args;
|
char** _args = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user