From 71448efdad15fd50c872c518588e1eda8d6e6691 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Wed, 11 Dec 2019 23:32:57 +0100 Subject: [PATCH] add overrides keyword for all interface objects. refactor properties more --- src/knx/address_table_object.cpp | 6 +++--- src/knx/address_table_object.h | 6 +++--- src/knx/application_program_object.cpp | 6 +++--- src/knx/application_program_object.h | 18 ++++++++-------- src/knx/association_table_object.cpp | 6 +++--- src/knx/association_table_object.h | 12 +++++------ src/knx/callback_property.cpp | 6 ++++++ src/knx/callback_property.h | 2 ++ src/knx/cemi_server_object.cpp | 6 +++--- src/knx/cemi_server_object.h | 11 +++++----- src/knx/device_object.cpp | 6 +++--- src/knx/device_object.h | 18 ++++++++-------- src/knx/group_object_table_object.cpp | 6 +++--- src/knx/group_object_table_object.h | 12 +++++------ src/knx/interface_object.cpp | 29 ++++++++++++++++++++++++-- src/knx/interface_object.h | 17 +++++++++++++-- src/knx/ip_parameter_object.cpp | 14 +++++++++---- src/knx/ip_parameter_object.h | 25 ++++++++++++++-------- src/knx/rf_medium_object.cpp | 6 +++--- src/knx/rf_medium_object.h | 19 ++++++++--------- src/knx/save_restore.h | 17 ++++++++++++--- src/knx/table_object.h | 12 +++++------ 22 files changed, 164 insertions(+), 96 deletions(-) diff --git a/src/knx/address_table_object.cpp b/src/knx/address_table_object.cpp index 409521b..4e2cb3d 100644 --- a/src/knx/address_table_object.cpp +++ b/src/knx/address_table_object.cpp @@ -87,11 +87,11 @@ static PropertyDescription _propertyDescriptions[] = { 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; } diff --git a/src/knx/address_table_object.h b/src/knx/address_table_object.h index d43dc88..138c580 100644 --- a/src/knx/address_table_object.h +++ b/src/knx/address_table_object.h @@ -52,9 +52,9 @@ class AddressTableObject : public TableObject bool contains(uint16_t groupAddress); protected: - virtual void beforeStateChange(LoadState& newState); - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + virtual void beforeStateChange(LoadState& newState) override; + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: uint16_t* _groupAddresses = 0; diff --git a/src/knx/application_program_object.cpp b/src/knx/application_program_object.cpp index 6362754..3b463a8 100644 --- a/src/knx/application_program_object.cpp +++ b/src/knx/application_program_object.cpp @@ -97,11 +97,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_PEI_TYPE, false, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv0 }, { 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; } diff --git a/src/knx/application_program_object.h b/src/knx/application_program_object.h index 97a5aca..444e55d 100644 --- a/src/knx/application_program_object.h +++ b/src/knx/application_program_object.h @@ -6,21 +6,21 @@ class ApplicationProgramObject : public TableObject { public: ApplicationProgramObject(Memory& memory); - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count); - uint8_t propertySize(PropertyID id); - ObjectType objectType() { return OT_APPLICATION_PROG; } + 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; + uint8_t propertySize(PropertyID id) override; + ObjectType objectType() override { return OT_APPLICATION_PROG; } uint8_t* data(uint32_t addr); uint8_t getByte(uint32_t addr); uint16_t getWord(uint32_t addr); uint32_t getInt(uint32_t addr); - uint8_t* save(uint8_t* buffer); - uint8_t* restore(uint8_t* buffer); - uint16_t saveSize(); + uint8_t* save(uint8_t* buffer) override; + uint8_t* restore(uint8_t* buffer) override; + uint16_t saveSize() override; protected: - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: uint8_t _programVersion[5] = {0, 0, 0, 0, 0}; diff --git a/src/knx/association_table_object.cpp b/src/knx/association_table_object.cpp index ceaf9a6..84cd67d 100644 --- a/src/knx/association_table_object.cpp +++ b/src/knx/association_table_object.cpp @@ -81,11 +81,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 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; } diff --git a/src/knx/association_table_object.h b/src/knx/association_table_object.h index d6b6ba8..b13750f 100644 --- a/src/knx/association_table_object.h +++ b/src/knx/association_table_object.h @@ -6,18 +6,18 @@ class AssociationTableObject : public TableObject { public: AssociationTableObject(Memory& memory); - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - ObjectType objectType() { return OT_ASSOC_TABLE; } + void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; + 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 nextAsap(uint16_t tsap, uint16_t& startIdx); protected: - void beforeStateChange(LoadState& newState); - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + void beforeStateChange(LoadState& newState) override; + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: uint16_t entryCount(); diff --git a/src/knx/callback_property.cpp b/src/knx/callback_property.cpp index 12737d8..43587af 100644 --- a/src/knx/callback_property.cpp +++ b/src/knx/callback_property.cpp @@ -6,6 +6,12 @@ CallbackProperty::CallbackProperty(PropertyID id, bool writeEnable, PropertyData : 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) { if (count == 0 || _readCallback == nullptr) diff --git a/src/knx/callback_property.h b/src/knx/callback_property.h index 4119aac..139f894 100644 --- a/src/knx/callback_property.h +++ b/src/knx/callback_property.h @@ -9,6 +9,8 @@ class CallbackProperty : public Property public: CallbackProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, 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 write(uint16_t start, uint8_t count, uint8_t* data) override; private: diff --git a/src/knx/cemi_server_object.cpp b/src/knx/cemi_server_object.cpp index 430b4a0..352b071 100644 --- a/src/knx/cemi_server_object.cpp +++ b/src/knx/cemi_server_object.cpp @@ -100,11 +100,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_MEDIUM_AVAILABILITY, false, PDT_BITSET16, 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() diff --git a/src/knx/cemi_server_object.h b/src/knx/cemi_server_object.h index 77e25f8..d63fa03 100644 --- a/src/knx/cemi_server_object.h +++ b/src/knx/cemi_server_object.h @@ -8,14 +8,13 @@ public: 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; uint8_t propertySize(PropertyID id) override; - uint8_t* save(uint8_t* buffer); - uint8_t* restore(uint8_t* buffer); - void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); - ObjectType objectType() { return OT_CEMI_SERVER; } + uint8_t* save(uint8_t* buffer) override; + uint8_t* restore(uint8_t* buffer) override; + ObjectType objectType() override { return OT_CEMI_SERVER; } protected: - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: // cEMI additional info types supported by this cEMI server: only 0x02 (RF Control Octet and Serial Number or DoA) uint8_t _addInfoTypesTable[1] = { 0x02 }; diff --git a/src/knx/device_object.cpp b/src/knx/device_object.cpp index 6912863..f04d48e 100644 --- a/src/knx/device_object.cpp +++ b/src/knx/device_object.cpp @@ -324,11 +324,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 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; } diff --git a/src/knx/device_object.h b/src/knx/device_object.h index 23d1252..74b09ee 100644 --- a/src/knx/device_object.h +++ b/src/knx/device_object.h @@ -7,14 +7,14 @@ class DeviceObject: public InterfaceObject { public: - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count); - uint8_t propertySize(PropertyID id); - uint8_t* save(uint8_t* buffer); - uint8_t* restore(uint8_t* buffer); - uint16_t saveSize(); + 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; + uint8_t propertySize(PropertyID id) override; + uint8_t* save(uint8_t* buffer) override; + uint8_t* restore(uint8_t* buffer) override; + 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() { return OT_DEVICE; } + ObjectType objectType() override { return OT_DEVICE; } uint16_t induvidualAddress(); void induvidualAddress(uint16_t value); @@ -49,8 +49,8 @@ public: uint8_t* rfDomainAddress(); void rfDomainAddress(uint8_t* value); protected: - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: uint8_t _deviceControl = 0; uint8_t _routingCount = 0; diff --git a/src/knx/group_object_table_object.cpp b/src/knx/group_object_table_object.cpp index 45e367b..e0822f7 100644 --- a/src/knx/group_object_table_object.cpp +++ b/src/knx/group_object_table_object.cpp @@ -133,11 +133,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 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; } diff --git a/src/knx/group_object_table_object.h b/src/knx/group_object_table_object.h index 0127727..6155bd4 100644 --- a/src/knx/group_object_table_object.h +++ b/src/knx/group_object_table_object.h @@ -10,19 +10,19 @@ class GroupObjectTableObject : public TableObject public: GroupObjectTableObject(Memory& memory); virtual ~GroupObjectTableObject(); - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - ObjectType objectType() { return OT_GRP_OBJ_TABLE; } + void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; + ObjectType objectType() override { return OT_GRP_OBJ_TABLE; } uint16_t entryCount(); GroupObject& get(uint16_t asap); GroupObject& nextUpdatedObject(bool& valid); void groupObjects(GroupObject* objs, uint16_t size); - uint8_t* restore(uint8_t* buffer); + uint8_t* restore(uint8_t* buffer) override; protected: - void beforeStateChange(LoadState& newState); - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + void beforeStateChange(LoadState& newState) override; + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: void freeGroupObjects(); diff --git a/src/knx/interface_object.cpp b/src/knx/interface_object.cpp index 007d369..49b1821 100644 --- a/src/knx/interface_object.cpp +++ b/src/knx/interface_object.cpp @@ -1,9 +1,17 @@ +#include + #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) { PropertyDescription* descriptions = propertyDescriptions(); - uint8_t count = propertyCount(); + uint8_t count = propertyDescriptionCount(); numberOfElements = 0; if (descriptions == nullptr || count == 0) @@ -65,7 +73,7 @@ uint8_t InterfaceObject::propertySize(PropertyID id) return 0; } -uint8_t InterfaceObject::propertyCount() +uint8_t InterfaceObject::propertyDescriptionCount() { return 0; } @@ -75,3 +83,20 @@ PropertyDescription* InterfaceObject::propertyDescriptions() 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; +} diff --git a/src/knx/interface_object.h b/src/knx/interface_object.h index 3c3832d..e2eed2e 100644 --- a/src/knx/interface_object.h +++ b/src/knx/interface_object.h @@ -62,7 +62,7 @@ class InterfaceObject : public SaveRestore /** * Destructor */ - virtual ~InterfaceObject() {} + virtual ~InterfaceObject(); /** * 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; + /** + * Gets property with PropertyID id if it exists and nullptr otherwise. + */ + Property* property(PropertyID id); + protected: /** * 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. * This is used by readPropertyDescription() together with propertyCount(). */ 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; }; \ No newline at end of file diff --git a/src/knx/ip_parameter_object.cpp b/src/knx/ip_parameter_object.cpp index b060e64..77069fd 100644 --- a/src/knx/ip_parameter_object.cpp +++ b/src/knx/ip_parameter_object.cpp @@ -8,7 +8,13 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platform): _deviceObject(deviceObject), _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) { @@ -312,11 +318,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 }, { 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; } diff --git a/src/knx/ip_parameter_object.h b/src/knx/ip_parameter_object.h index 835743e..5e76137 100644 --- a/src/knx/ip_parameter_object.h +++ b/src/knx/ip_parameter_object.h @@ -1,6 +1,7 @@ #pragma once #include "interface_object.h" +#include "data_property.h" #include "device_object.h" #include "platform.h" @@ -8,21 +9,24 @@ class IpParameterObject : public InterfaceObject { public: IpParameterObject(DeviceObject& deviceObject, Platform& platform); - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count); - uint8_t propertySize(PropertyID id); - ObjectType objectType() { return OT_IP_PARAMETER; } + 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; + uint8_t propertySize(PropertyID id) override; + ObjectType objectType() override + { + return OT_IP_PARAMETER; + } - uint8_t* save(uint8_t* buffer); - uint8_t* restore(uint8_t* buffer); - uint16_t saveSize(); + uint8_t* save(uint8_t* buffer) override; + uint8_t* restore(uint8_t* buffer) override; + uint16_t saveSize() override; uint32_t multicastAddress() const; uint8_t ttl() const { return _ttl; } protected: - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: uint16_t _projectInstallationId = 0; @@ -46,4 +50,7 @@ class IpParameterObject : public InterfaceObject void loadState(LoadState newState); LoadState _state = LS_UNLOADED; ErrorCode _errorCode = E_NO_FAULT; + + Property** _properties = nullptr; + uint8_t _propertyCount = 0; }; \ No newline at end of file diff --git a/src/knx/rf_medium_object.cpp b/src/knx/rf_medium_object.cpp index c48d00c..231b7e2 100644 --- a/src/knx/rf_medium_object.cpp +++ b/src/knx/rf_medium_object.cpp @@ -124,11 +124,11 @@ static PropertyDescription _propertyDescriptions[] = { PID_RF_RETRANSMITTER, false, PDT_GENERIC_01, 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() diff --git a/src/knx/rf_medium_object.h b/src/knx/rf_medium_object.h index 919e474..86a09cf 100644 --- a/src/knx/rf_medium_object.h +++ b/src/knx/rf_medium_object.h @@ -5,21 +5,20 @@ class RfMediumObject: public InterfaceObject { public: - void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count); - uint8_t propertySize(PropertyID id); - uint8_t* save(uint8_t* buffer); - uint8_t* restore(uint8_t* buffer); - uint16_t saveSize(); - void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); - ObjectType objectType() { return OT_RF_MEDIUM; } + 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; + uint8_t propertySize(PropertyID id) override; + uint8_t* save(uint8_t* buffer) override; + uint8_t* restore(uint8_t* buffer) override; + uint16_t saveSize() override; + ObjectType objectType() override { return OT_RF_MEDIUM; } uint8_t* rfDomainAddress(); void rfDomainAddress(uint8_t* value); protected: - uint8_t propertyCount(); - PropertyDescription* propertyDescriptions(); + uint8_t propertyDescriptionCount() override; + PropertyDescription* propertyDescriptions() override; private: 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,}; diff --git a/src/knx/save_restore.h b/src/knx/save_restore.h index 7bc1c1c..fe39286 100644 --- a/src/knx/save_restore.h +++ b/src/knx/save_restore.h @@ -15,7 +15,11 @@ class SaveRestore * @return The buffer plus the size of the object state. The next object will use this value as * 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. * @@ -24,9 +28,16 @@ class SaveRestore * @return The buffer plus the size of the object state. The next object will use this value as * 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. */ - virtual uint16_t saveSize() = 0; + virtual uint16_t saveSize() + { + return 0; + } }; \ No newline at end of file diff --git a/src/knx/table_object.h b/src/knx/table_object.h index 08415bd..9497751 100644 --- a/src/knx/table_object.h +++ b/src/knx/table_object.h @@ -16,9 +16,9 @@ class TableObject: public InterfaceObject * @param memory The instance of the memory management class to use. */ TableObject(Memory& memory); - virtual void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data); - virtual void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count); - virtual uint8_t propertySize(PropertyID id); + 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) override; + virtual uint8_t propertySize(PropertyID id) override; /** * The destructor. */ @@ -27,9 +27,9 @@ class TableObject: public InterfaceObject * This method returns the ::LoadState of the interface object. */ LoadState loadState(); - virtual uint8_t* save(uint8_t* buffer); - virtual uint8_t* restore(uint8_t* buffer); - uint16_t saveSize(); + virtual uint8_t* save(uint8_t* buffer) override; + virtual uint8_t* restore(uint8_t* buffer) override; + uint16_t saveSize() override; protected: /** * This method is called before the interface object enters a new ::LoadState.