HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Core::AttributeReporting::Event::Field Struct Reference

Entry field for a given attribute. More...

#include <attribute_reporting.h>

+ Collaboration diagram for HF::Core::AttributeReporting::Event::Field:

Public Member Functions

 Field (Type _type=COV, uint8_t _attr_uid=0)
 Constructor. More...
 
uint16_t size (bool with_uid) const
 Number bytes needed to serialize the message. More...
 
uint16_t pack (Common::ByteArray &array, uint16_t offset, bool with_uid) const
 Write the object on to a ByteArray so it can be sent over the network. More...
 
uint16_t unpack (const Common::ByteArray &array, uint16_t offset, bool with_uid)
 Read a message from a ByteArray. More...
 

Data Fields

Type type
 Field type.
 
uint8_t attr_uid
 Attribute UID.
 
Common::ByteArray value
 Field value.
 

Static Public Attributes

static constexpr uint16_t min_size
 Minimum pack/unpack required data size.
 

Detailed Description

Entry field for a given attribute.

Definition at line 377 of file attribute_reporting.h.

Constructor & Destructor Documentation

◆ Field()

HF::Core::AttributeReporting::Event::Field::Field ( Type  _type = COV,
uint8_t  _attr_uid = 0 
)
inline

Constructor.

Parameters
[in]_typefield type.
[in]_attr_uidfield attribute uid.

Definition at line 394 of file attribute_reporting.h.

394  :
395  type(_type), attr_uid(_attr_uid)
396  {}

Member Function Documentation

◆ pack()

uint16_t HF::Core::AttributeReporting::Event::Field::pack ( Common::ByteArray array,
uint16_t  offset,
bool  with_uid 
) const

Write the object on to a ByteArray so it can be sent over the network.

The buffer passed in MUST have enough size to hold the serialized object, e.g.,

Serializable obj;
ByteArray payload(obj.size());
obj.pack(payload);
Parameters
[in,out]arrayByteArray reference to write the object to.
[in]offsetoffset to start writing to.
Returns
the number of bytes written.
Parameters
[in]with_uidinclude attr_uid in the serialization.

◆ size()

uint16_t HF::Core::AttributeReporting::Event::Field::size ( bool  with_uid) const

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.
Parameters
[in]with_uidif true include attr_uid size in the size calculation.

◆ unpack()

uint16_t HF::Core::AttributeReporting::Event::Field::unpack ( const Common::ByteArray array,
uint16_t  offset,
bool  with_uid 
)

Read a message from a ByteArray.

Parameters
[in]arrayByteArray reference to read the message from.
[in]offsetoffset to start reading from.
Returns
the number of bytes read.
Warning
If with_uid == true, then if the value read from the array does not match the attribute's UID, no more data will be read.
Parameters
[in]with_uidinclude uid() size in the calculation.

The documentation for this struct was generated from the following file: