2018-04-13 22:08:10 +02:00
|
|
|
#include "interface_object.h"
|
|
|
|
|
2018-04-24 11:45:57 +02:00
|
|
|
void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access)
|
2018-04-13 22:08:10 +02:00
|
|
|
{
|
|
|
|
PropertyDescription* descriptions = propertyDescriptions();
|
|
|
|
uint8_t count = propertyCount();
|
2018-04-25 23:20:00 +02:00
|
|
|
|
2018-04-13 22:08:10 +02:00
|
|
|
PropertyDescription* desc = nullptr;
|
2018-04-25 23:20:00 +02:00
|
|
|
|
|
|
|
// from KNX spec. 03.03.07 Application Layer (page 56) - 3.4.3.3 A_PropertyDescription_Read-service
|
|
|
|
// Summary: either propertyId OR propertyIndex, but not both at the same time
|
2018-04-13 22:08:10 +02:00
|
|
|
if (propertyId != 0)
|
2018-04-25 23:20:00 +02:00
|
|
|
{
|
|
|
|
for (uint8_t i = 0; i < count; i++)
|
2018-04-13 22:08:10 +02:00
|
|
|
{
|
2018-04-24 16:32:57 +02:00
|
|
|
PropertyDescription d = descriptions[i];
|
2018-04-13 22:08:10 +02:00
|
|
|
if (d.Id != propertyId)
|
|
|
|
continue;
|
2018-04-25 23:20:00 +02:00
|
|
|
|
2018-04-13 22:08:10 +02:00
|
|
|
desc = &d;
|
|
|
|
propertyIndex = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-25 23:20:00 +02:00
|
|
|
// If propertyId is zero, propertyIndex shall be used.
|
|
|
|
// Response: propertyIndex of received A_PropertyDescription_Read
|
2018-04-25 23:23:42 +02:00
|
|
|
if (propertyIndex < count)
|
2018-04-13 22:08:10 +02:00
|
|
|
{
|
|
|
|
desc = &descriptions[propertyIndex];
|
|
|
|
}
|
|
|
|
}
|
2018-04-25 23:20:00 +02:00
|
|
|
|
|
|
|
if (desc != nullptr)
|
|
|
|
{
|
|
|
|
propertyId = desc->Id;
|
|
|
|
writeEnable = desc->WriteEnable;
|
|
|
|
type = desc->Type;
|
|
|
|
numberOfElements = desc->MaxElements;
|
|
|
|
access = desc->Access;
|
|
|
|
}
|
2018-04-13 22:08:10 +02:00
|
|
|
}
|