Merge branch 'master' into feat_datasecure (fix conflicts)

This commit is contained in:
Nanosonde 2020-07-06 14:11:51 +02:00
commit 5efc450bc7
4 changed files with 52 additions and 9 deletions

View File

@ -13,8 +13,12 @@ ApplicationProgramObject::ApplicationProgramObject(Memory& memory)
new DataProperty(PID_PROG_VERSION, true, PDT_GENERIC_05, 1, ReadLv3 | WriteLv3),
new CallbackProperty<ApplicationProgramObject>(this, PID_PEI_TYPE, false, PDT_UNSIGNED_CHAR, 1, ReadLv3 | WriteLv0,
[](ApplicationProgramObject* io, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t {
if (start == 0)
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
data[0] = 0;
return 1;
@ -42,4 +46,4 @@ uint16_t ApplicationProgramObject::getWord(uint32_t addr)
uint32_t ApplicationProgramObject::getInt(uint32_t addr)
{
return ::getInt(TableObject::data() + addr);
}
}

View File

@ -361,7 +361,7 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop
if (startIndex > 0)
size = elementSize * numberOfElements;
else
size = sizeof(uint16_t); // size of propert array entry 0 which is the size
size = sizeof(uint16_t); // size of property array entry 0 which contains the current number of elements
}
else
elementCount = 0;
@ -769,7 +769,10 @@ void BauSystemB::propertyValueRead(ObjectType objectType, uint8_t objectInstance
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 property array entry 0 which contains the current number of elements
*data = new uint8_t [size];
obj->readProperty((PropertyID)propertyId, startIndex, elementCount, *data);
}

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

View File

@ -238,8 +238,12 @@ void TableObject::initializeProperties(size_t propertiesSize, Property** propert
{
new CallbackProperty<TableObject>(this, PID_LOAD_STATE_CONTROL, true, PDT_CONTROL, 1, ReadLv3 | WriteLv3,
[](TableObject* obj, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t {
if (start == 0)
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
data[0] = obj->_state;
return 1;
@ -250,8 +254,12 @@ void TableObject::initializeProperties(size_t propertiesSize, Property** propert
}),
new CallbackProperty<TableObject>(this, PID_TABLE_REFERENCE, false, PDT_UNSIGNED_LONG, 1, ReadLv3 | WriteLv0,
[](TableObject* obj, uint16_t start, uint8_t count, uint8_t* data) -> uint8_t {
if (start == 0)
if(start == 0)
{
uint16_t currentNoOfElements = 1;
pushWord(currentNoOfElements, data);
return 1;
}
if (obj->_state == LS_UNLOADED)
pushInt(0, data);