![]() |
HAN-FUN API
1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
|
#include <protocol.h>
Public Types | |
enum | Type { DEVICE = 0, GROUP = 1 } |
HAN-FUN Network Destination Address Types. More... | |
Public Member Functions | |
Address (uint16_t _dev=BROADCAST_ADDR, uint8_t _unit=BROADCAST_UNIT, Type _mod=DEVICE) | |
Create a new message address. 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... | |
bool | is_broadcast () |
Checks if this address if for the Protocol::BROADCAST_ADDR and Protocol::BROADCAST_UNIT. More... | |
bool | is_local (uint16_t address) |
Checks if the given device address is equal to the device address present in this Protocol::Address object. More... | |
int | compare (const Address &other) const |
Compare this address with the given address in other . More... | |
Data Fields | |
uint16_t | mod: 1 |
Address modifier. More... | |
uint16_t | device: 15 |
Device Address. More... | |
uint8_t | unit |
Source Unit. More... | |
Static Public Attributes | |
static constexpr uint16_t | min_size |
Minimum pack/unpack required data size. | |
Network Address.
Definition at line 201 of file protocol.h.
HAN-FUN Network Destination Address Types.
Enumerator | |
---|---|
DEVICE | Destination address is for single device. |
GROUP | Destination address is for a group of devices. |
Definition at line 211 of file protocol.h.
|
inline |
Create a new message address.
[in] | _dev | device address. Default HF_BROADCAST_ADDR . |
[in] | _unit | unit address. Default HF_BROADCAST_UNIT . |
[in] | _mod | address modifier. Default DEVICE_ADDR . |
Definition at line 224 of file protocol.h.
|
inline |
Compare this address with the given address in other
.
This method should return < 0 if this address is less that, 0 if it is equal and > 0 if greater that the other
address.
[in] | other | address to compare to. |
<0 | if address less than other ; |
0 | if address equal to other ; |
>0 | if address greater than other . |
Definition at line 280 of file protocol.h.
References HF::Protocol::BROADCAST_ADDR.
|
inline |
Checks if this address if for the Protocol::BROADCAST_ADDR and Protocol::BROADCAST_UNIT.
true | if it is the network's broadcast address, |
false | otherwise. |
Definition at line 249 of file protocol.h.
References HF::Protocol::BROADCAST_ADDR, HF::Protocol::BROADCAST_UNIT, device, and unit.
|
inline |
Checks if the given device address
is equal to the device address present in this Protocol::Address object.
[in] | address | network address to match. |
true | if it is the network's address are equal, |
false | otherwise. |
Definition at line 263 of file protocol.h.
References device.
uint16_t HF::Protocol::Address::pack | ( | Common::ByteArray & | array, |
uint16_t | offset = 0 |
||
) | 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.,
[in,out] | array | ByteArray reference to write the object to. |
[in] | offset | offset to start writing to. |
uint16_t HF::Protocol::Address::size | ( | ) | const |
Number bytes needed to serialize the message.
uint16_t HF::Protocol::Address::unpack | ( | const Common::ByteArray & | array, |
uint16_t | offset = 0 |
||
) |
Read a message from a ByteArray.
[in] | array | ByteArray reference to read the message from. |
[in] | offset | offset to start reading from. |
uint16_t HF::Protocol::Address::device |
Device Address.
Definition at line 204 of file protocol.h.
Referenced by HF::Devices::AbstractDevice::from_local(), is_broadcast(), is_local(), and HF::Devices::AbstractDevice::to_local().
uint16_t HF::Protocol::Address::mod |
Address modifier.
Definition at line 203 of file protocol.h.
uint8_t HF::Protocol::Address::unit |