mirror of
https://github.com/thelsing/knx.git
synced 2025-02-04 00:16:20 +01:00
add support for propertyDescriptionRead
(descriptions are still missing)
This commit is contained in:
parent
7eb629a4e6
commit
39edb63caf
@ -83,3 +83,17 @@ void AddressTableObject::beforeStateChange(LoadState& newState)
|
|||||||
|
|
||||||
_groupAddresses = (uint16_t*)_data;
|
_groupAddresses = (uint16_t*)_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = { };
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t AddressTableObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* AddressTableObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
@ -6,7 +6,10 @@ class AddressTableObject: public TableObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AddressTableObject(uint8_t* memoryReference);
|
AddressTableObject(uint8_t* memoryReference);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||||
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
uint16_t entryCount();
|
uint16_t entryCount();
|
||||||
uint16_t getGa(uint16_t tsap);
|
uint16_t getGa(uint16_t tsap);
|
||||||
uint16_t getTsap(uint16_t ga);
|
uint16_t getTsap(uint16_t ga);
|
||||||
@ -15,6 +18,8 @@ public:
|
|||||||
bool contains(uint16_t addr);
|
bool contains(uint16_t addr);
|
||||||
protected:
|
protected:
|
||||||
virtual void beforeStateChange(LoadState& newState);
|
virtual void beforeStateChange(LoadState& newState);
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint16_t* _groupAddresses;
|
uint16_t* _groupAddresses;
|
||||||
};
|
};
|
@ -85,3 +85,18 @@ uint8_t* ApplicationProgramObject::restore(uint8_t* buffer)
|
|||||||
|
|
||||||
return TableObject::restore(buffer);
|
return TableObject::restore(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = {};
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t ApplicationProgramObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* ApplicationProgramObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,10 @@ class ApplicationProgramObject: public TableObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ApplicationProgramObject(uint8_t* memoryReference);
|
ApplicationProgramObject(uint8_t* memoryReference);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||||
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count);
|
void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count);
|
||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id);
|
||||||
uint8_t* data(uint32_t addr);
|
uint8_t* data(uint32_t addr);
|
||||||
@ -15,6 +18,9 @@ public:
|
|||||||
uint32_t getInt(uint32_t addr);
|
uint32_t getInt(uint32_t addr);
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer);
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer);
|
||||||
|
protected:
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint8_t _programVersion[5];
|
uint8_t _programVersion[5];
|
||||||
};
|
};
|
@ -67,3 +67,17 @@ void AssociationTableObject::beforeStateChange(LoadState& newState)
|
|||||||
|
|
||||||
_tableData = (uint16_t*)_data;
|
_tableData = (uint16_t*)_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = { };
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t AssociationTableObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* AssociationTableObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
@ -6,7 +6,10 @@ class AssociationTableObject: public TableObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AssociationTableObject(uint8_t* memoryReference);
|
AssociationTableObject(uint8_t* memoryReference);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||||
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
uint16_t entryCount();
|
uint16_t entryCount();
|
||||||
uint16_t operator[](uint16_t idx);
|
uint16_t operator[](uint16_t idx);
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer);
|
||||||
@ -15,6 +18,8 @@ public:
|
|||||||
int32_t translateAsap(uint16_t asap);
|
int32_t translateAsap(uint16_t asap);
|
||||||
protected:
|
protected:
|
||||||
void beforeStateChange(LoadState& newState);
|
void beforeStateChange(LoadState& newState);
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint16_t* _tableData;
|
uint16_t* _tableData;
|
||||||
};
|
};
|
11
bau57B0.cpp
11
bau57B0.cpp
@ -181,9 +181,16 @@ void Bau57B0::userMemoryWriteIndication(Priority priority, HopCountType hopType,
|
|||||||
void Bau57B0::propertyDescriptionReadIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
void Bau57B0::propertyDescriptionReadIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
||||||
uint8_t propertyId, uint8_t propertyIndex)
|
uint8_t propertyId, uint8_t propertyIndex)
|
||||||
{
|
{
|
||||||
// TODO: reply correctly
|
bool writeEnable = false;
|
||||||
|
uint8_t type = 0;
|
||||||
|
uint16_t numberOfElements = 0;
|
||||||
|
uint8_t access = 0;
|
||||||
|
InterfaceObject* obj = getInterfaceObject(objectIndex);
|
||||||
|
if (obj)
|
||||||
|
obj->readPropertyDescription(propertyId, propertyIndex, writeEnable, type, numberOfElements, access);
|
||||||
|
|
||||||
_appLayer.propertyDescriptionReadResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, propertyIndex,
|
_appLayer.propertyDescriptionReadResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, propertyIndex,
|
||||||
false, 0, 0, 0);
|
writeEnable, type, numberOfElements, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bau57B0::propertyValueWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
void Bau57B0::propertyValueWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
||||||
|
@ -253,3 +253,17 @@ void DeviceObject::version(uint16_t value)
|
|||||||
{
|
{
|
||||||
_version = value;
|
_version = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = {};
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t DeviceObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* DeviceObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
||||||
|
@ -10,6 +10,8 @@ public:
|
|||||||
uint8_t propertySize(PropertyID id);
|
uint8_t propertySize(PropertyID id);
|
||||||
uint8_t* save(uint8_t* buffer);
|
uint8_t* save(uint8_t* buffer);
|
||||||
uint8_t* restore(uint8_t* buffer);
|
uint8_t* restore(uint8_t* buffer);
|
||||||
|
void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
||||||
|
|
||||||
|
|
||||||
uint16_t induvidualAddress();
|
uint16_t induvidualAddress();
|
||||||
void induvidualAddress(uint16_t value);
|
void induvidualAddress(uint16_t value);
|
||||||
@ -33,6 +35,9 @@ public:
|
|||||||
void hardwareType(const uint8_t* value);
|
void hardwareType(const uint8_t* value);
|
||||||
uint16_t version();
|
uint16_t version();
|
||||||
void version(uint16_t value);
|
void version(uint16_t value);
|
||||||
|
protected:
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint8_t _deviceControl;
|
uint8_t _deviceControl;
|
||||||
uint8_t _routingCount;
|
uint8_t _routingCount;
|
||||||
|
@ -119,3 +119,17 @@ bool GroupObjectTableObject::initGroupObjects()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = { };
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t GroupObjectTableObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* GroupObjectTableObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
@ -9,7 +9,10 @@ class GroupObjectTableObject: public TableObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GroupObjectTableObject(uint8_t* memoryReference);
|
GroupObjectTableObject(uint8_t* memoryReference);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||||
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
uint16_t entryCount();
|
uint16_t entryCount();
|
||||||
GroupObject& get(uint16_t asap);
|
GroupObject& get(uint16_t asap);
|
||||||
GroupObject& nextUpdatedObject(bool& valid);
|
GroupObject& nextUpdatedObject(bool& valid);
|
||||||
@ -19,6 +22,8 @@ public:
|
|||||||
virtual uint8_t* restore(uint8_t* buffer);
|
virtual uint8_t* restore(uint8_t* buffer);
|
||||||
protected:
|
protected:
|
||||||
virtual void beforeStateChange(LoadState& newState);
|
virtual void beforeStateChange(LoadState& newState);
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
bool initGroupObjects();
|
bool initGroupObjects();
|
||||||
uint16_t* _tableData = 0;
|
uint16_t* _tableData = 0;
|
||||||
|
38
interface_object.cpp
Normal file
38
interface_object.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,8 @@ public:
|
|||||||
virtual void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data) = 0;
|
virtual void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data) = 0;
|
||||||
virtual void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count) = 0;
|
virtual void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count) = 0;
|
||||||
virtual uint8_t propertySize(PropertyID id) = 0;
|
virtual uint8_t propertySize(PropertyID id) = 0;
|
||||||
|
void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
||||||
protected:
|
protected:
|
||||||
|
virtual uint8_t propertyCount() = 0;
|
||||||
|
virtual PropertyDescription* propertyDescriptions() = 0;
|
||||||
};
|
};
|
@ -303,3 +303,17 @@ void IpParameterObject::additionalLoadControls(uint8_t* data)
|
|||||||
_errorCode = E_INVALID_OPCODE;
|
_errorCode = E_INVALID_OPCODE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PropertyDescription _propertyDescriptions[] = { };
|
||||||
|
static uint8_t _propertyCount = sizeof(_propertyDescriptions) / sizeof(PropertyDescription);
|
||||||
|
|
||||||
|
uint8_t IpParameterObject::propertyCount()
|
||||||
|
{
|
||||||
|
return _propertyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PropertyDescription* IpParameterObject::propertyDescriptions()
|
||||||
|
{
|
||||||
|
return _propertyDescriptions;
|
||||||
|
}
|
@ -17,6 +17,9 @@ public:
|
|||||||
|
|
||||||
uint32_t multicastAddress() const;
|
uint32_t multicastAddress() const;
|
||||||
uint8_t ttl() const { return _ttl; }
|
uint8_t ttl() const { return _ttl; }
|
||||||
|
protected:
|
||||||
|
uint8_t propertyCount();
|
||||||
|
PropertyDescription* propertyDescriptions();
|
||||||
private:
|
private:
|
||||||
uint16_t _projectInstallationId = 0;
|
uint16_t _projectInstallationId = 0;
|
||||||
uint8_t _ipAssignmentMethod = 0;
|
uint8_t _ipAssignmentMethod = 0;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
enum PropertyDataType
|
enum PropertyDataType
|
||||||
{
|
{
|
||||||
PDT_CONTROL = 0x00, //!< length: 1 read, 10 write
|
PDT_CONTROL = 0x00, //!< length: 1 read, 10 write
|
||||||
@ -164,3 +166,25 @@ enum ErrorCode
|
|||||||
E_INVALID_GO_NUMBER = 17,
|
E_INVALID_GO_NUMBER = 17,
|
||||||
E_GO_TYPE_TOO_BIG = 18
|
E_GO_TYPE_TOO_BIG = 18
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum AccessLevel
|
||||||
|
{
|
||||||
|
ReadLv0 = 0x00,
|
||||||
|
ReadLv1 = 0x10,
|
||||||
|
ReadLv2 = 0x20,
|
||||||
|
ReadLv3 = 0x30,
|
||||||
|
WriteLv0 = 0x00,
|
||||||
|
WriteLv1 = 0x01,
|
||||||
|
WriteLv2 = 0x02,
|
||||||
|
WriteLv3 = 0x03,
|
||||||
|
};
|
||||||
|
|
||||||
|
class PropertyDescription
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PropertyID Id;
|
||||||
|
bool WriteEnable;
|
||||||
|
PropertyDataType Type;
|
||||||
|
uint16_t MaxElements;
|
||||||
|
uint8_t Access;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user