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

Unit Entry. More...

#include <device_management.h>

+ Collaboration diagram for HF::Core::DeviceManagement::Unit:

Public Member Functions

 Unit (uint8_t id=0, uint16_t profile=0)
 Constructor. More...
 
 Unit (const HF::Units::IUnit &unit)
 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...
 
bool has_interface (uint16_t itf_uid, HF::Interface::Role role) const
 This method checks if the remote device unit implements the given interface. More...
 

Data Fields

uint8_t id
 Unit Id. More...
 
uint16_t profile
 Unit UID. More...
 
std::vector< Common::Interfaceinterfaces
 Optional interfaces.
 

Static Public Attributes

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

Detailed Description

Unit Entry.

Definition at line 108 of file device_management.h.

Constructor & Destructor Documentation

◆ Unit() [1/2]

HF::Core::DeviceManagement::Unit::Unit ( uint8_t  id = 0,
uint16_t  profile = 0 
)
inline

Constructor.

Parameters
[in]idunit id.
[in]profileunit UID / Profile UID.

Definition at line 122 of file device_management.h.

122  :
123  id(id), profile(profile)
124  {}

◆ Unit() [2/2]

HF::Core::DeviceManagement::Unit::Unit ( const HF::Units::IUnit unit)
inline

Constructor.

Parameters
[in]unitreference to a HF::Units::IUnit.

Definition at line 131 of file device_management.h.

131  :
132  id(unit.id()), profile(unit.uid()), interfaces(unit.interfaces())
133  {}
virtual uint8_t id() const =0
Get the id number of this unit on the device.
virtual uint16_t uid() const =0
Return this profile HAN-FUN UID.
virtual std::vector< Common::Interface > interfaces() const =0
Return a vector containing a list of extra interfaces, other than the interfaces specified by the pro...
std::vector< Common::Interface > interfaces
Optional interfaces.

Member Function Documentation

◆ has_interface()

bool HF::Core::DeviceManagement::Unit::has_interface ( uint16_t  itf_uid,
HF::Interface::Role  role 
) const

This method checks if the remote device unit implements the given interface.

The known interfaces for the profile associated with this unit and the declared optional interfaces are searched, to check if the requested interface is available.

Parameters
[in]itf_uidthe interface UID to check if the profile implements.
[in]rolethe interface role to match.
Return values
trueif this unit implements the requested interface,
falseotherwise.

◆ pack()

uint16_t HF::Core::DeviceManagement::Unit::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.,

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.

◆ size()

uint16_t HF::Core::DeviceManagement::Unit::size ( ) const

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.

◆ unpack()

uint16_t HF::Core::DeviceManagement::Unit::unpack ( const Common::ByteArray array,
uint16_t  offset = 0 
)

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.

Field Documentation

◆ id

uint8_t HF::Core::DeviceManagement::Unit::id

Unit Id.

Definition at line 110 of file device_management.h.

◆ profile

uint16_t HF::Core::DeviceManagement::Unit::profile

Unit UID.

See also
IProfile::UID.

Definition at line 111 of file device_management.h.


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