mirror of
https://github.com/thelsing/knx.git
synced 2025-04-19 01:15:27 +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();
|
PropertyDescription* descriptions = propertyDescriptions();
|
||||||
uint8_t count = propertyCount();
|
uint8_t count = propertyCount();
|
||||||
|
|
||||||
|
numberOfElements = 0;
|
||||||
|
if (descriptions == nullptr || count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
PropertyDescription* desc = nullptr;
|
PropertyDescription* desc = nullptr;
|
||||||
|
|
||||||
// from KNX spec. 03.03.07 Application Layer (page 56) - 3.4.3.3 A_PropertyDescription_Read-service
|
// from KNX spec. 03.03.07 Application Layer (page 56) - 3.4.3.3 A_PropertyDescription_Read-service
|
||||||
@ -41,3 +45,27 @@ void InterfaceObject::readPropertyDescription(uint8_t& propertyId, uint8_t& prop
|
|||||||
access = desc->Access;
|
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 "property_types.h"
|
||||||
#include "save_restore.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
|
enum ObjectType
|
||||||
{
|
{
|
||||||
/** Device object. */
|
/** Device object. */
|
||||||
@ -49,16 +50,78 @@ enum ObjectType
|
|||||||
OT_FILE_SERVER = 13
|
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
|
class InterfaceObject: public SaveRestore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Destructor
|
||||||
|
*/
|
||||||
virtual ~InterfaceObject() {}
|
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;
|
* @brief Read a property of the interface object. See section 4.8.4.2 in 03_04_01 of the knx specification.
|
||||||
virtual uint8_t propertySize(PropertyID id) = 0;
|
*
|
||||||
|
* @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);
|
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;
|
* @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>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/** The data type of a property. */
|
||||||
enum PropertyDataType
|
enum PropertyDataType
|
||||||
{
|
{
|
||||||
PDT_CONTROL = 0x00, //!< length: 1 read, 10 write
|
PDT_CONTROL = 0x00, //!< length: 1 read, 10 write
|
||||||
@ -168,6 +169,7 @@ enum ErrorCode
|
|||||||
E_GO_TYPE_TOO_BIG = 18
|
E_GO_TYPE_TOO_BIG = 18
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** The access level necessary to read a property of an interface object. */
|
||||||
enum AccessLevel
|
enum AccessLevel
|
||||||
{
|
{
|
||||||
ReadLv0 = 0x00,
|
ReadLv0 = 0x00,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdint.h>
|
#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
|
class SaveRestore
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user