diff --git a/src/knx/bau07B0.cpp b/src/knx/bau07B0.cpp index 06c394a..3d2f2a0 100644 --- a/src/knx/bau07B0.cpp +++ b/src/knx/bau07B0.cpp @@ -28,13 +28,13 @@ Bau07B0::Bau07B0(Platform& platform) // This differs from BAU to BAU with different medium types. // See PID_IO_LIST Property* prop = _deviceObj.property(PID_IO_LIST); - prop->write(1, OT_DEVICE); - prop->write(2, OT_ADDR_TABLE); - prop->write(3, OT_ASSOC_TABLE); - prop->write(4, OT_GRP_OBJ_TABLE); - prop->write(5, OT_APPLICATION_PROG); + prop->write(1, (uint16_t) OT_DEVICE); + prop->write(2, (uint16_t) OT_ADDR_TABLE); + prop->write(3, (uint16_t) OT_ASSOC_TABLE); + prop->write(4, (uint16_t) OT_GRP_OBJ_TABLE); + prop->write(5, (uint16_t) OT_APPLICATION_PROG); #ifdef USE_CEMI_SERVER - prop->write(6, OT_CEMI_SERVER); + prop->write(6, (uint16_t) OT_CEMI_SERVER); #endif } @@ -103,4 +103,4 @@ void Bau07B0::loop() #endif } -#endif \ No newline at end of file +#endif diff --git a/src/knx/bau27B0.cpp b/src/knx/bau27B0.cpp index a938dba..5161336 100644 --- a/src/knx/bau27B0.cpp +++ b/src/knx/bau27B0.cpp @@ -35,14 +35,14 @@ Bau27B0::Bau27B0(Platform& platform) // This differs from BAU to BAU with different medium types. // See PID_IO_LIST Property* prop = _deviceObj.property(PID_IO_LIST); - prop->write(1, OT_DEVICE); - prop->write(2, OT_ADDR_TABLE); - prop->write(3, OT_ASSOC_TABLE); - prop->write(4, OT_GRP_OBJ_TABLE); - prop->write(5, OT_APPLICATION_PROG); - prop->write(6, OT_RF_MEDIUM); + prop->write(1, (uint16_t) OT_DEVICE); + prop->write(2, (uint16_t) OT_ADDR_TABLE); + prop->write(3, (uint16_t) OT_ASSOC_TABLE); + prop->write(4, (uint16_t) OT_GRP_OBJ_TABLE); + prop->write(5, (uint16_t) OT_APPLICATION_PROG); + prop->write(6, (uint16_t) OT_RF_MEDIUM); #ifdef USE_CEMI_SERVER - prop->write(7, OT_CEMI_SERVER); + prop->write(7, (uint16_t) OT_CEMI_SERVER); #endif } diff --git a/src/knx/bau57B0.cpp b/src/knx/bau57B0.cpp index 94145c7..67b9a22 100644 --- a/src/knx/bau57B0.cpp +++ b/src/knx/bau57B0.cpp @@ -32,14 +32,14 @@ Bau57B0::Bau57B0(Platform& platform) // This differs from BAU to BAU with different medium types. // See PID_IO_LIST Property* prop = _deviceObj.property(PID_IO_LIST); - prop->write(1, OT_DEVICE); - prop->write(2, OT_ADDR_TABLE); - prop->write(3, OT_ASSOC_TABLE); - prop->write(4, OT_GRP_OBJ_TABLE); - prop->write(5, OT_APPLICATION_PROG); - prop->write(6, OT_IP_PARAMETER); + prop->write(1, (uint16_t) OT_DEVICE); + prop->write(2, (uint16_t) OT_ADDR_TABLE); + prop->write(3, (uint16_t) OT_ASSOC_TABLE); + prop->write(4, (uint16_t) OT_GRP_OBJ_TABLE); + prop->write(5, (uint16_t) OT_APPLICATION_PROG); + prop->write(6, (uint16_t) OT_IP_PARAMETER); #ifdef USE_CEMI_SERVER - prop->write(7, OT_CEMI_SERVER); + prop->write(7, (uint16_t) OT_CEMI_SERVER); #endif } @@ -96,4 +96,4 @@ DataLinkLayer& Bau57B0::dataLinkLayer() return _dlLayer; } -#endif \ No newline at end of file +#endif diff --git a/src/knx/bau_systemB.cpp b/src/knx/bau_systemB.cpp index 3340fc5..7faf627 100644 --- a/src/knx/bau_systemB.cpp +++ b/src/knx/bau_systemB.cpp @@ -227,7 +227,10 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop if (obj) { uint8_t elementSize = obj->propertySize((PropertyID)propertyId); - size = elementSize * numberOfElements; + if (startIndex > 0) + size = elementSize * numberOfElements; + else + size = sizeof(uint16_t); // size of propert array entry 0 which is the size } else elementCount = 0; diff --git a/src/knx/device_object.cpp b/src/knx/device_object.cpp index 888fabd..464ae4a 100644 --- a/src/knx/device_object.cpp +++ b/src/knx/device_object.cpp @@ -21,7 +21,11 @@ DeviceObject::DeviceObject() [](DeviceObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t { if(start == 0) + { + uint16_t currentNoOfElements = 1; + pushWord(currentNoOfElements, data); return 1; + } pushByteArray(io->propertyData(PID_SERIAL_NUMBER), 2, data); return 1; @@ -34,8 +38,12 @@ DeviceObject::DeviceObject() [](DeviceObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t { if(start == 0) + { + uint16_t currentNoOfElements = 1; + pushWord(currentNoOfElements, data); return 1; - + } + *data = io->_prgMode; return 1; }, @@ -52,7 +60,11 @@ DeviceObject::DeviceObject() [](DeviceObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t { if(start == 0) + { + uint16_t currentNoOfElements = 1; + pushWord(currentNoOfElements, data); return 1; + } *data = ((io->_ownAddress >> 8) & 0xff); @@ -62,12 +74,16 @@ DeviceObject::DeviceObject() [](DeviceObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t { if(start == 0) + { + uint16_t currentNoOfElements = 1; + pushWord(currentNoOfElements, data); return 1; + } *data = (io->_ownAddress & 0xff); return 1; }), - new DataProperty(PID_IO_LIST, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0), + new DataProperty(PID_IO_LIST, false, PDT_UNSIGNED_INT, 8, ReadLv3 | WriteLv0), new DataProperty(PID_HARDWARE_TYPE, true, PDT_GENERIC_06, 1, ReadLv3 | WriteLv3, hardwareType), new DataProperty(PID_DEVICE_DESCRIPTOR, false, PDT_GENERIC_02, 1, ReadLv3 | WriteLv0), #ifdef USE_RF diff --git a/src/knx/property.cpp b/src/knx/property.cpp index a42989f..069e9f6 100644 --- a/src/knx/property.cpp +++ b/src/knx/property.cpp @@ -36,26 +36,25 @@ uint8_t Property::ElementSize() const case PDT_CONTROL: // is actually 10 if written, but this is always handled with a callback case PDT_GENERIC_01: case PDT_UNSIGNED_CHAR: + case PDT_BITSET8: + case PDT_BINARY_INFORMATION: // only 1 bit really + case PDT_ENUM8: + case PDT_SCALING: return 1; case PDT_GENERIC_02: case PDT_INT: case PDT_KNX_FLOAT: case PDT_UNSIGNED_INT: case PDT_VERSION: - return 2; - case PDT_ALARM_INFO: - case PDT_BINARY_INFORMATION: case PDT_BITSET16: - case PDT_BITSET8: + return 2; case PDT_DATE: - case PDT_ENUM8: case PDT_ESCAPE: case PDT_FUNCTION: case PDT_GENERIC_03: case PDT_NE_FL: case PDT_NE_VL: case PDT_POLL_GROUP_SETTING: - case PDT_SCALING: case PDT_TIME: case PDT_UTF8: return 3; @@ -68,6 +67,7 @@ uint8_t Property::ElementSize() const case PDT_SHORT_CHAR_BLOCK: return 5; case PDT_GENERIC_06: + case PDT_ALARM_INFO: return 6; case PDT_GENERIC_07: return 7; @@ -204,6 +204,16 @@ uint8_t Property::write(uint16_t position, uint16_t value) return write(position, 1, data); } +uint8_t Property::write(uint16_t position, uint32_t value) +{ + if (ElementSize() != 4) + return 0; + + uint8_t data[4]; + pushInt(value, data); + return write(position, 1, data); +} + void Property::command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) { (void)data; diff --git a/src/knx/property.h b/src/knx/property.h index 7c3ea93..7ca2a1c 100644 --- a/src/knx/property.h +++ b/src/knx/property.h @@ -247,6 +247,7 @@ class Property : public SaveRestore uint8_t write(uint8_t value); uint8_t write(uint16_t value); uint8_t write(uint16_t position, uint16_t value); + uint8_t write(uint16_t position, uint32_t value); uint8_t write(uint32_t value); uint8_t write(const uint8_t* value); protected: