HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
devices.h
Go to the documentation of this file.
1 // =============================================================================
15 // =============================================================================
16 #ifndef HF_DEVICES_H
17 #define HF_DEVICES_H
18 
19 #include "hanfun/common.h"
20 #include "hanfun/protocol.h"
21 
22 #include "hanfun/device.h"
23 
24 #include "hanfun/core.h"
29 
30 #if HF_GROUP_SUPPORT
31  #include "hanfun/core/group_table.h"
33 #endif
34 
35 #if HF_TIME_SUPPORT
36  #include "hanfun/core/time.h"
37 #endif
38 
39 #if HF_BATCH_PROGRAM_SUPPORT
41 #endif
42 
43 #if HF_EVENT_SCHEDULING_SUPPORT
45 #endif
46 
47 #if HF_WEEKLY_SCHEDULING_SUPPORT
49 #endif
50 
51 #include "hanfun/transport.h"
52 
53 namespace HF
54 {
58  namespace Devices
59  {
74  struct AbstractDevice: public IDevice
75  {
76  // =============================================================================
77  // IDevice API
78  // =============================================================================
79 
80  const IUnits &units() const
81  {
82  return _units;
83  }
84 
86  {
87  _units.push_front(unit);
88  }
89 
90  void remove(Units::IUnit *unit)
91  {
92  _units.remove(unit);
93  }
94 
95  Units::IUnit *unit(uint8_t id) const;
96 
97  void send(Protocol::Packet &packet);
98 
99  void receive(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset);
100 
101  void periodic(uint32_t time);
102 
103  protected:
104 
106  uint8_t next_reference;
107 
110 
113 
114  AbstractDevice():
115  next_reference(0)
116  {}
117 
118  // =============================================================================
119 
129  virtual Transport::Link *link(uint16_t addr) const = 0;
130 
139  virtual bool to_local(const Protocol::Packet &packet) const
140  {
141  return packet.destination.device == address();
142  }
143 
152  bool from_local(const Protocol::Packet &packet) const
153  {
154  return packet.source.device == address();
155  }
156 
165  bool from_remote(const Protocol::Packet &packet)
166  {
167  return !from_local(packet);
168  }
169 
176  {
177  return this->address() != Protocol::BROADCAST_ADDR;
178  }
179  };
180 
186  namespace Node
187  {
201  {
208  HF::Core::Unit0(device)
209  {}
210 
217 
224  };
225 
229  template<typename... ITF>
230  struct Unit0: public HF::Unit0<IUnit0, ITF...>
231  {
232  static_assert(std::is_base_of<HF::Core::DeviceManagement::Client,
233  typename HF::Unit0<IUnit0, ITF...>::DeviceMgt>::value,
234  "DeviceMgt must be of type HF::Core::DeviceManagement::Client");
235 
236  typedef std::tuple<ITF...> interfaces_t;
237 
238  typedef typename HF::Unit0<IUnit0, ITF...> _Parent;
239 
240  typedef typename _Parent::DeviceInfo DeviceInfo;
241  typedef typename _Parent::DeviceMgt DeviceMgt;
242  typedef typename _Parent::AttrReporting AttrReporting;
243 #if HF_GROUP_SUPPORT
244  typedef typename _Parent::GroupTable GroupTable;
245 #endif
246 #if HF_TIME_SUPPORT
247  typedef typename _Parent::Time Time;
248 #endif
249 #if HF_BATCH_PROGRAM_SUPPORT
250  typedef typename _Parent::BatchProgram BatchProgram;
251 #endif
252 #if HF_EVENT_SCHEDULING_SUPPORT
253  typedef typename _Parent::EventScheduling EventScheduling;
254 #endif
255 #if HF_WEEKLY_SCHEDULING_SUPPORT
256  typedef typename _Parent::WeeklyScheduling WeeklyScheduling;
257 #endif
258 
264  Unit0(IDevice &device):
265  HF::Unit0<IUnit0, ITF...>(device)
266  {}
267 
273  DeviceInfo *device_info() const
274  {
275  return _Parent::device_info();
276  }
277 
283  DeviceInfo *device_info()
284  {
285  return _Parent::device_info();
286  }
287 
293  AttrReporting *attribute_reporting() const
294  {
296  }
297 
303  AttrReporting *attribute_reporting()
304  {
306  }
307 
313  DeviceMgt *device_management()
314  {
316  }
317 
323  DeviceMgt *device_management() const
324  {
326  }
327 
328 #if HF_GROUP_SUPPORT
329 
334  GroupTable *group_table()
335  {
336  return _Parent::group_table();
337  }
338 
344  GroupTable *group_table() const
345  {
346  return _Parent::group_table();
347  }
348 #endif
349 #if HF_TIME_SUPPORT
350  Time *time()
351  {
352  return _Parent::time();
353  }
354 
355  Time *time() const
356  {
357  return _Parent::time();
358  }
359 #endif
360 
361 #if HF_BATCH_PROGRAM_SUPPORT
362  BatchProgram *batch_program()
363  {
364  return _Parent::batch_program();
365  }
366 
367  BatchProgram *batch_program() const
368  {
369  return _Parent::batch_program();
370  }
371 #endif
372 
373 #if HF_EVENT_SCHEDULING_SUPPORT
374  EventScheduling *event_scheduling()
375  {
376  return _Parent::event_scheduling();
377  }
378 
379  EventScheduling *event_scheduling() const
380  {
381  return _Parent::event_scheduling();
382  }
383 #endif
384 
385 #if HF_WEEKLY_SCHEDULING_SUPPORT
386  WeeklyScheduling *weekly_scheduling()
387  {
388  return _Parent::weekly_scheduling();
389  }
390 
391  WeeklyScheduling *weekly_scheduling() const
392  {
393  return _Parent::weekly_scheduling();
394  }
395 #endif
396  };
397 
401  typedef Unit0<Core::DeviceInformation::Server,
402  Core::DeviceManagement::Client,
403  Core::AttributeReporting::Server
404 #if HF_TIME_SUPPORT
406 #endif
407 #if HF_BATCH_PROGRAM_SUPPORT
409 #endif
410 #if HF_EVENT_SCHEDULING_SUPPORT
412 #endif
413 #if HF_WEEKLY_SCHEDULING_SUPPORT
415 #endif
416 #if HF_GROUP_SUPPORT
417  , Core::GroupTable::DefaultServer
418 #endif
420 
424  template<typename CoreServices = DefaultUnit0>
425  class Abstract: public AbstractDevice
426  {
427  public:
428 
429  // =============================================================================
430  // Transport::Endpoint API
431  // =============================================================================
432 
434  {
435  _link = link;
436  }
437 
439  {
440  if (_link == link)
441  {
442  _link = nullptr;
443  }
444  }
445 
447  uint16_t offset) _override
448  {
449  AbstractDevice::receive(packet, payload, offset);
450  }
451 
452  // =============================================================================
453  // IDevice API.
454  // =============================================================================
455 
456  uint16_t address() const _override
457  {
458  return unit0()->device_management()->address();
459  }
460 
461  CoreServices *unit0() const _override
462  {
463  return const_cast<CoreServices *>(&_unit0);
464  }
465 
466  protected:
467 
470 
472  CoreServices _unit0;
473 
474  Abstract(): _link(nullptr), _unit0(*this)
475  {}
476 
477  // =============================================================================
478 
479  HF::Transport::Link *link(uint16_t addr) const _override
480  {
481  UNUSED(addr);
482  return _link;
483  }
484 
493  bool to_local(const Protocol::Packet &packet) const _override
494  {
495  return AbstractDevice::to_local(packet) ||
496  // If we are unregistered only allow packets to unit 0.
497  (address() == Protocol::BROADCAST_ADDR && packet.destination.unit == 0);
498  }
499  };
500 
501  typedef Abstract<> Node;
502 
507  {
508  protected:
509 
512 
513  public:
514 
515  Transport():
516  link(nullptr)
517  {}
518 
519  void destroy()
520  {
521  remove((HF::Transport::Link *) nullptr);
522  }
523 
525  {
527 
528  if (link != nullptr)
529  {
530  ep->connected(link);
531  }
532  }
533 
541  {
542  assert(_link != nullptr);
543 
544  this->link = _link;
546  }
547 
556  void remove(HF::Transport::Link *_link = nullptr)
557  {
558  if ((_link == nullptr && this->link != nullptr) || (_link == this->link))
559  {
561  delete this->link;
562  this->link = nullptr;
563  }
564  }
565 
567 
579  HF::Transport::Link *find(uint16_t address)
580  {
581  UNUSED(address);
582  return link;
583  }
584  };
585 
588  } // namespace Node
589 
593  namespace Concentrator
594  {
608  {
615  HF::Core::Unit0(device)
616  {}
617 
624 
631 
632 #if HF_GROUP_SUPPORT
633 
638  virtual HF::Core::GroupManagement::IServer *group_management() = 0;
639 
645  virtual HF::Core::GroupManagement::IServer *group_management() const = 0;
646 #endif
647 
654 
661 
662  };
663 
667  template<typename... ITF>
668  struct Unit0: public HF::Unit0<IUnit0, ITF...>
669  {
670  static_assert(std::is_base_of<HF::Core::DeviceManagement::IServer,
671  typename HF::Unit0<IUnit0, ITF...>::DeviceMgt>::value,
672  "DeviceMgt must be of type HF::Core::DeviceManagement::IServer");
673 
674  typedef typename HF::Unit0<IUnit0, ITF...> _Parent;
675 
676  typedef typename _Parent::DeviceInfo DeviceInfo;
677  typedef typename _Parent::DeviceMgt DeviceMgt;
678  typedef typename _Parent::AttrReporting AttrReporting;
679 
680  typedef std::tuple<ITF...> interfaces_t;
681 
682 #if HF_GROUP_SUPPORT
683  typedef typename _Parent::GroupTable GroupTable;
684 
686  static constexpr uint8_t GROUP_MGT = _Parent::GROUP_MGT;
687 
688  typedef typename std::tuple_element<GROUP_MGT, interfaces_t>::type GroupMgt;
689 
690  static_assert(std::is_base_of<HF::Core::GroupManagement::IServer, GroupMgt>::value,
691  "GroupMgt must be of type HF::Core::GroupManagement::IServer");
692 #endif
693 #if HF_TIME_SUPPORT
694  typedef typename _Parent::Time Time;
695 #endif
696 #if HF_BATCH_PROGRAM_SUPPORT
697  typedef typename _Parent::BatchProgram BatchProgram;
698 #endif
699 #if HF_EVENT_SCHEDULING_SUPPORT
700  typedef typename _Parent::EventScheduling EventScheduling;
701 #endif
702 #if HF_WEEKLY_SCHEDULING_SUPPORT
703  typedef typename _Parent::WeeklyScheduling WeeklyScheduling;
704 #endif
705  static constexpr uint8_t BIND_MGT = _Parent::BIND_MGT;
707 
708  typedef typename std::tuple_element<BIND_MGT, interfaces_t>::type BindMgt;
709 
710  static_assert(std::is_base_of<HF::Core::BindManagement::IServer, BindMgt>::value,
711  "BindMgt must be of type HF::Core::BindManagement::IServer");
712 
718  Unit0(HF::IDevice &device):
719  HF::Unit0<IUnit0, ITF...>(device)
720  {}
721 
722  BindMgt *bind_management() const
723  {
724  return _Parent::template get<BindMgt, BIND_MGT>();
725  }
726 
727  BindMgt *bind_management()
728  {
729  return _Parent::template get<BindMgt, BIND_MGT>();
730  }
731 
732  DeviceInfo *device_info() const
733  {
734  return _Parent::device_info();
735  }
736 
737  DeviceInfo *device_info()
738  {
739  return _Parent::device_info();
740  }
741 
742  AttrReporting *attribute_reporting() const
743  {
745  }
746 
747  AttrReporting *attribute_reporting()
748  {
750  }
751 
752 #if HF_GROUP_SUPPORT
753  GroupMgt *group_management() const
754  {
755  return _Parent::template get<GroupMgt, GROUP_MGT>();
756  }
757 
758  GroupMgt *group_management()
759  {
760  return _Parent::template get<GroupMgt, GROUP_MGT>();
761  }
762 
763  GroupTable *group_table()
764  {
765  return _Parent::group_table();
766  }
767 
768  GroupTable *group_table() const
769  {
770  return _Parent::group_table();
771  }
772 #endif
773 
774 #if HF_TIME_SUPPORT
775  Time *time()
776  {
777  return _Parent::time();
778  }
779 
780  Time *time() const
781  {
782  return _Parent::time();
783  }
784 #endif
785 #if HF_BATCH_PROGRAM_SUPPORT
786  BatchProgram *batch_program()
787  {
788  return _Parent::batch_program();
789  }
790 
791  BatchProgram *batch_program() const
792  {
793  return _Parent::batch_program();
794  }
795 #endif
796 #if HF_EVENT_SCHEDULING_SUPPORT
797  EventScheduling *event_scheduling()
798  {
799  return _Parent::event_scheduling();
800  }
801 
802  EventScheduling *event_scheduling() const
803  {
804  return _Parent::event_scheduling();
805  }
806 #endif
807 #if HF_WEEKLY_SCHEDULING_SUPPORT
808  WeeklyScheduling *weekly_scheduling()
809  {
810  return _Parent::weekly_scheduling();
811  }
812 
813  WeeklyScheduling *weekly_scheduling() const
814  {
815  return _Parent::weekly_scheduling();
816  }
817 #endif
818 
819  };
820 
824  typedef Unit0<Core::DeviceInformation::Server,
825  Core::DeviceManagement::DefaultServer,
826  Core::AttributeReporting::Server,
827 #if HF_TIME_SUPPORT
828  Core::Time::Server,
829 #endif
830 #if HF_BATCH_PROGRAM_SUPPORT
832 #endif
833 #if HF_EVENT_SCHEDULING_SUPPORT
835 #endif
836 #if HF_WEEKLY_SCHEDULING_SUPPORT
838 #endif
839 #if HF_GROUP_SUPPORT
840  Core::GroupTable::DefaultServer,
841  Core::GroupManagement::DefaultServer,
842 #endif
843  Core::BindManagement::DefaultServer
845 
851  {
852  public:
853 
854  // =============================================================================
855  // IDevice API.
856  // =============================================================================
857 
858  uint16_t address() const
859  {
860  return 0;
861  }
862 
863  // =============================================================================
864  // Transport::Endpoint API
865  // =============================================================================
866 
868 
870 
871  void receive(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset);
872 
873  virtual ~AbstractBase() {}
874 
875  protected:
876 
878  Common::SimpleList<Transport::Link *> _links;
879 
880  // =============================================================================
881 
882  HF::Transport::Link *link(uint16_t addr) const;
883 
891  virtual void route_packet(Protocol::Packet &packet, Common::ByteArray &payload,
892  uint16_t offset);
893 
899  virtual Concentrator::IUnit0 *unit0() const = 0;
900  };
901 
905  template<typename CoreServices = DefaultUnit0>
906  class Abstract: public AbstractBase
907  {
908  public:
909 
910  CoreServices *unit0() const
911  {
912  return const_cast<CoreServices *>(&_unit0);
913  }
914 
915  protected:
916 
917  CoreServices _unit0;
918 
919  Abstract(): AbstractBase(), _unit0(*this)
920  {}
921  };
922 
923  typedef Abstract<> Concentrator;
924 
930  {
931  protected:
932 
934  Common::SimpleList<HF::Transport::Link *> links;
935 
936  public:
937 
938  virtual ~Transport()
939  {
940  destroy();
941  }
942 
943  void destroy();
944 
946  {
948  /* *INDENT-OFF* */
949  std::for_each(links.begin(), links.end(), [ep](HF::Transport::Link *link)
950  {
951  ep->connected (link);
952  });
953  /* *INDENT-ON* */
954  }
955 
963  {
964  assert(link != nullptr);
965 
966  links.push_front(link);
968  }
969 
978  void remove(HF::Transport::Link *link = nullptr);
979 
981 
991  HF::Transport::Link *find(uint16_t address);
992  };
993 
996  } // namespace Concentrator
997 
998  } // namespace Devices
999 
1000 } // namespace HF
1001 
1002 #endif /* HF_DEVICES_H */
Interface of Unit 0 for Node devices.
Definition: devices.h:200
This file contains the definitions for the Event Scheduling service.
IUnit0(HF::IDevice &device)
Constructor.
Definition: devices.h:207
void connected(HF::Transport::Link *link)
Callback to report that a new transport link was been created to a remote device. ...
HF::Transport::Link * _link
Link to the be used when sending packets to the network.
Definition: devices.h:469
This class provides support for generating a response when a response is required from an incoming me...
Definition: protocol.h:421
Unit0(IDevice &device)
Constructor.
Definition: devices.h:264
virtual HF::Core::BindManagement::IServer * bind_management()=0
Return a pointer to unit 0 bind management service.
This represent the special unit with ID/UID = 0.
Definition: core.h:67
DeviceMgt * device_management() const
Get the pointer to the node&#39;s Device Management service.
Definition: devices.h:323
static constexpr uint8_t BIND_MGT
Group Management service index.
Definition: devices.h:706
DeviceInfo * device_info() const
Device Information service.
Definition: core.h:362
This file contains the definitions for the Time service.
Parent class for transport layer implementations on a HAN-FUN Concentrator device.
Definition: devices.h:929
This file contains the definitions for the Weekly Scheduling service.
Server< Entries< Day > > DefaultServer
Weekly Scheduling Service : Server side with default persistence implementation.
void add(HF::Transport::Endpoint *ep)
Register the given Endpoint to receive events.
Definition: devices.h:524
virtual HF::Core::DeviceManagement::Client * device_management()=0
Get the pointer to the node&#39;s Device Management service.
DeviceInfo * device_info() const
Get the pointer to the node&#39;s Device Information service.
Definition: devices.h:273
virtual HF::Core::DeviceManagement::IServer * device_management()=0
Return a pointer to unit 0 device management service.
Common::SimpleList< HF::Transport::Link * > links
List of links present in the transport layer.
Definition: devices.h:934
bool is_registered()
Check if the device has a valid, i.e.
Definition: devices.h:175
This file contains the common defines for the HAN-FUN library.
void connected(HF::Transport::Link *link) _override
Callback to report that a new transport link was been created to a remote device. ...
Definition: devices.h:433
Units::IUnit * unit(uint8_t id) const
Return pointer to the unit with the given id.
Unit list type.
Definition: device.h:104
This file contains the forward declarations of the core services and interfaces implementing classes...
AttrReporting * attribute_reporting() const
Attribute Reporting service.
Definition: core.h:402
Helper template class used to define custom Unit 0 for devices.
Definition: core.h:264
HF::Transport::Link * link
Pointer to the link used to send packets to the network.
Definition: devices.h:511
Server< Entries< Interval > > DefaultServer
Event Scheduling Service : Server side with default persistence implementation.
constexpr uint16_t BROADCAST_ADDR
HAN-FUN Broadcast - device address.
Definition: protocol.h:45
bool to_local(const Protocol::Packet &packet) const _override
Check if an incoming packet is for the node.
Definition: devices.h:493
void add(HF::Transport::Endpoint *ep)
Add an entry to the list of end-points connected to the transport layer.
Device Management interface : Client side.
void send(Protocol::Packet &packet)
Send given packet into the HAN-FUN network.
This file contains the definitions for the HAN-FUN protocol messages.
Helper template to declare a Batch Program server with custom entries backend.
Unit0< Core::DeviceInformation::Server, Core::DeviceManagement::DefaultServer, Core::AttributeReporting::Server, Core::BindManagement::DefaultServer > DefaultUnit0
Unit0 using default classes to provide the core services.
Definition: devices.h:844
Template to create Unit 0 for HAN-FUN node devices.
Definition: devices.h:230
virtual bool to_local(const Protocol::Packet &packet) const
Check if the given packet is for this device.
Definition: devices.h:139
void disconnected(HF::Transport::Link *link)
Call the disconnected method for all the registered end-points with the given link as argument...
This is the parent class for the HAN-FUN Concentrator devices implementation.
Definition: devices.h:850
void add(Units::IUnit *unit)
Add unit to devices unit lists.
Definition: devices.h:85
void receive(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Callback to deliver a packet received from the transport layer.
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-po...
Definition: devices.h:540
This file contains the definitions for the Group Management service.
uint16_t address() const _override
Return the device address on the HAN-FUN network, when the device is registered, or HF_BROADCAST_ADDR...
Definition: devices.h:456
This class represents the interface common to all HAN-FUN devices.
Definition: device.h:99
DeviceInfo * device_info()
Get the pointer to the node&#39;s Device Information service.
Definition: devices.h:283
virtual Transport::Link * link(uint16_t addr) const =0
Return the link that can be used to send a packet to the device with the given address.
DeviceMgt * device_management()
Get the pointer to the node&#39;s Device Management service.
Definition: devices.h:313
Unit0< Core::DeviceInformation::Server, Core::DeviceManagement::Client, Core::AttributeReporting::Server > DefaultUnit0
Unit0 using default classes to provide the core services for node devices.
Definition: devices.h:419
DeviceMgt * device_management() const
Device Management service.
Definition: core.h:382
IUnit0(HF::IDevice &device)
Constructor.
Definition: devices.h:614
Address destination
Destination Address.
Definition: protocol.h:301
This file contains the definitions for the core Attribute Reporting Service in HAN-FUN.
virtual uint16_t address() const =0
Return the device address on the HAN-FUN network, when the device is registered, or HF_BROADCAST_ADDR...
void periodic(uint32_t time)
Handle periodic processing.
void receive(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Callback to deliver a packet received from the transport layer.
HF::Transport::Link * find(uint16_t address)
Find the link used to send messages to the HAN-FUN device with the given address. ...
Definition: devices.h:579
Common::SimpleList< Transport::Link * > _links
List of links present in this concentrator.
Definition: devices.h:878
Unit 0 interface API for HAN-FUN Concentrators.
Definition: devices.h:607
virtual Concentrator::IUnit0 * unit0() const =0
Get the unit 0 used by this concentrator device.
This file contains the definition of the transport layer API for the HAN-FUN common implementation...
uint16_t address() const
Return the device address on the HAN-FUN network, when the device is registered, or HF_BROADCAST_ADDR...
Definition: devices.h:858
Parent class for transport layer implementations on a HAN-FUN Node.
Definition: devices.h:506
void destroy()
Free the system resources associated with this transport layer.
Definition: devices.h:519
Template for HAN-FUN concentrator devices.
Definition: devices.h:906
void connected(HF::Transport::Link *link)
Call the connected method for all the registered end-points with the given link as argument...
IUnits _units
List containing pointers to the units present in the device.
Definition: devices.h:109
This class represents a byte array.
AttrReporting * attribute_reporting() const
Get the pointer to the node&#39;s Attribute Reporting service.
Definition: devices.h:293
void disconnected(HF::Transport::Link *link)
Callback to the report that the given transport link no longer is valid and MUST not be used to send ...
This file contains the definitions for the Batch Program Management interface.
CoreServices * unit0() const
Get the unit 0 used by this concentrator device.
Definition: devices.h:910
Template to create Unit0 for HAN-FUN concentrator devices.
Definition: devices.h:668
AttrReporting * attribute_reporting()
Get the pointer to the node&#39;s Attribute Reporting service.
Definition: devices.h:303
Address source
Source Address.
Definition: protocol.h:300
This file contains the definitions for the core Bind Management Interface of the HAN-FUN protocol...
void remove(HF::Transport::Endpoint *ep=nullptr)
Remove the entry in ep, from the list of end-points connected to the transport layer.
CoreServices _unit0
Unit 0 implementation this device will use.
Definition: devices.h:472
HAN-FUN device Unit 0 common API.
Definition: device.h:115
IDevice & device() const
Reference to the device this unit belongs to.
Definition: units.h:107
This file contains the definitions for the core Device Management Interface of the HAN-FUN protocol...
void add(HF::Transport::Endpoint *ep)
Register the given Endpoint to receive events.
Definition: devices.h:945
bool from_remote(const Protocol::Packet &packet)
Check if the given packet is from the a remote device.
Definition: devices.h:165
HAN-FUN Protocol Packet.
Definition: protocol.h:298
Bind Management interface : Server side API.
This file contains the definition for the core Device Information interface of the HAN-FUN protocol...
Time Service : Server side implementation.
Definition: time.h:220
HF::Transport::Link * link(uint16_t addr) const
Return the link that can be used to send a packet to the device with the given address.
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-po...
Definition: devices.h:962
This class represents the interface implemented by all HAN-FUN units.
Definition: units.h:48
Unit0(HF::IDevice &device)
Constructor.
Definition: devices.h:718
uint16_t device
Device Address.
Definition: protocol.h:204
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.
void disconnected(HF::Transport::Link *link) _override
Callback to the report that the given transport link no longer is valid and MUST not be used to send ...
Definition: devices.h:438
Parent class for all HF::Transport::Layer implementations.
CoreServices * unit0() const _override
Return pointer to the unit 0 for this device.
Definition: devices.h:461
Time
This represents the type of time that is associated with a time measurement.
This class provides the basic implementation for the Device&#39;s interface.
Definition: devices.h:74
const IUnits & units() const
Return the list of units registered in this device.
Definition: devices.h:80
This file contains the declaration of the API for a HAN-FUN device.
Protocol::Filters::ResponseRequired response_filter
Support for generating missing responses for messages.
Definition: devices.h:112
virtual void connected(Link *link)=0
Callback to report that a new transport link was been created to a remote device. ...
This file contains the definitions for the Group Table service.
virtual void route_packet(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Route the given packet to the corresponding device.
bool from_local(const Protocol::Packet &packet) const
Check if the given packet is from the local device.
Definition: devices.h:152
uint8_t next_reference
Last reference number used to send a packet.
Definition: devices.h:106
Event Scheduling Service : Server side implementation.
Group Management Service : Server side implementation.
This is the interface used by the transport layer to signal events comming in from the network...
Device Management interface : Server side API.
void destroy()
Free the system resources associated with this transport layer.
Template for declaring HAN-FUN node devices.
Definition: devices.h:425
Scheduling Service : Server side implementation.
HF::Transport::Link * find(uint16_t address)
Find the link used to send messages to the HAN-FUN device with the given address. ...
Bind Management service index.
Definition: core.h:296
void receive(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset) _override
Callback to deliver a packet received from the transport layer.
Definition: devices.h:446
HF::Transport::Link * link(uint16_t addr) const _override
Return the link that can be used to send a packet to the device with the given address.
Definition: devices.h:479
Top-level namespace for the HAN-FUN library.
Definition: attributes.h:22