113 uint16_t
size()
const;
162 static constexpr uint16_t
min_size =
sizeof(uint8_t)
168 uint16_t
size()
const;
230 static constexpr uint16_t
min_size =
sizeof(uint16_t)
234 uint16_t
size()
const;
265 return this->
device == address;
282 auto serialize = [
this](
const Address &a)
288 uint32_t t = serialize(*
this);
289 uint32_t o = serialize(other);
356 uint16_t
size()
const;
375 constexpr
static uint16_t
min_size =
sizeof(uint8_t);
383 code(static_cast<Common::
Result>(code)) {}
386 uint16_t
size()
const;
482 inline bool operator==(Address
const &lhs, Address
const &rhs)
484 return (lhs.device == rhs.device) && (lhs.unit == rhs.unit) && (lhs.mod == rhs.mod);
487 inline bool operator!=(Address
const &lhs, Address
const &rhs)
489 return !(lhs == rhs);
492 inline bool operator<(Address
const &lhs, Address
const &rhs)
494 return (lhs.device < rhs.device) ||
495 (lhs.device == rhs.device &&
496 (lhs.mod < rhs.mod || (lhs.mod == rhs.mod && lhs.unit < rhs.unit)));
constexpr uint16_t MAX_PAYLOAD
HAN-FUN Network - Maximum application payload length.
Set pack attributes request.
uint16_t address
Source device address.
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 unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Destination address is for single device.
uint16_t size() const
Number bytes needed to serialize the message.
Interface(uint16_t uid=0, uint8_t role=0, uint8_t member=0)
Constructor.
bool request(Message::Type type, bool response=false)
Check if message type is a request.
This class provides support for generating a response when a response is required from an incoming me...
uint16_t size() const
Number of entries in the filter's database.
bool response(Message::Type type)
Check if message is a response.
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.
Get pack attributes request.
int compare(const Address &other) const
Compare this address with the given address in other.
bool operator()(const HF::Protocol::Packet &packet)
Checks if the given packet, is a retransmission according to the filters database data...
Message message
Packet message payload;.
This file contains the common defines for the HAN-FUN library.
Set attributes request with response required.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Packet(Address &src_addr, Address &dst_addr, Message &message)
Constructor.
This interface represents a link on the transport layer, used to send data to the remote end-point...
bool isCommand() const
Check if message type is equal to COMMAND_REQ or to COMMAND_RESP_REQ.
constexpr uint16_t BROADCAST_ADDR
HAN-FUN Broadcast - device address.
Address(uint16_t _dev=BROADCAST_ADDR, uint8_t _unit=BROADCAST_UNIT, Type _mod=DEVICE)
Create a new message address.
Transport::Link * link
Link where this packet originated from.
bool is_broadcast()
Checks if this address if for the Protocol::BROADCAST_ADDR and Protocol::BROADCAST_UNIT.
Set pack attributes response.
Atomic set pack attributes response.
uint16_t size() const
Number bytes needed to serialize the message.
Common::ByteArray payload
Message payload.
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.
Message::Interface itf
Interface the message relates to.
Packet(Message &message)
Constructor.
uint16_t length
The payload length value read when unpacking the message.
bool matches(Message::Type lhs, Message::Type rhs)
Check if the given message types are the request and response for each other, for example...
Address destination
Destination Address.
uint16_t role
Interface role : Server or Client.
static constexpr uint16_t header_min_size
Minimum pack/unpack required header data size.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
static const uint16_t min_size
Minimum pack/unpack required data size.
Atomic set pack attributes request with response required.
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 pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
This class represents a byte array.
bool isCommandResponse() const
Check if message type is equal to COMMAND_RES.
uint8_t member
Interface destination member.
Get pack attributes response.
Address source
Source Address.
Command request with response required.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Interface itf
Interface Address.
uint16_t mod
Address modifier.
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.
uint8_t reference
Application reference.
Message(uint16_t size=0, Type _type=COMMAND_REQ)
Constructor.
bool is_local(uint16_t address)
Checks if the given device address is equal to the device address present in this Protocol::Address o...
Message::Type type
Response type.
uint16_t size() const
Number bytes needed to serialize the message.
Parent class for the response messages.
uint16_t device
Device Address.
Type
HAN-FUN Network Destination Address Types.
std::list< Entry > db
Filter database.
std::ostream & operator<<(std::ostream &stream, const HF::Protocol::Message::Type type)
Convert the given message type into a string and write it to the given stream.
Destination address is for a group of devices.
uint16_t size() const
Number bytes needed to serialize the message.
static constexpr uint16_t min_size
Minimum number of bytes required by this message.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Atomic set pack attributes request.
Packet(Address &dst_addr, Message &message, uint8_t unit=BROADCAST_UNIT)
Constructor.
Set pack attributes request with response required.
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Result
Commands result codes.
constexpr uint8_t BROADCAST_UNIT
HAN-FUN Broadcast - unit address.
Top-level namespace for the HAN-FUN library.