knx/interface_object.cpp
Thomas Kunze 39edb63caf add support for propertyDescriptionRead
(descriptions are still missing)
2018-04-13 22:08:10 +02:00

38 lines
1015 B
C++

#include "interface_object.h"
void InterfaceObject::readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access)
{
PropertyDescription* descriptions = propertyDescriptions();
uint8_t count = propertyCount();
PropertyDescription* desc = nullptr;
if (propertyId != 0)
{
for (uint8_t i = 0; i < count; i++)
{
PropertyDescription d = descriptions[propertyIndex];
if (d.Id != propertyId)
continue;
desc = &d;
propertyIndex = i;
break;
}
}
else
{
if (propertyIndex > 0 && propertyIndex < count)
{
desc = &descriptions[propertyIndex];
}
}
if (desc != nullptr)
{
writeEnable = desc->WriteEnable;
type = desc->Type;
numberOfElements = desc->MaxElements;
access = desc->Access;
}
}