Bugfixes for property startIndex 0 and PID_IO_LIST (#75)

* Bugfix for property entry 0 and PID_IO_LIST

* Remove unsused method

* Fix comment and add missing size adjustment in other method

* Callback properties must return valid data on startIndex 0. The return value must contain the actual element count within the property.
This commit is contained in:
nanosonde
2020-07-05 12:11:44 +02:00
committed by GitHub
parent 6cd030203a
commit 8cfd67662f
9 changed files with 101 additions and 39 deletions

View File

@@ -20,7 +20,11 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
// TODO: get property of deviceobject and use it
pushWord(io->_deviceObject.induvidualAddress(), data);
return 1;
@@ -36,8 +40,12 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
pushInt(io->_platform.currentIpAddress(), data);
return 1;
}),
@@ -45,8 +53,12 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
pushInt(io->_platform.currentSubnetMask(), data);
return 1;
}),
@@ -54,7 +66,11 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
pushInt(io->_platform.currentDefaultGateway(), data);
return 1;
@@ -66,7 +82,11 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
io->_platform.macAddress(data);
return 1;
@@ -75,7 +95,11 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
pushInt(DEFAULT_MULTICAST_ADDR, data);
return 1;
@@ -86,7 +110,11 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
[](IpParameterObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t
{
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
pushWord(0x1, data);
return 1;
@@ -96,4 +124,4 @@ IpParameterObject::IpParameterObject(DeviceObject& deviceObject, Platform& platf
initializeProperties(sizeof(properties), properties);
}
#endif
#endif