diff --git a/src/knx/bau07B0.cpp b/src/knx/bau07B0.cpp index 87db8ce..6d5b464 100644 --- a/src/knx/bau07B0.cpp +++ b/src/knx/bau07B0.cpp @@ -15,6 +15,11 @@ Bau07B0::Bau07B0(Platform& platform) uint16_t maskVersion; popWord(maskVersion, _descriptor); _deviceObj.maskVersion(maskVersion); + + // Set which interface objects are available in the device object + // This differs from BAU to BAU with different medium types. + // See PID_IO_LIST + _deviceObj.ifObj(_ifObjs); } InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx) diff --git a/src/knx/bau07B0.h b/src/knx/bau07B0.h index 84d8aba..5fe3f67 100644 --- a/src/knx/bau07B0.h +++ b/src/knx/bau07B0.h @@ -16,4 +16,6 @@ class Bau07B0 : public BauSystemB private: TpUartDataLinkLayer _dlLayer; uint8_t _descriptor[2] = {0x07, 0xb0}; + const uint32_t _ifObjs[6] = { 5, // length + OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG}; }; \ No newline at end of file diff --git a/src/knx/bau27B0.cpp b/src/knx/bau27B0.cpp index 2b5365d..f704eb5 100644 --- a/src/knx/bau27B0.cpp +++ b/src/knx/bau27B0.cpp @@ -16,6 +16,18 @@ Bau27B0::Bau27B0(Platform& platform) uint16_t maskVersion; popWord(maskVersion, _descriptor); _deviceObj.maskVersion(maskVersion); + + // Set the maximum APDU length + // ETS will consider this value while programming the device + // For KNX-RF we use a smallest allowed value for now, + // although long frame are also supported by the implementation. + // Needs some experimentation. + _deviceObj.maxApduLength(15); + + // Set which interface objects are available in the device object + // This differs from BAU to BAU with different medium types. + // See PID_IO_LIST + _deviceObj.ifObj(_ifObjs); } // see KNX AN160 p.74 for mask 27B0 diff --git a/src/knx/bau27B0.h b/src/knx/bau27B0.h index f1b30e6..b2c129e 100644 --- a/src/knx/bau27B0.h +++ b/src/knx/bau27B0.h @@ -20,6 +20,8 @@ class Bau27B0 : public BauSystemB RfMediumObject _rfMediumObj; uint8_t _descriptor[2] = {0x27, 0xB0}; + const uint32_t _ifObjs[7] = { 6, // length + OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_RF_MEDIUM}; void domainAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, uint8_t* rfDoA, uint8_t* knxSerialNumber); diff --git a/src/knx/bau57B0.cpp b/src/knx/bau57B0.cpp index 74373c9..648d777 100644 --- a/src/knx/bau57B0.cpp +++ b/src/knx/bau57B0.cpp @@ -17,6 +17,11 @@ Bau57B0::Bau57B0(Platform& platform) uint16_t maskVersion; popWord(maskVersion, _descriptor); _deviceObj.maskVersion(maskVersion); + + // Set which interface objects are available in the device object + // This differs from BAU to BAU with different medium types. + // See PID_IO_LIST + _deviceObj.ifObj(_ifObjs); } InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx) diff --git a/src/knx/bau57B0.h b/src/knx/bau57B0.h index 297f4aa..8835150 100644 --- a/src/knx/bau57B0.h +++ b/src/knx/bau57B0.h @@ -18,4 +18,6 @@ class Bau57B0 : public BauSystemB IpParameterObject _ipParameters; IpDataLinkLayer _dlLayer; uint8_t _descriptor[2] = {0x57, 0xb0}; + const uint32_t _ifObjs[7] = { 6, // length + OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER}; }; \ No newline at end of file diff --git a/src/knx/device_object.cpp b/src/knx/device_object.cpp index f7a5f85..e9d0905 100644 --- a/src/knx/device_object.cpp +++ b/src/knx/device_object.cpp @@ -35,7 +35,7 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t& *data = _prgMode; break; case PID_MAX_APDU_LENGTH: - pushWord(254, data); + pushWord(_maxApduLength, data); break; case PID_SUBNET_ADDR: *data = ((_ownAddress >> 8) & 0xff); @@ -45,13 +45,8 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t& break; case PID_IO_LIST: { - uint32_t ifObjs[] = { - 6, // length - OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER}; - - for (uint32_t i = start; i < (ifObjs[0] + 1) && i < count; i++) - pushInt(ifObjs[i], data); - + for (uint32_t i = start; i < (_ifObjs[0] + 1) && i < count; i++) + pushInt(_ifObjs[i], data); break; } case PID_DEVICE_DESCRIPTOR: @@ -263,6 +258,26 @@ void DeviceObject::maskVersion(uint16_t value) _maskVersion = value; } +void DeviceObject::maxApduLength(uint16_t value) +{ + _maxApduLength = value; +} + +uint16_t DeviceObject::maxApduLength() +{ + return _maxApduLength; +} + +const uint32_t* DeviceObject::ifObj() +{ + return _ifObjs; +} + +void DeviceObject::ifObj(const uint32_t* value) +{ + _ifObjs = value; +} + static PropertyDescription _propertyDescriptions[] = { { PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 }, diff --git a/src/knx/device_object.h b/src/knx/device_object.h index de86bb5..2f01665 100644 --- a/src/knx/device_object.h +++ b/src/knx/device_object.h @@ -37,6 +37,10 @@ public: void version(uint16_t value); uint16_t maskVersion(); void maskVersion(uint16_t value); + uint16_t maxApduLength(); + void maxApduLength(uint16_t value); + const uint32_t* ifObj(); + void ifObj(const uint32_t* value); protected: uint8_t propertyCount(); PropertyDescription* propertyDescriptions(); @@ -51,4 +55,6 @@ private: uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0}; uint16_t _version = 0; uint16_t _maskVersion = 0x0000; + uint16_t _maxApduLength = 254; + const uint32_t* _ifObjs; }; \ No newline at end of file