mirror of
https://github.com/thelsing/knx.git
synced 2025-04-19 01:15:27 +02:00
add overrides keyword for all interface objects.
refactor properties more
This commit is contained in:
parent
396994c1a5
commit
71448efdad
@ -87,11 +87,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t AddressTableObject::propertyCount()
|
uint8_t AddressTableObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ class AddressTableObject : public TableObject
|
|||||||
bool contains(uint16_t groupAddress);
|
bool contains(uint16_t groupAddress);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void beforeStateChange(LoadState& newState);
|
virtual void beforeStateChange(LoadState& newState) override;
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t* _groupAddresses = 0;
|
uint16_t* _groupAddresses = 0;
|
||||||
|
@ -97,11 +97,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_PEI_TYPE, false, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv0 },
|
{ PID_PEI_TYPE, false, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_PROG_VERSION, true, PDT_GENERIC_05, 1, ReadLv3 | WriteLv3 },
|
{ PID_PROG_VERSION, true, PDT_GENERIC_05, 1, ReadLv3 | WriteLv3 },
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t ApplicationProgramObject::propertyCount()
|
uint8_t ApplicationProgramObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,21 +6,21 @@ class ApplicationProgramObject : public TableObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ApplicationProgramObject(Memory& memory);
|
ApplicationProgramObject(Memory& memory);
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count);
|
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id) override;
|
||||||
ObjectType objectType() { return OT_APPLICATION_PROG; }
|
ObjectType objectType() override { return OT_APPLICATION_PROG; }
|
||||||
uint8_t* data(uint32_t addr);
|
uint8_t* data(uint32_t addr);
|
||||||
uint8_t getByte(uint32_t addr);
|
uint8_t getByte(uint32_t addr);
|
||||||
uint16_t getWord(uint32_t addr);
|
uint16_t getWord(uint32_t addr);
|
||||||
uint32_t getInt(uint32_t addr);
|
uint32_t getInt(uint32_t addr);
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer) override;
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
uint16_t saveSize();
|
uint16_t saveSize() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _programVersion[5] = {0, 0, 0, 0, 0};
|
uint8_t _programVersion[5] = {0, 0, 0, 0, 0};
|
||||||
|
@ -81,11 +81,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 1, ReadLv3 | WriteLv0 },
|
{ PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t AssociationTableObject::propertyCount()
|
uint8_t AssociationTableObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,18 +6,18 @@ class AssociationTableObject : public TableObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AssociationTableObject(Memory& memory);
|
AssociationTableObject(Memory& memory);
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
ObjectType objectType() { return OT_ASSOC_TABLE; }
|
ObjectType objectType() override { return OT_ASSOC_TABLE; }
|
||||||
|
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
|
|
||||||
int32_t translateAsap(uint16_t asap);
|
int32_t translateAsap(uint16_t asap);
|
||||||
int32_t nextAsap(uint16_t tsap, uint16_t& startIdx);
|
int32_t nextAsap(uint16_t tsap, uint16_t& startIdx);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void beforeStateChange(LoadState& newState);
|
void beforeStateChange(LoadState& newState) override;
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t entryCount();
|
uint16_t entryCount();
|
||||||
|
@ -6,6 +6,12 @@ CallbackProperty::CallbackProperty(PropertyID id, bool writeEnable, PropertyData
|
|||||||
: Property(id, writeEnable, type, maxElements, access), _readCallback(), _writeCallback()
|
: Property(id, writeEnable, type, maxElements, access), _readCallback(), _writeCallback()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
CallbackProperty::CallbackProperty(PropertyID id, bool writeEnable, PropertyDataType type,
|
||||||
|
uint16_t maxElements, uint8_t access,
|
||||||
|
PropertyCallback readCallback)
|
||||||
|
: Property(id, writeEnable, type, maxElements, access), _readCallback()
|
||||||
|
{}
|
||||||
|
|
||||||
uint8_t CallbackProperty::read(uint16_t start, uint8_t count, uint8_t* data)
|
uint8_t CallbackProperty::read(uint16_t start, uint8_t count, uint8_t* data)
|
||||||
{
|
{
|
||||||
if (count == 0 || _readCallback == nullptr)
|
if (count == 0 || _readCallback == nullptr)
|
||||||
|
@ -9,6 +9,8 @@ class CallbackProperty : public Property
|
|||||||
public:
|
public:
|
||||||
CallbackProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements,
|
CallbackProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements,
|
||||||
uint8_t access, PropertyCallback readCallback, PropertyCallback writeCallback);
|
uint8_t access, PropertyCallback readCallback, PropertyCallback writeCallback);
|
||||||
|
CallbackProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements,
|
||||||
|
uint8_t access, PropertyCallback readCallback);
|
||||||
virtual uint8_t read(uint16_t start, uint8_t count, uint8_t* data) override;
|
virtual uint8_t read(uint16_t start, uint8_t count, uint8_t* data) override;
|
||||||
virtual uint8_t write(uint16_t start, uint8_t count, uint8_t* data) override;
|
virtual uint8_t write(uint16_t start, uint8_t count, uint8_t* data) override;
|
||||||
private:
|
private:
|
||||||
|
@ -100,11 +100,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_MEDIUM_AVAILABILITY, false, PDT_BITSET16, 1, ReadLv3 | WriteLv0 },
|
{ PID_MEDIUM_AVAILABILITY, false, PDT_BITSET16, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_ADD_INFO_TYPES, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 }
|
{ PID_ADD_INFO_TYPES, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 }
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t CemiServerObject::propertyCount()
|
uint8_t CemiServerObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyDescription* CemiServerObject::propertyDescriptions()
|
PropertyDescription* CemiServerObject::propertyDescriptions()
|
||||||
|
@ -8,14 +8,13 @@ public:
|
|||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
uint8_t propertySize(PropertyID id) override;
|
uint8_t propertySize(PropertyID id) override;
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer) override;
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
ObjectType objectType() override { return OT_CEMI_SERVER; }
|
||||||
ObjectType objectType() { return OT_CEMI_SERVER; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
private:
|
private:
|
||||||
// cEMI additional info types supported by this cEMI server: only 0x02 (RF Control Octet and Serial Number or DoA)
|
// cEMI additional info types supported by this cEMI server: only 0x02 (RF Control Octet and Serial Number or DoA)
|
||||||
uint8_t _addInfoTypesTable[1] = { 0x02 };
|
uint8_t _addInfoTypesTable[1] = { 0x02 };
|
||||||
|
@ -324,11 +324,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 },
|
{ PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_SERIAL_NUMBER, false, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 }
|
{ PID_SERIAL_NUMBER, false, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 }
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t DeviceObject::propertyCount()
|
uint8_t DeviceObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
class DeviceObject: public InterfaceObject
|
class DeviceObject: public InterfaceObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count);
|
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id) override;
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer) override;
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
uint16_t saveSize();
|
uint16_t saveSize() override;
|
||||||
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);
|
||||||
ObjectType objectType() { return OT_DEVICE; }
|
ObjectType objectType() override { return OT_DEVICE; }
|
||||||
|
|
||||||
uint16_t induvidualAddress();
|
uint16_t induvidualAddress();
|
||||||
void induvidualAddress(uint16_t value);
|
void induvidualAddress(uint16_t value);
|
||||||
@ -49,8 +49,8 @@ public:
|
|||||||
uint8_t* rfDomainAddress();
|
uint8_t* rfDomainAddress();
|
||||||
void rfDomainAddress(uint8_t* value);
|
void rfDomainAddress(uint8_t* value);
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
private:
|
private:
|
||||||
uint8_t _deviceControl = 0;
|
uint8_t _deviceControl = 0;
|
||||||
uint8_t _routingCount = 0;
|
uint8_t _routingCount = 0;
|
||||||
|
@ -133,11 +133,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 1, ReadLv3 | WriteLv0 },
|
{ PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
{ PID_ERROR_CODE, false, PDT_ENUM8, 1, ReadLv3 | WriteLv0 },
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t GroupObjectTableObject::propertyCount()
|
uint8_t GroupObjectTableObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,19 +10,19 @@ class GroupObjectTableObject : public TableObject
|
|||||||
public:
|
public:
|
||||||
GroupObjectTableObject(Memory& memory);
|
GroupObjectTableObject(Memory& memory);
|
||||||
virtual ~GroupObjectTableObject();
|
virtual ~GroupObjectTableObject();
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
ObjectType objectType() { return OT_GRP_OBJ_TABLE; }
|
ObjectType objectType() override { return OT_GRP_OBJ_TABLE; }
|
||||||
uint16_t entryCount();
|
uint16_t entryCount();
|
||||||
GroupObject& get(uint16_t asap);
|
GroupObject& get(uint16_t asap);
|
||||||
GroupObject& nextUpdatedObject(bool& valid);
|
GroupObject& nextUpdatedObject(bool& valid);
|
||||||
void groupObjects(GroupObject* objs, uint16_t size);
|
void groupObjects(GroupObject* objs, uint16_t size);
|
||||||
|
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void beforeStateChange(LoadState& newState);
|
void beforeStateChange(LoadState& newState) override;
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void freeGroupObjects();
|
void freeGroupObjects();
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "interface_object.h"
|
#include "interface_object.h"
|
||||||
|
|
||||||
|
InterfaceObject::~InterfaceObject()
|
||||||
|
{
|
||||||
|
if (_properties != nullptr)
|
||||||
|
delete[] _properties;
|
||||||
|
}
|
||||||
|
|
||||||
void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access)
|
void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access)
|
||||||
{
|
{
|
||||||
PropertyDescription* descriptions = propertyDescriptions();
|
PropertyDescription* descriptions = propertyDescriptions();
|
||||||
uint8_t count = propertyCount();
|
uint8_t count = propertyDescriptionCount();
|
||||||
|
|
||||||
numberOfElements = 0;
|
numberOfElements = 0;
|
||||||
if (descriptions == nullptr || count == 0)
|
if (descriptions == nullptr || count == 0)
|
||||||
@ -65,7 +73,7 @@ uint8_t InterfaceObject::propertySize(PropertyID id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t InterfaceObject::propertyCount()
|
uint8_t InterfaceObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -75,3 +83,20 @@ PropertyDescription* InterfaceObject::propertyDescriptions()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InterfaceObject::initializeProperties(size_t propertiesSize, Property** properties)
|
||||||
|
{
|
||||||
|
_propertyCount = propertiesSize / sizeof(Property*);
|
||||||
|
_properties = new Property*[_propertyCount];
|
||||||
|
memcpy(_properties, properties, propertiesSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Property* InterfaceObject::property(PropertyID id)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _propertyCount; i++)
|
||||||
|
if (_properties[i]->Id() == id)
|
||||||
|
return _properties[i];
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@ -62,7 +62,7 @@ class InterfaceObject : public SaveRestore
|
|||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~InterfaceObject() {}
|
virtual ~InterfaceObject();
|
||||||
/**
|
/**
|
||||||
* Read a property of the interface object. See section 4.8.4.2 of @cite knx:3/4/1.
|
* Read a property of the interface object. See section 4.8.4.2 of @cite knx:3/4/1.
|
||||||
*
|
*
|
||||||
@ -126,14 +126,27 @@ class InterfaceObject : public SaveRestore
|
|||||||
*/
|
*/
|
||||||
virtual ObjectType objectType() = 0;
|
virtual ObjectType objectType() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets property with PropertyID id if it exists and nullptr otherwise.
|
||||||
|
*/
|
||||||
|
Property* property(PropertyID id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Returns the number of properties the interface object has.
|
* Returns the number of properties the interface object has.
|
||||||
*/
|
*/
|
||||||
virtual uint8_t propertyCount();
|
virtual uint8_t propertyDescriptionCount();
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to the first PropertyDescription of the interface object.
|
* Returns a pointer to the first PropertyDescription of the interface object.
|
||||||
* This is used by readPropertyDescription() together with propertyCount().
|
* This is used by readPropertyDescription() together with propertyCount().
|
||||||
*/
|
*/
|
||||||
virtual PropertyDescription* propertyDescriptions();
|
virtual PropertyDescription* propertyDescriptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intializes the Property-array the the supplied values.
|
||||||
|
*/
|
||||||
|
void initializeProperties(size_t propertiesSize, Property** properties);
|
||||||
|
|
||||||
|
Property** _properties = nullptr;
|
||||||
|
uint8_t _propertyCount = 0;
|
||||||
};
|
};
|
@ -8,7 +8,13 @@
|
|||||||
|
|
||||||
IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platform): _deviceObject(deviceObject),
|
IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platform): _deviceObject(deviceObject),
|
||||||
_platform(platform)
|
_platform(platform)
|
||||||
{}
|
{
|
||||||
|
Property* properties[] =
|
||||||
|
{
|
||||||
|
new DataProperty(PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0)
|
||||||
|
};
|
||||||
|
initializeProperties(sizeof(properties), properties);
|
||||||
|
}
|
||||||
|
|
||||||
void IpParameterObject::readProperty(PropertyID propertyId, uint16_t start, uint8_t& count, uint8_t* data)
|
void IpParameterObject::readProperty(PropertyID propertyId, uint16_t start, uint8_t& count, uint8_t* data)
|
||||||
{
|
{
|
||||||
@ -312,11 +318,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 },
|
{ PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_PROJECT_INSTALLATION_ID, true, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv3 },
|
{ PID_PROJECT_INSTALLATION_ID, true, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv3 },
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t IpParameterObject::propertyCount()
|
uint8_t IpParameterObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "interface_object.h"
|
#include "interface_object.h"
|
||||||
|
#include "data_property.h"
|
||||||
#include "device_object.h"
|
#include "device_object.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
@ -8,21 +9,24 @@ class IpParameterObject : public InterfaceObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IpParameterObject(DeviceObject& deviceObject, Platform& platform);
|
IpParameterObject(DeviceObject& deviceObject, Platform& platform);
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count);
|
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id) override;
|
||||||
ObjectType objectType() { return OT_IP_PARAMETER; }
|
ObjectType objectType() override
|
||||||
|
{
|
||||||
|
return OT_IP_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer) override;
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
uint16_t saveSize();
|
uint16_t saveSize() override;
|
||||||
|
|
||||||
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 propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t _projectInstallationId = 0;
|
uint16_t _projectInstallationId = 0;
|
||||||
@ -46,4 +50,7 @@ class IpParameterObject : public InterfaceObject
|
|||||||
void loadState(LoadState newState);
|
void loadState(LoadState newState);
|
||||||
LoadState _state = LS_UNLOADED;
|
LoadState _state = LS_UNLOADED;
|
||||||
ErrorCode _errorCode = E_NO_FAULT;
|
ErrorCode _errorCode = E_NO_FAULT;
|
||||||
|
|
||||||
|
Property** _properties = nullptr;
|
||||||
|
uint8_t _propertyCount = 0;
|
||||||
};
|
};
|
@ -124,11 +124,11 @@ static PropertyDescription _propertyDescriptions[] =
|
|||||||
{ PID_RF_RETRANSMITTER, false, PDT_GENERIC_01, 1, ReadLv3 | WriteLv0 },
|
{ PID_RF_RETRANSMITTER, false, PDT_GENERIC_01, 1, ReadLv3 | WriteLv0 },
|
||||||
{ PID_RF_DOMAIN_ADDRESS, true, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 }
|
{ PID_RF_DOMAIN_ADDRESS, true, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 }
|
||||||
};
|
};
|
||||||
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
static uint8_t _propertyDescriptionCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
uint8_t RfMediumObject::propertyCount()
|
uint8_t RfMediumObject::propertyDescriptionCount()
|
||||||
{
|
{
|
||||||
return _propertyCount;
|
return _propertyDescriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyDescription* RfMediumObject::propertyDescriptions()
|
PropertyDescription* RfMediumObject::propertyDescriptions()
|
||||||
|
@ -5,21 +5,20 @@
|
|||||||
class RfMediumObject: public InterfaceObject
|
class RfMediumObject: public InterfaceObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count);
|
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id) override;
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer) override;
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer) override;
|
||||||
uint16_t saveSize();
|
uint16_t saveSize() override;
|
||||||
void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
ObjectType objectType() override { return OT_RF_MEDIUM; }
|
||||||
ObjectType objectType() { return OT_RF_MEDIUM; }
|
|
||||||
|
|
||||||
uint8_t* rfDomainAddress();
|
uint8_t* rfDomainAddress();
|
||||||
void rfDomainAddress(uint8_t* value);
|
void rfDomainAddress(uint8_t* value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t propertyCount();
|
uint8_t propertyDescriptionCount() override;
|
||||||
PropertyDescription* propertyDescriptions();
|
PropertyDescription* propertyDescriptions() override;
|
||||||
private:
|
private:
|
||||||
uint8_t _rfDomainAddress[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // see KNX RF S-Mode AN160 p.11
|
uint8_t _rfDomainAddress[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // see KNX RF S-Mode AN160 p.11
|
||||||
uint8_t _rfDiagSourceAddressFilterTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
|
uint8_t _rfDiagSourceAddressFilterTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
|
||||||
|
@ -15,7 +15,11 @@ class SaveRestore
|
|||||||
* @return The buffer plus the size of the object state. The next object will use this value as
|
* @return The buffer plus the size of the object state. The next object will use this value as
|
||||||
* the start of its buffer.
|
* the start of its buffer.
|
||||||
*/
|
*/
|
||||||
virtual uint8_t* save(uint8_t* buffer) = 0;
|
virtual uint8_t* save(uint8_t* buffer)
|
||||||
|
{
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called when the object should restore its state from the buffer.
|
* This method is called when the object should restore its state from the buffer.
|
||||||
*
|
*
|
||||||
@ -24,9 +28,16 @@ class SaveRestore
|
|||||||
* @return The buffer plus the size of the object state. The next object will use this value as
|
* @return The buffer plus the size of the object state. The next object will use this value as
|
||||||
* the start of its buffer.
|
* the start of its buffer.
|
||||||
*/
|
*/
|
||||||
virtual uint8_t* restore(uint8_t* buffer) = 0;
|
virtual uint8_t* restore(uint8_t* buffer)
|
||||||
|
{
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The number of byte the object needs to save its state.
|
* @return The number of byte the object needs to save its state.
|
||||||
*/
|
*/
|
||||||
virtual uint16_t saveSize() = 0;
|
virtual uint16_t saveSize()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
};
|
};
|
@ -16,9 +16,9 @@ class TableObject: public InterfaceObject
|
|||||||
* @param memory The instance of the memory management class to use.
|
* @param memory The instance of the memory management class to use.
|
||||||
*/
|
*/
|
||||||
TableObject(Memory& memory);
|
TableObject(Memory& memory);
|
||||||
virtual void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data);
|
virtual void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
|
||||||
virtual void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count);
|
virtual void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
|
||||||
virtual uint8_t propertySize(PropertyID id);
|
virtual uint8_t propertySize(PropertyID id) override;
|
||||||
/**
|
/**
|
||||||
* The destructor.
|
* The destructor.
|
||||||
*/
|
*/
|
||||||
@ -27,9 +27,9 @@ class TableObject: public InterfaceObject
|
|||||||
* This method returns the ::LoadState of the interface object.
|
* This method returns the ::LoadState of the interface object.
|
||||||
*/
|
*/
|
||||||
LoadState loadState();
|
LoadState loadState();
|
||||||
virtual uint8_t* save(uint8_t* buffer);
|
virtual uint8_t* save(uint8_t* buffer) override;
|
||||||
virtual uint8_t* restore(uint8_t* buffer);
|
virtual uint8_t* restore(uint8_t* buffer) override;
|
||||||
uint16_t saveSize();
|
uint16_t saveSize() override;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* This method is called before the interface object enters a new ::LoadState.
|
* This method is called before the interface object enters a new ::LoadState.
|
||||||
|
Loading…
Reference in New Issue
Block a user