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

Parent class for all HF::Transport::Layer implementations. More...

#include <transport.h>

+ Inheritance diagram for HF::Transport::AbstractLayer:
+ Collaboration diagram for HF::Transport::AbstractLayer:

Public Member Functions

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

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 all HF::Transport::Layer implementations.

Definition at line 239 of file inc/hanfun/transport.h.

Member Function Documentation

◆ add()

void HF::Transport::AbstractLayer::add ( HF::Transport::Endpoint ep)
inlinevirtual

Add an entry to the list of end-points connected to the transport layer.

Parameters
[in]eppointer to the end-point to add.

Implements HF::Transport::Layer.

Definition at line 268 of file inc/hanfun/transport.h.

References endpoints.

Referenced by HF::Devices::Node::Transport::add(), and HF::Devices::Concentrator::Transport::add().

269  {
270  assert(ep != nullptr);
271  endpoints.push_front(ep);
272  }
Common::SimpleList< HF::Transport::Endpoint * > endpoints
List of registered end-points for this layer.
+ Here is the caller graph for this function:

◆ connected()

void HF::Transport::AbstractLayer::connected ( HF::Transport::Link link)
inline

Call the connected method for all the registered end-points with the given link as argument.

Parameters
[in]linkpointer to the link to call the connected method with.

Definition at line 342 of file inc/hanfun/transport.h.

References endpoints.

Referenced by HF::Devices::Node::Transport::add(), and HF::Devices::Concentrator::Transport::add().

343  {
344  assert(link != nullptr);
345 
346  /* *INDENT-OFF* */
347  std::for_each (endpoints.begin (), endpoints.end (),
348  [link](HF::Transport::Endpoint *ep)
349  {
350  ep->connected (link);
351  });
352  /* *INDENT-ON* */
353  }
This is the interface used by the transport layer to signal events comming in from the network...
Common::SimpleList< HF::Transport::Endpoint * > endpoints
List of registered end-points for this layer.
+ Here is the caller graph for this function:

◆ disconnected()

void HF::Transport::AbstractLayer::disconnected ( HF::Transport::Link link)
inline

Call the disconnected method for all the registered end-points with the given link as argument.

Parameters
[in]linkpointer to the link to call the disconnected method with.

Definition at line 361 of file inc/hanfun/transport.h.

References endpoints.

Referenced by HF::Devices::Node::Transport::remove().

362  {
363  assert(link != nullptr);
364 
365  /* *INDENT-OFF* */
366  std::for_each (endpoints.begin (), endpoints.end (),
367  [link](HF::Transport::Endpoint *ep)
368  {
369  ep->disconnected (link);
370  });
371  /* *INDENT-ON* */
372  }
This is the interface used by the transport layer to signal events comming in from the network...
Common::SimpleList< HF::Transport::Endpoint * > endpoints
List of registered end-points for this layer.
+ Here is the caller graph for this function:

◆ initialize()

void HF::Transport::AbstractLayer::initialize ( )
inlinevirtual

Initialize the associated transport layer.

This method should initialize the transport layer using it's default values.

Implements HF::Transport::Layer.

Reimplemented in HF::Application::Transport.

Definition at line 259 of file inc/hanfun/transport.h.

259 {}

◆ receive()

void HF::Transport::AbstractLayer::receive ( HF::Transport::Link link,
HF::Common::ByteArray payload 
)
inline

Receive the data in payload, coming in in the given link and deliver the decoded packet to all registered end-points.

Parameters
[in]linkpointer to the link the incoming data was received.
[in]payloadreference to the ByteArray containing the data received.

Definition at line 302 of file inc/hanfun/transport.h.

References endpoints, HF::Protocol::Packet::link, and HF::Protocol::Packet::unpack().

303  {
304  assert(link != nullptr);
305  Protocol::Packet *packet = new Protocol::Packet();
306  packet->link = link;
307 
308  uint16_t offset = packet->unpack(payload);
309 
310  /* *INDENT-OFF* */
311  std::for_each (endpoints.begin (), endpoints.end (),
312  [&packet, &payload, &offset](HF::Transport::Endpoint *ep)
313  {
314  ep->receive (*packet, payload, offset);
315  });
316  /* *INDENT-ON* */
317 
318  delete packet;
319  }
This is the interface used by the transport layer to signal events comming in from the network...
Common::SimpleList< HF::Transport::Endpoint * > endpoints
List of registered end-points for this layer.
+ Here is the call graph for this function:

◆ remove()

void HF::Transport::AbstractLayer::remove ( HF::Transport::Endpoint ep = nullptr)
inlinevirtual

Remove the entry in ep, from the list of end-points connected to the transport layer.

If ep is equal to nullptr then all end-points are removed.

Parameters
[in]eppointer to the end-point entry to remove or nullptr to remove all entries.

Implements HF::Transport::Layer.

Definition at line 283 of file inc/hanfun/transport.h.

References endpoints.

284  {
285  if (ep != nullptr)
286  {
287  endpoints.remove(ep);
288  }
289  else
290  {
291  endpoints.clear();
292  }
293  }
Common::SimpleList< HF::Transport::Endpoint * > endpoints
List of registered end-points for this layer.

◆ uid() [1/2]

const HF::UID::UID HF::Transport::AbstractLayer::uid ( ) const
inlinevirtual

Return the UID of the local device on this transport layer.

For example on an ULE device this would return the IPUI of the device.

Returns
the UID of the local device on this transport layer.

Implements HF::Transport::Layer.

Definition at line 321 of file inc/hanfun/transport.h.

References _uid.

322  {
323  return HF::UID::UID(_uid);
324  }
HF::UID::UID_T * _uid
UID associated with the local transport layer.
UID
Profiles UID&#39;s
Definition: profiles.h:60

◆ uid() [2/2]

void HF::Transport::AbstractLayer::uid ( HF::UID::UID_T _uid)
inline

Set the UID to the given value.

Parameters
[in]_uidpointer to the UID to use.

Definition at line 331 of file inc/hanfun/transport.h.

References _uid.

332  {
333  this->_uid = _uid;
334  }
HF::UID::UID_T * _uid
UID associated with the local transport layer.

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