Class InterfaceObject

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class InterfaceObject : public SaveRestore

This class represents and interface object.

See section 4 of [3].

Subclassed by DeviceObject, TableObject

Public Functions

virtual ~InterfaceObject()

Destructor.

virtual void readProperty(PropertyID id, uint16_t start, uint8_t &count, uint8_t *data)

Read a property of the interface object.

See section 4.8.4.2 of [3].

Parameters
  • id – id of the property to read

  • start – (for properties with multiple values) at which element should we start

  • count[inout] how many values should be read. If there is a problem (e.g. property does not exist) this value is set to 0.

  • data[out] The requested data of the property.

virtual void writeProperty(PropertyID id, uint16_t start, uint8_t *data, uint8_t &count)

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 of [3].

Parameters
  • id – id of the property to write

  • start – (for properties with multiple values) at which element should we start

  • count[inout] how many values should be written. If there is a problem (e.g. property does not exist) this value is set to 0.

  • data[in] The data that should be written.

virtual uint8_t propertySize(PropertyID id)

Gets the size of of property in bytes.

Parameters

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 void command(PropertyID id, uint8_t *data, uint8_t length, uint8_t *resultData, uint8_t &resultLength)

Call command of a function property of the interface object.

Property type must be PDT_FUNCTION

Parameters
  • id – id of the property to call

  • length[in] The size of the data buffer

  • data[in] The argument data for the function

  • resultLength[out] The size of the result data buffer

  • resultData[out] The result data for the function

virtual void state(PropertyID id, uint8_t *data, uint8_t length, uint8_t *resultData, uint8_t &resultLength)

Get state of a function property of the interface object.

Property type must be PDT_FUNCTION

Parameters
  • id – id of the property to call

  • length[in] The size of the data buffer

  • data[in] The argument data for the function

  • resultLength[out] The size of the result data buffer

  • resultData[out] The result data for the function

void readPropertyDescription(uint8_t &propertyId, uint8_t &propertyIndex, bool &writeEnable, uint8_t &type, uint16_t &numberOfElements, uint8_t &access)

Read the Description of a property of the interface object.

The output parameters are only valid if nuberOfElements is not zero.

Parameters
  • propertyId[inout] 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.

  • propertyIndex[inout] 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.

  • writeEnable[out] Can the property be written to.

  • type[out] the PropertyDataType of the property

  • numberOfElements[out] the number of elements of the property. Zero if the interface object does not have the requested property.

  • access[out] the AccessLevel necessary to read/write the property.

virtual void masterReset(EraseCode eraseCode, uint8_t channel)
Property *property(PropertyID id)

Gets property with PropertyID id if it exists and nullptr otherwise.

template<typename T>
inline T propertyValue(PropertyID id)
template<typename T>
inline void propertyValue(PropertyID id, T value)
const uint8_t *propertyData(PropertyID id)
const uint8_t *propertyData(PropertyID id, uint16_t elementIndex)
const Property *property(PropertyID id) const

Gets const property with PropertyID id if it exists and nullptr otherwise.

virtual uint8_t *save(uint8_t *buffer) override

This method is called when the object should save its state to the buffer.

Parameters

buffer – The buffer the object should save its state to.

Returns

The buffer plus the size of the object state. The next object will use this value as the start of its buffer.

virtual const uint8_t *restore(const uint8_t *buffer) override

This method is called when the object should restore its state from the buffer.

Parameters

buffer – The buffer the object should restore its state from.

Returns

The buffer plus the size of the object state. The next object will use this value as the start of its buffer.

virtual uint16_t saveSize() override
Returns

The maximum number of bytes the object needs to save its state.

Protected Functions

virtual void initializeProperties(size_t propertiesSize, Property **properties)

Intializes the Property-array the the supplied values.

Protected Attributes

Property **_properties = nullptr
uint8_t _propertyCount = 0