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

Base class for responses. More...

#include <group_table.h>

+ Inheritance diagram for HF::Core::GroupTable::Response:
+ Collaboration diagram for HF::Core::GroupTable::Response:

Public Member Functions

 Response (Common::Result code=Common::Result::FAIL_UNKNOWN, uint16_t group=0x0000, uint8_t unit=0x00)
 Constructor. More...
 
 Response (Common::Result code, const Entry &entry)
 Constructor. More...
 
uint16_t size () const
 Number bytes needed to serialize the message. More...
 
uint16_t pack (Common::ByteArray &array, uint16_t offset=0) 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=0)
 Read a message from a ByteArray. More...
 
- Public Member Functions inherited from HF::Protocol::Response
uint16_t size () const
 Number bytes needed to serialize the message. More...
 
uint16_t pack (Common::ByteArray &array, uint16_t offset=0) 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=0)
 Read a message from a ByteArray. More...
 
- Public Member Functions inherited from HF::Core::GroupTable::Entry
uint16_t size () const
 Number bytes needed to serialize the message. More...
 
uint16_t pack (Common::ByteArray &array, uint16_t offset=0) 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=0)
 Read a message from a ByteArray. More...
 

Static Public Attributes

static constexpr uint16_t min_size
 Minimum pack/unpack required data size.
 
- Static Public Attributes inherited from HF::Protocol::Response
static constexpr uint16_t min_size = sizeof(uint8_t)
 Minimum number of bytes required by this message.
 
- Static Public Attributes inherited from HF::Core::GroupTable::Entry
static constexpr uint16_t min_size
 Minimum pack/unpack required data size.
 

Additional Inherited Members

- Data Fields inherited from HF::Core::GroupTable::Entry
uint16_t group
 Group address the entry belongs to. More...
 
uint8_t unit
 Unit ID to route the group messages to. More...
 

Detailed Description

Base class for responses.

Definition at line 156 of file group_table.h.

Constructor & Destructor Documentation

◆ Response() [1/2]

HF::Core::GroupTable::Response::Response ( Common::Result  code = Common::Result::FAIL_UNKNOWN,
uint16_t  group = 0x0000,
uint8_t  unit = 0x00 
)
inline

Constructor.

Parameters
[in]coderesponse code.
[in]groupgroup address for response.
[in]unitunit ID for response.

Definition at line 165 of file group_table.h.

166  :
167  Protocol::Response(code), Entry(group, unit) {}
uint8_t unit
Unit ID to route the group messages to.
Definition: group_table.h:86
uint16_t group
Group address the entry belongs to.
Definition: group_table.h:84

◆ Response() [2/2]

HF::Core::GroupTable::Response::Response ( Common::Result  code,
const Entry entry 
)
inline

Constructor.

Parameters
[in]coderesponse code.
[in]entrygroup entry for response.

Definition at line 175 of file group_table.h.

175  :
176  Protocol::Response(code), Entry(entry) {}

Member Function Documentation

◆ pack()

uint16_t HF::Core::GroupTable::Response::pack ( Common::ByteArray array,
uint16_t  offset = 0 
) const
inline

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.

Definition at line 193 of file group_table.h.

References HF_SERIALIZABLE_CHECK, HF::Core::GroupTable::Entry::pack(), HF::Protocol::Response::pack(), and size().

194  {
195  HF_SERIALIZABLE_CHECK(array, offset, size());
196 
197  uint16_t start = offset;
198 
199  offset += Protocol::Response::pack(array, offset);
200  offset += Entry::pack(array, offset);
201 
202  return offset - start;
203  }
#define HF_SERIALIZABLE_CHECK(__array, __offset, __size)
Helper macro to check if the given __array has enough size so __size bytes can be written/read from t...
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
uint16_t size() const
Number bytes needed to serialize the message.
Definition: group_table.h:187
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
+ Here is the call graph for this function:

◆ size()

uint16_t HF::Core::GroupTable::Response::size ( ) const
inline

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.

Definition at line 187 of file group_table.h.

References HF::Core::GroupTable::Entry::size(), and HF::Protocol::Response::size().

Referenced by pack(), and unpack().

188  {
190  }
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t size() const
Number bytes needed to serialize the message.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unpack()

uint16_t HF::Core::GroupTable::Response::unpack ( const Common::ByteArray array,
uint16_t  offset = 0 
)
inline

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.

Definition at line 206 of file group_table.h.

References HF_SERIALIZABLE_CHECK, size(), HF::Core::GroupTable::Entry::unpack(), and HF::Protocol::Response::unpack().

207  {
208  HF_SERIALIZABLE_CHECK(array, offset, size());
209 
210  uint16_t start = offset;
211 
212  offset += Protocol::Response::unpack(array, offset);
213  offset += Entry::unpack(array, offset);
214 
215  return offset - start;
216  }
#define HF_SERIALIZABLE_CHECK(__array, __offset, __size)
Helper macro to check if the given __array has enough size so __size bytes can be written/read from t...
uint16_t size() const
Number bytes needed to serialize the message.
Definition: group_table.h:187
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
+ Here is the call graph for this function:

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