openD unified API  1.0.0
opend_hanfunlib_api_pp.h
Go to the documentation of this file.
1 
29 #ifndef __OPEND_HANFUNLIB_API_PP_H__
30 #define __OPEND_HANFUNLIB_API_PP_H__
31 
32 #include "opend_hanfun_api.h"
33 
37 struct DeviceManagementNode: public HF::Core::DeviceManagement::Client {
39  HF::Core::DeviceManagement::Client(unit0)
40  {}
41 
47  void register_device();
48 
56  void registered(HF::Core::DeviceManagement::RegisterResponse &response);
57 
58  using HF::Core::DeviceManagement::Client::address;
59 
68  void address(uint16_t addr);
69 };
70 
74 struct Unit0Node: public HF::Devices::Node::Unit0<HF::Core::DeviceInformation::Server,
75  DeviceManagementNode,
76  HF::Core::AttributeReporting::Server>
77 {
78  Unit0Node(HF::IDevice &device) :
79  HF::Devices::Node::Unit0<HF::Core::DeviceInformation::Server, DeviceManagementNode,
80  HF::Core::AttributeReporting::Server>(device)
81  {}
82 };
83 
87 struct SimpleSwitch: public HF::Units::Unit<HF::Profiles::SimpleOnOffSwitch> {
88  SimpleSwitch(uint8_t id, HF::IDevice &device) :
89  HF::Units::Unit<HF::Profiles::SimpleOnOffSwitch>(id, device)
90  {}
91 };
92 
96 struct SimpleReed: public HF::Units::Unit<HF::Profiles::MotionDetector> {
97  SimpleReed(uint8_t id, HF::IDevice &device) :
98  HF::Units::Unit<HF::Profiles::MotionDetector>(id, device)
99  {}
100 };
101 
105 class SimpleLight: public HF::Units::Unit<HF::Profiles::SimpleLight>
106 {
107  public:
108 
109  SimpleLight (uint8_t id, HF::IDevice &device) :
110  HF::Units::Unit<HF::Profiles::SimpleLight>(id, device)
111  {}
112 
120  void on (HF::Protocol::Address &source);
121 
129  void off (HF::Protocol::Address &source);
130 
138  void toggle (HF::Protocol::Address &source);
139 };
140 
144 struct Device: public HF::Devices::Node::Abstract<Unit0Node>
145 {
146  public:
147 
155  static Device * instance();
156 
157  virtual ~Device ()
158  {}
159 
167  bool is_registered ();
168 
178  void receive (HF::Protocol::Packet &packet, HF::Common::ByteArray &payload, size_t offset);
179 
187  void connected (HF::Transport::Link *link);
188 
196  void address (uint16_t address)
197  {
198  this->unit0()->device_management()->address(address);
199  }
200 
201  using HF::Devices::Node::Abstract<Unit0Node>::address;
202 
210  void send (HF::Protocol::Packet &packet);
211 
212  private:
213 
214  /* Private constructor for singleton object. */
215  Device () :HF::Devices::Node::Abstract<Unit0Node>()
216  {}
217 };
218 
228 
240 
243 #endif /* __OPEND_HANFUNLIB_API_PP_H__ */
openD_status_t
Definition: opend_dataTypes.h:62
Definition: opend_hanfunlib_api_pp.h:87
SimpleLight(uint8_t id, HF::IDevice &device)
Definition: opend_hanfunlib_api_pp.h:109
Definition: opend_hanfunlib_api_pp.h:37
DeviceManagementNode(HF::Core::Unit0 &unit0)
Definition: opend_hanfunlib_api_pp.h:38
openD_status_t opend_hanfun_registerDevice()
openD HANFUN register device.
Definition: opend_hanfunlib_api_pp.h:105
SimpleReed(uint8_t id, HF::IDevice &device)
Definition: opend_hanfunlib_api_pp.h:97
void register_device()
Register device request.
enum openD_hanfunApi_profile openD_hanfunApi_profile_t
Unit0Node(HF::IDevice &device)
Definition: opend_hanfunlib_api_pp.h:78
openD HAN-FUN API.
void registered(HF::Core::DeviceManagement::RegisterResponse &response)
Response of register request.
virtual ~Device()
Definition: opend_hanfunlib_api_pp.h:157
Definition: opend_hanfun_api_fp.h:35
openD_status_t opend_hanfun_createProfile(openD_hanfunApi_profile_t opend_profile, uint8_t id)
openD HANFUN create profile.
Definition: opend_hanfunlib_api_pp.h:144
void address(uint16_t addr)
Set the HANFUN address associated with this device.
HF::Devices::Concentrator::Unit0< HF::Core::DeviceInformation::Server, DeviceManagement::Server, HF::Core::AttributeReporting::Server, BindManagement::Server > Unit0
Definition: opend_hanfun_api_fp.h:247
Definition: opend_hanfunlib_api_pp.h:74
SimpleSwitch(uint8_t id, HF::IDevice &device)
Definition: opend_hanfunlib_api_pp.h:88
void address(uint16_t address)
Address of the node device.
Definition: opend_hanfunlib_api_pp.h:196
Definition: opend_hanfunlib_api_pp.h:96