HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Devices::Node::Transport Class Reference

Parent class for transport layer implementations on a HAN-FUN Node. More...

#include <devices.h>

+ Inheritance diagram for HF::Devices::Node::Transport:
+ Collaboration diagram for HF::Devices::Node::Transport:

Public Member Functions

void destroy ()
 Free the system resources associated with this transport layer.
 
void add (HF::Transport::Endpoint *ep)
 Register the given Endpoint to receive events. More...
 
void add (HF::Transport::Link *_link)
 Add the given link to the list of known links and call the connected method for all registered end-points. More...
 
void remove (HF::Transport::Link *_link=nullptr)
 Call the disconnected method for all registered end-points with the given _link and remove it from list of known links. More...
 
HF::Transport::Linkfind (uint16_t address)
 Find the link used to send messages to the HAN-FUN device with the given address. More...
 
- Public Member Functions inherited from HF::Transport::AbstractLayer
void initialize ()
 Initialize the associated transport layer. More...
 
void destroy ()
 Free the system resources associated with this transport layer.
 
void add (HF::Transport::Endpoint *ep)
 Add an entry to the list of end-points connected to the transport layer. More...
 
void remove (HF::Transport::Endpoint *ep=nullptr)
 Remove the entry in ep, from the list of end-points connected to the transport layer. More...
 
void receive (HF::Transport::Link *link, HF::Common::ByteArray &payload)
 Receive the data in payload, coming in in the given link and deliver the decoded packet to all registered end-points. More...
 
const HF::UID::UID uid () const
 Return the UID of the local device on this transport layer. More...
 
void uid (HF::UID::UID_T *_uid)
 Set the UID to the given value. More...
 
void connected (HF::Transport::Link *link)
 Call the connected method for all the registered end-points with the given link as argument. More...
 
void disconnected (HF::Transport::Link *link)
 Call the disconnected method for all the registered end-points with the given link as argument. More...
 
Commands

Protected Attributes

HF::Transport::Linklink
 Pointer to the link used to send packets to the network.
 
- Protected Attributes inherited from HF::Transport::AbstractLayer
Common::SimpleList< HF::Transport::Endpoint * > endpoints
 List of registered end-points for this layer.
 
HF::UID::UID_T_uid
 UID associated with the local transport layer.
 

Detailed Description

Parent class for transport layer implementations on a HAN-FUN Node.

Definition at line 506 of file devices.h.

Member Function Documentation

◆ add() [1/2]

void HF::Devices::Node::Transport::add ( HF::Transport::Endpoint ep)
inlinevirtual

Register the given Endpoint to receive events.

This should be possible to register multiple end-points, to the transport layer.

Parameters
[in]eppointer to the end-point to register in the transport layer.

Implements HF::Transport::Layer.

Definition at line 524 of file devices.h.

References HF::Transport::AbstractLayer::add(), HF::Transport::Endpoint::connected(), and link.

525  {
527 
528  if (link != nullptr)
529  {
530  ep->connected(link);
531  }
532  }
HF::Transport::Link * link
Pointer to the link used to send packets to the network.
Definition: devices.h:511
void add(HF::Transport::Endpoint *ep)
Add an entry to the list of end-points connected to the transport layer.
virtual void connected(Link *link)=0
Callback to report that a new transport link was been created to a remote device. ...
+ Here is the call graph for this function:

◆ add() [2/2]

void HF::Devices::Node::Transport::add ( HF::Transport::Link _link)
inline

Add the given link to the list of known links and call the connected method for all registered end-points.

Parameters
[in]_linkpointer to the link to add.

Definition at line 540 of file devices.h.

References HF::Transport::AbstractLayer::connected().

541  {
542  assert(_link != nullptr);
543 
544  this->link = _link;
546  }
HF::Transport::Link * link
Pointer to the link used to send packets to the network.
Definition: devices.h:511
void connected(HF::Transport::Link *link)
Call the connected method for all the registered end-points with the given link as argument...
+ Here is the call graph for this function:

◆ find()

HF::Transport::Link* HF::Devices::Node::Transport::find ( uint16_t  address)
inline

Find the link used to send messages to the HAN-FUN device with the given address.

Note
in the nodes there is only one link as all messages are sent to the base.
Parameters
[in]addressthe HAN-FUN address to find the link for.
Returns
a pointer to the link for the given address or nullptr if no link exists for the given address.

Definition at line 579 of file devices.h.

References link, and UNUSED.

580  {
581  UNUSED(address);
582  return link;
583  }
HF::Transport::Link * link
Pointer to the link used to send packets to the network.
Definition: devices.h:511
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.

◆ remove()

void HF::Devices::Node::Transport::remove ( HF::Transport::Link _link = nullptr)
inline

Call the disconnected method for all registered end-points with the given _link and remove it from list of known links.

If _link is nullptr, then remove all known links.

Parameters
[in]_linkpointer to the link to remove.

Definition at line 556 of file devices.h.

References HF::Transport::AbstractLayer::disconnected(), and link.

557  {
558  if ((_link == nullptr && this->link != nullptr) || (_link == this->link))
559  {
561  delete this->link;
562  this->link = nullptr;
563  }
564  }
HF::Transport::Link * link
Pointer to the link used to send packets to the network.
Definition: devices.h:511
void disconnected(HF::Transport::Link *link)
Call the disconnected method for all the registered end-points with the given link as argument...
+ Here is the call graph for this function:

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