![]() |
HAN-FUN API
1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
|
This module contains the classes that implement the Bind Management service. More...
Data Structures | |
struct | HF::Core::BindManagement::Entry |
This represents a bind entry data structure. More... | |
struct | HF::Core::BindManagement::Message |
Add/Remove Bind message. More... | |
struct | HF::Core::BindManagement::IEntries |
Bind Management persistent storage API. More... | |
class | HF::Core::BindManagement::Base |
Parent class for the Bind Management interface implementation. More... | |
class | HF::Core::BindManagement::Client |
Bind Management interface : Client side. More... | |
struct | HF::Core::BindManagement::IServer |
Bind Management interface : Server side API. More... | |
struct | HF::Core::BindManagement::AbstractServer |
Parent class for bind management - server role. More... | |
struct | HF::Core::BindManagement::Entries |
Default implementation of the bind entries container. More... | |
struct | HF::Core::BindManagement::Server< _Entries > |
Helper class used to implement custom functionality to the bind management server side. More... | |
Enumerations | |
enum | HF::Core::BindManagement::CMD { HF::Core::BindManagement::ADD_BIND_CMD = 0x01, HF::Core::BindManagement::REMOVE_BIND_CMD = 0x02, HF::Core::BindManagement::START_SESSION_CMD = 0x03, HF::Core::BindManagement::END_SESSION_CMD = 0x04, HF::Core::BindManagement::GET_ENTRIES_CMD = 0x05 } |
Commands. More... | |
enum | HF::Core::BindManagement::Attributes { HF::Core::BindManagement::NUMBER_OF_ENTRIES_ATTR = 0x01 } |
Attributes. More... | |
Functions | |
HF::Attributes::IAttribute * | HF::Core::create_attribute (HF::Core::BindManagement::IServer *server, uint8_t uid) |
Create an attribute object that can hold the attribute with the given uid . More... | |
HF::Core::BindManagement::Entry::Entry (Protocol::Address _source, Common::Interface _itf) | |
Constructor. More... | |
HF::Core::BindManagement::Entry::Entry (Protocol::Address _source, Common::Interface _itf, Protocol::Address _destination) | |
Constructor. More... | |
uint16_t | HF::Core::BindManagement::Entry::size () const |
Number bytes needed to serialize the message. More... | |
uint16_t | HF::Core::BindManagement::Entry::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 | HF::Core::BindManagement::Entry::unpack (const Common::ByteArray &array, uint16_t offset=0) |
Read a message from a ByteArray. More... | |
virtual Common::Result | HF::Core::BindManagement::IEntries::destroy (uint16_t address, Protocol::Address::Type type=Protocol::Address::DEVICE)=0 |
Destroy the entries in the persistent storage, that refer to the the given address. More... | |
virtual EntryPtr | HF::Core::BindManagement::IEntries::find (const Protocol::Address &source, const Common::Interface &itf, const Protocol::Address &destination) const =0 |
Return the Bind entry for the given parameters. More... | |
virtual bool | HF::Core::BindManagement::IEntries::any_of (Protocol::Address const &source, Common::Interface const &itf) const =0 |
Check if entries for the device with given source address and for the given interface ifc exist. More... | |
virtual void | HF::Core::BindManagement::IEntries::for_each (Protocol::Address const &source, Common::Interface const &itf, std::function< void(const Entry &)> func) const =0 |
Call the given function for all the entries with given source address and for the given interface ifc . More... | |
HF::Attributes::IAttribute * | HF::Core::BindManagement::create_attribute (uint8_t uid) |
Create an attribute object that can hold the attribute with the given uid . (HF::Core::BindManagement::Server *,uint8_t) More... | |
HF::Core::BindManagement::Base::Base (HF::Core::Unit0 &unit) | |
Constructor. More... | |
HF::Core::BindManagement::Client::Client (HF::Core::Unit0 &unit) | |
Constructor. More... | |
SessionMgr & | HF::Core::BindManagement::Client::session () |
Reference to the session management API. More... | |
void | HF::Core::BindManagement::Client::send (const Protocol::Address &addr, Protocol::Message &message) |
Send message msg to the network address given by addr . More... | |
HF::Devices::Concentrator::IUnit0 & | HF::Core::BindManagement::IServer::unit0 () const |
Return a reference to the unit that this service belongs to. More... | |
virtual IEntries & | HF::Core::BindManagement::IServer::entries () const =0 |
Reference to the persistent storage implementation. More... | |
virtual SessionManagement::IServer & | HF::Core::BindManagement::IServer::sessions ()=0 |
Reference to the session management API. More... | |
HF::Core::BindManagement::IServer::IServer (Unit0 &unit) | |
Constructor. More... | |
Common::Result | HF::Core::BindManagement::AbstractServer::add (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf) |
Create a new bind entry in the database. More... | |
Common::Result | HF::Core::BindManagement::AbstractServer::remove (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf) |
Remove a bind entry from the database. More... | |
HF::Core::BindManagement::AbstractServer::AbstractServer (Unit0 &unit) | |
Constructor. More... | |
uint16_t | HF::Core::BindManagement::Entries::size () const |
Return the number of entries in the container. More... | |
Common::Result | HF::Core::BindManagement::Entries::destroy (const Entry &entry) |
Destroy the given entry in the persistent storage. More... | |
Common::Result | HF::Core::BindManagement::Entries::destroy (uint16_t address, Protocol::Address::Type type=Protocol::Address::DEVICE) |
Destroy the entries in the persistent storage, that refer to the the given address. More... | |
EntryPtr | HF::Core::BindManagement::Entries::find (const Protocol::Address &source, const Common::Interface &itf, const Protocol::Address &destination) const |
Return the Bind entry for the given parameters. More... | |
bool | HF::Core::BindManagement::Entries::any_of (Protocol::Address const &source, Common::Interface const &itf) const |
Check if entries for the device with given source address and for the given interface ifc exist. More... | |
void | HF::Core::BindManagement::Entries::for_each (Protocol::Address const &source, Common::Interface const &itf, std::function< void(const Entry &)> func) const |
Call the given function for all the entries with given source address and for the given interface ifc . More... | |
std::pair< iterator, iterator > | HF::Core::BindManagement::Entries::find (Protocol::Address const &source, Common::Interface const &itf) const |
Return a pair of iterators for the entries that match the given search criteria. More... | |
template<typename Func > | |
Common::Result | HF::Core::BindManagement::Entries::destroy (Func func) |
Destroy the entries in the persistent storage, for which the given predicate function returns true . More... | |
HF::Core::BindManagement::Server< _Entries >::Server (Unit0 &unit) | |
Constructor. More... | |
Container & | HF::Core::BindManagement::Server< _Entries >::entries () const |
Reference to the persistent storage implementation. More... | |
SessionMgr & | HF::Core::BindManagement::Server< _Entries >::sessions () |
Reference to the session management API. More... | |
void | HF::Core::BindManagement::Server< _Entries >::send (const Protocol::Address &addr, Protocol::Message &message) |
Send message msg to the network address given by addr . More... | |
std::ostream & | operator<< (std::ostream &stream, const HF::Core::BindManagement::CMD command) |
Convert the given command into a string and write it to the given stream . More... | |
std::ostream & | operator<< (std::ostream &stream, const HF::Core::BindManagement::Attributes attribute) |
Convert the given attribute into a string and write it to the given stream . More... | |
Variables | |
Protocol::Address | HF::Core::BindManagement::Entry::source |
Source Address. More... | |
Protocol::Address | HF::Core::BindManagement::Entry::destination |
Destination Address. More... | |
Common::Interface | HF::Core::BindManagement::Entry::itf |
Destination Interface. More... | |
static constexpr uint16_t | HF::Core::BindManagement::Entry::min_size |
Minimum pack/unpack required data size. | |
Container | HF::Core::BindManagement::Entries::db |
Container for the bind entries. | |
_Entries | HF::Core::BindManagement::Server< _Entries >::_entries |
Bind entries database. More... | |
Commands | |
void | HF::Core::BindManagement::Client::add (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf) |
Send a ADD_BIND command. More... | |
void | HF::Core::BindManagement::Client::remove (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf) |
Send a REMOVE_BIND command. More... | |
void | HF::Core::BindManagement::Client::start_session () const |
Start read entries session. | |
void | HF::Core::BindManagement::Client::get_entries (uint16_t offset, uint8_t count=0) const |
Read entries. More... | |
void | HF::Core::BindManagement::Client::end_session () const |
End read entries session. | |
Events | |
virtual void | HF::Core::BindManagement::Client::response (const CMD cmd, const Protocol::Response &response) |
This method is called when the response to a command is received. More... | |
Commands | |
virtual Common::Result | HF::Core::BindManagement::IServer::add (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf)=0 |
Create a new bind entry in the database. More... | |
virtual Common::Result | HF::Core::BindManagement::IServer::remove (const Protocol::Address &source, const Protocol::Address &destination, const Common::Interface &itf)=0 |
Remove a bind entry from the database. More... | |
This module contains the classes that implement the Bind Management service.
Enumerator | |
---|---|
NUMBER_OF_ENTRIES_ATTR | Number of entries attribute. |
Definition at line 114 of file bind_management.h.
Commands.
Definition at line 103 of file bind_management.h.
|
inlineprotected |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 536 of file bind_management.h.
|
inlineprotected |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 276 of file bind_management.h.
|
inline |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 298 of file bind_management.h.
|
inline |
Constructor.
[in] | _source | device source for the bind entry. |
[in] | _itf | interface UID + role for the bind entry. |
Definition at line 140 of file bind_management.h.
|
inline |
Constructor.
[in] | _source | device source for the bind entry. |
[in] | _itf | interface UID + role for the bind entry. |
[in] | _destination | destination device for he bing entry. |
Definition at line 151 of file bind_management.h.
|
inlineprotected |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 489 of file bind_management.h.
|
inline |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 665 of file bind_management.h.
void HF::Core::BindManagement::Client::add | ( | const Protocol::Address & | source, |
const Protocol::Address & | destination, | ||
const Common::Interface & | itf | ||
) |
Send a ADD_BIND command.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to bind between source and destination. |
|
pure virtual |
Create a new bind entry in the database.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to bind between source and destination. |
Implemented in HF::Core::BindManagement::AbstractServer.
|
virtual |
Create a new bind entry in the database.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to bind between source and destination. |
Implements HF::Core::BindManagement::IServer.
|
pure virtual |
Check if entries for the device with given source
address and for the given interface ifc
exist.
[in] | source | device address to search for. |
[in] | itf | interface id to search for. |
true | if entries exist, |
false | otherwise. |
Implemented in HF::Core::BindManagement::Entries.
|
virtual |
Check if entries for the device with given source
address and for the given interface ifc
exist.
[in] | source | device address to search for. |
[in] | itf | interface id to search for. |
true | if entries exist, |
false | otherwise. |
Implements HF::Core::BindManagement::IEntries.
HF::Attributes::IAttribute* HF::Core::create_attribute | ( | HF::Core::BindManagement::IServer * | server, |
uint8_t | uid | ||
) |
Create an attribute object that can hold the attribute with the given uid
.
If server
is not equal to nullptr
then initialize it with the current value.
[in] | server | pointer to the object to read the current value from. |
[in] | uid | attribute's UID to create the attribute object for. |
nullptr
if the attribute UID does not exist.
|
inline |
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::BindManagement::Server *,uint8_t)
[in] | uid | attribute UID to create the attribute object for. |
pointer | to an attribute object |
<tt>nullptr</tt> | if the attribute UID does not exist. |
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::BindManagement::Server *,uint8_t)
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::BatchProgramManagement::IServer *,uint8_t)
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::AttributeReporting::Server *,uint8_t)
[in] | uid | attribute UID to create the attribute object for. |
nullptr
if the attribute UID does not exist.Create an attribute object that can hold the attribute with the given uid
. (HF::Core::BindManagement::Server *,uint8_t)
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::BatchProgramManagement::IServer *,uint8_t)
Create an attribute object that can hold the attribute with the given uid
. (HF::Core::AttributeReporting::Server *,uint8_t)
[in] | uid | attribute UID to create the attribute object for. |
pointer | to an attribute object |
<tt>nullptr</tt> | if the attribute UID does not exist. |
Definition at line 108 of file simple_humidity.h.
|
pure virtual |
Destroy the entries in the persistent storage, that refer to the the given address.
This method destroys the entries that refer to the address both in the source and in the destination address.
Common::Result::OK | and a copy of the destroyed entry if the entry was destroyed. |
Common::Result::FAIL_ARG | and nullptr otherwise. |
Implemented in HF::Core::BindManagement::Entries.
Common::Result HF::Core::BindManagement::Entries::destroy | ( | const Entry & | entry | ) |
Destroy the given entry
in the persistent storage.
[in] | entry | reference to the entry to erase. |
Common::Result::OK,if | the entry was destroyed. |
Common::Result::FAIL_ARG | otherwise. |
Referenced by HF::Core::BindManagement::Entries::destroy().
|
virtual |
Destroy the entries in the persistent storage, that refer to the the given address.
This method destroys the entries that refer to the address both in the source and in the destination address.
Common::Result::OK | and a copy of the destroyed entry if the entry was destroyed. |
Common::Result::FAIL_ARG | and nullptr otherwise. |
Implements HF::Core::BindManagement::IEntries.
|
inline |
Destroy the entries in the persistent storage, for which the given predicate function returns true
.
[in] | func | predicate to call for each entry to check if it should be deleted. |
Common::Result::OK | if at least one entry was destroyed. |
Common::Result::FAIL_ARG,otherwise. |
Definition at line 623 of file bind_management.h.
References HF::Core::BindManagement::Entries::db, HF::Core::BindManagement::Entries::destroy(), HF::Common::FAIL_ARG, and HF::Common::OK.
|
pure virtual |
Reference to the persistent storage implementation.
Implemented in HF::Core::BindManagement::Server< _Entries >, and HF::Core::BindManagement::Server< Entries >.
|
inlinevirtual |
Reference to the persistent storage implementation.
Implements HF::Core::BindManagement::IServer.
Definition at line 670 of file bind_management.h.
|
pure virtual |
Return the Bind entry for the given parameters.
[in] | source | source address of the device. |
[in] | destination | destination address of the device. |
[in] | itf | interface to bind. |
a | pointer to bind entry for the given parameters, |
nullptr | if bind entry does not exist. |
Implemented in HF::Core::BindManagement::Entries.
|
virtual |
Return the Bind entry for the given parameters.
[in] | source | source address of the device. |
[in] | destination | destination address of the device. |
[in] | itf | interface to bind. |
a | pointer to bind entry for the given parameters, |
nullptr | if bind entry does not exist. |
Implements HF::Core::BindManagement::IEntries.
std::pair<iterator, iterator> HF::Core::BindManagement::Entries::find | ( | Protocol::Address const & | source, |
Common::Interface const & | itf | ||
) | const |
Return a pair of iterators for the entries that match the given search criteria.
[in] | source | device address to search for. |
[in] | itf | interface id to search for. |
|
pure virtual |
Call the given function for all the entries with given source
address and for the given interface ifc
.
[in] | source | device address to search for. |
[in] | itf | interface id to search for. |
[in] | func | function to call for all the entries. |
Implemented in HF::Core::BindManagement::Entries.
|
virtual |
Call the given function for all the entries with given source
address and for the given interface ifc
.
[in] | source | device address to search for. |
[in] | itf | interface id to search for. |
[in] | func | function to call for all the entries. |
Implements HF::Core::BindManagement::IEntries.
|
inlinevirtual |
Read entries.
[in] | offset | start read at offset. |
[in] | count | number of entries to read. |
Implements HF::Core::SessionManagement::AbstractClient.
Definition at line 358 of file bind_management.h.
References HF::Interface::DEVICE_MANAGEMENT, and HF::Core::BindManagement::GET_ENTRIES_CMD.
std::ostream& operator<< | ( | std::ostream & | stream, |
const HF::Core::BindManagement::CMD | command | ||
) |
Convert the given command
into a string and write it to the given stream
.
[in] | stream | out stream to write the string to. |
[in] | command | role value to convert to a string. |
stream
std::ostream& operator<< | ( | std::ostream & | stream, |
const HF::Core::BindManagement::Attributes | attribute | ||
) |
Convert the given attribute
into a string and write it to the given stream
.
[in] | stream | out stream to write the string to. |
[in] | attribute | attribute value to convert to a string. |
stream
uint16_t HF::Core::BindManagement::Entry::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. |
void HF::Core::BindManagement::Client::remove | ( | const Protocol::Address & | source, |
const Protocol::Address & | destination, | ||
const Common::Interface & | itf | ||
) |
Send a REMOVE_BIND command.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to unbind between source and destination. |
|
pure virtual |
Remove a bind entry from the database.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to bind between source and destination. |
Implemented in HF::Core::BindManagement::AbstractServer.
|
virtual |
Remove a bind entry from the database.
[in] | source | the HAN-FUN source device. |
[in] | destination | the HAN-FUN destination device. |
[in] | itf | the interface to bind between source and destination. |
Implements HF::Core::BindManagement::IServer.
|
virtual |
This method is called when the response to a command is received.
[in] | cmd | the command that response refers to. |
[in] | response | the result of the command. |
|
inlinevirtual |
Send message msg
to the network address given by addr
.
[in] | addr | HF network address. |
[in] | message | pointer to the message to be sent to the network. |
Implements HF::Core::SessionManagement::AbstractClient.
Definition at line 395 of file bind_management.h.
References HF::Devices::AbstractDevice::send().
|
inlinevirtual |
Send message msg
to the network address given by addr
.
[in] | addr | HF network address. |
[in] | message | pointer to the message to be sent to the network. |
Implements HF::Core::SessionManagement::AbstractServer.
Definition at line 682 of file bind_management.h.
|
inline |
Reference to the session management API.
Definition at line 308 of file bind_management.h.
|
pure virtual |
Reference to the session management API.
Implemented in HF::Core::BindManagement::Server< _Entries >, and HF::Core::BindManagement::Server< Entries >.
|
inlinevirtual |
Reference to the session management API.
Implements HF::Core::BindManagement::IServer.
Definition at line 675 of file bind_management.h.
uint16_t HF::Core::BindManagement::Entry::size | ( | ) | const |
Number bytes needed to serialize the message.
|
virtual |
Return the number of entries in the container.
Implements HF::Common::IEntries< Entry >.
|
virtual |
Return a reference to the unit that this service belongs to.
This is the same reference as AbstractService::unit, but static casted to allow access to the the other interfaces.
Implements HF::Devices::Concentrator::AbstractBase.
uint16_t HF::Core::BindManagement::Entry::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. |
|
protected |
Bind entries database.
Definition at line 689 of file bind_management.h.
Protocol::Address HF::Core::BindManagement::Entry::destination |
Destination Address.
Definition at line 127 of file bind_management.h.
Common::Interface HF::Core::BindManagement::Entry::itf |
Destination Interface.
Definition at line 129 of file bind_management.h.
Protocol::Address HF::Core::BindManagement::Entry::source |
Source Address.
Definition at line 125 of file bind_management.h.