Bugfix for property entry 0 and PID_IO_LIST

This commit is contained in:
Nanosonde 2020-07-03 12:43:28 +02:00
parent 6cd030203a
commit dbec6bf369
7 changed files with 61 additions and 31 deletions

View File

@ -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
#endif

View File

@ -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
}

View File

@ -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
#endif

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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: