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

Set attribute operation result. More...

#include <attributes.h>

+ Collaboration diagram for HF::Protocol::SetAttributePack::Response::Result:

Public Member Functions

 Result (uint8_t uid, Common::Result code)
 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...
 

Data Fields

uint8_t uid
 Attribute UID. More...
 
Common::Result code
 Command result. More...
 

Static Public Attributes

static constexpr uint16_t min_size = sizeof(uint8_t) + sizeof(uint8_t)
 Minimum pack/unpack required data size.
 

Detailed Description

Set attribute operation result.

Definition at line 1057 of file attributes.h.

Constructor & Destructor Documentation

◆ Result()

HF::Protocol::SetAttributePack::Response::Result::Result ( uint8_t  uid,
Common::Result  code 
)
inline

Constructor.

Parameters
[in]uidattribute's UID.
[in]codeoperation result code.

Definition at line 1070 of file attributes.h.

1070  :
1071  uid(uid), code(code)
1072  {}

Member Function Documentation

◆ pack()

uint16_t HF::Protocol::SetAttributePack::Response::Result::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 1084 of file attributes.h.

References code, HF_SERIALIZABLE_CHECK, min_size, uid, and HF::Common::ByteArray::write().

1085  {
1086  HF_SERIALIZABLE_CHECK(array, offset, min_size);
1087 
1088  offset += array.write(offset, (uint8_t) uid);
1089 
1090  array.write(offset, (uint8_t) code);
1091 
1092  return min_size;
1093  }
#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...
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Definition: attributes.h:1075
+ Here is the call graph for this function:

◆ size()

uint16_t HF::Protocol::SetAttributePack::Response::Result::size ( ) const
inline

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.

Definition at line 1078 of file attributes.h.

References min_size.

1079  {
1080  return min_size;
1081  }
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Definition: attributes.h:1075

◆ unpack()

uint16_t HF::Protocol::SetAttributePack::Response::Result::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 1096 of file attributes.h.

References code, HF_SERIALIZABLE_CHECK, min_size, HF::Common::ByteArray::read(), and uid.

1097  {
1098  HF_SERIALIZABLE_CHECK(array, offset, min_size);
1099 
1100  offset += array.read(offset, uid);
1101 
1102  uint8_t temp;
1103  array.read(offset, temp);
1104  code = static_cast<Common::Result>(temp);
1105 
1106  return min_size;
1107  }
#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...
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Definition: attributes.h:1075
Result
Commands result codes.
+ Here is the call graph for this function:

Field Documentation

◆ code

Common::Result HF::Protocol::SetAttributePack::Response::Result::code

Command result.

Definition at line 1060 of file attributes.h.

Referenced by pack(), and unpack().

◆ uid

uint8_t HF::Protocol::SetAttributePack::Response::Result::uid

Attribute UID.

Definition at line 1059 of file attributes.h.

Referenced by pack(), and unpack().


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