mirror of
https://github.com/thelsing/knx.git
synced 2025-04-09 01:16:57 +02:00
document SaveRestore and InterfaceObject
This commit is contained in:
parent
46dba3ce73
commit
474534ab4f
@ -5,6 +5,10 @@ void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& prop
|
||||
PropertyDescription* descriptions = propertyDescriptions();
|
||||
uint8_t count = propertyCount();
|
||||
|
||||
numberOfElements = 0;
|
||||
if (descriptions == nullptr || count == 0)
|
||||
return;
|
||||
|
||||
PropertyDescription* desc = nullptr;
|
||||
|
||||
// from KNX spec. 03.03.07 Application Layer (page 56) - 3.4.3.3 A_PropertyDescription_Read-service
|
||||
@ -40,4 +44,28 @@ void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& prop
|
||||
numberOfElements = desc->MaxElements;
|
||||
access = desc->Access;
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceObject::readProperty(PropertyID id, uint32_t start, uint32_t &count, uint8_t *data)
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
|
||||
void InterfaceObject::writeProperty(PropertyID id, uint8_t start, uint8_t *data, uint8_t count)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t InterfaceObject::propertySize(PropertyID id)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t InterfaceObject::propertyCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PropertyDescription* InterfaceObject::propertyDescriptions()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#include "property_types.h"
|
||||
#include "save_restore.h"
|
||||
|
||||
/** Enum for the type of an interface object. See Section 2.2 at 03_07_03 of knx specification. */
|
||||
enum ObjectType
|
||||
{
|
||||
/** Device object. */
|
||||
@ -49,16 +50,78 @@ enum ObjectType
|
||||
OT_FILE_SERVER = 13
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief This class represents and interface object. See section 4 of 03_04_01 in the knx specification.
|
||||
*/
|
||||
class InterfaceObject: public SaveRestore
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
virtual ~InterfaceObject() {}
|
||||
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 uint8_t propertySize(PropertyID id) = 0;
|
||||
/**
|
||||
* @brief Read a property of the interface object. See section 4.8.4.2 in 03_04_01 of the knx specification.
|
||||
*
|
||||
* @param id id of the property to read
|
||||
*
|
||||
* @param start (for properties with multiple values) at which element should we start
|
||||
*
|
||||
* @param[in, out] count how many values should be read. If there is a problem (e.g. property does not exist)
|
||||
* this value is set to 0.
|
||||
*
|
||||
* @param[out] data The requested data of the property.
|
||||
*/
|
||||
virtual void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data);
|
||||
/**
|
||||
* @brief Write property of the interface object. If the interface object does not have the property this
|
||||
* method does nothing. See section 4.8.4.4 in 03_04_01 of the knx specification.
|
||||
*
|
||||
* @param id id of the property to write
|
||||
*
|
||||
* @param start (for properties with multiple values) at which element should we start
|
||||
*
|
||||
* @param count how many values should be written.
|
||||
*
|
||||
* @param data The data that should be written.
|
||||
*/
|
||||
virtual void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count);
|
||||
/**
|
||||
* @brief Gets the size of of property in bytes.
|
||||
*
|
||||
* @param id of the property to get the size of
|
||||
*
|
||||
* @returns the size in byte or 0 if the interface object does not have the property
|
||||
*/
|
||||
virtual uint8_t propertySize(PropertyID id);
|
||||
/**
|
||||
* @brief Read the Description of a property of the interface object. The output parameters are only valid if nuberOfElements is not zero.
|
||||
*
|
||||
* @param[in,out] propertyId The id of the property of which to read the description of. If this parameter is not zero
|
||||
* propertyIndex paramter is ignored as input and the corrrect index of the property is written to it. If this
|
||||
* parameter is zero the ::PropertyID of the property specified by propertyIndex is written to it.
|
||||
*
|
||||
* @param[in,out] propertyIndex The index of the property of the interface object of which to read the description of.
|
||||
* only used for input if propertyId is not set. Otherwise the index of the property specified by propertyId is written to it.
|
||||
*
|
||||
* @param[out] writeEnable Can the property be written to.
|
||||
*
|
||||
* @param[out] type the ::PropertyDataType of the property
|
||||
*
|
||||
* @param[out] numberOfElements the number of elements of the property. Zero if the interface object does not have the requested property.
|
||||
*
|
||||
* @param[out] access the ::AccessLevel necessary to read/write the property.
|
||||
*/
|
||||
|
||||
void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
|
||||
protected:
|
||||
virtual uint8_t propertyCount() = 0;
|
||||
virtual PropertyDescription* propertyDescriptions() = 0;
|
||||
/**
|
||||
* @brief Returns the number of properties the interface object has.
|
||||
*/
|
||||
virtual uint8_t propertyCount();
|
||||
/**
|
||||
* @brief Returns a pointer to the first PropertyDescription of the interface object.
|
||||
* This is used by readPropertyDescription() together with propertyCount().
|
||||
*/
|
||||
virtual PropertyDescription* propertyDescriptions();
|
||||
};
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** The data type of a property. */
|
||||
enum PropertyDataType
|
||||
{
|
||||
PDT_CONTROL = 0x00, //!< length: 1 read, 10 write
|
||||
@ -168,6 +169,7 @@ enum ErrorCode
|
||||
E_GO_TYPE_TOO_BIG = 18
|
||||
};
|
||||
|
||||
/** The access level necessary to read a property of an interface object. */
|
||||
enum AccessLevel
|
||||
{
|
||||
ReadLv0 = 0x00,
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
*@brief Interface for classes that can save and restore data from a buffer.
|
||||
* @brief Interface for classes that can save and restore data from a buffer.
|
||||
*/
|
||||
class SaveRestore
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user