HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
rssi.h
Go to the documentation of this file.
1 // =============================================================================
15 // =============================================================================
16 
17 #ifndef HF_CORE_RSSI_H
18 #define HF_CORE_RSSI_H
19 
20 #include "hanfun/protocol.h"
21 #include "hanfun/core.h"
22 
23 namespace HF
24 {
25  namespace Core
26  {
27  // Forward declaration.
28  namespace RSSI
29  {
30  class Server;
31  }
32 
48 
52  namespace RSSI
53  {
62  typedef enum _Attributes
64  {
65  RSSI_ATTR = 1,
66  __LAST_ATTR__ = RSSI_ATTR
67  } Attributes;
68 
69  // =============================================================================
70  // Attribute Helper classes
71  // =============================================================================
72 
76  struct Value: public HF::Attributes::Attribute<int8_t>
77  {
78  static constexpr uint8_t ID = RSSI_ATTR;
79  static constexpr bool WRITABLE = false;
80 
81  Value(int8_t value = 0, HF::Interface *owner = nullptr):
82  Attribute<int8_t>(HF::Interface::RSSI, ID, owner, value, WRITABLE)
83  {}
84  };
85 
97 
103  struct Base: public Interfaces::Interface<HF::Interface::RSSI>
104  {
105  protected:
106 
108  Base(): Interfaces::Interface<HF::Interface::RSSI>() {}
109  };
110 
116  class Server: public Interfaces::InterfaceRole<RSSI::Base, HF::Interface::SERVER_ROLE>
117  {
118  protected:
119 
120  int8_t _value;
121 
122  public:
123 
125  Server(): Interfaces::InterfaceRole<RSSI::Base, HF::Interface::SERVER_ROLE>() {}
126 
128  virtual ~Server() {}
129 
130  // =============================================================================
131  // Get/Set API.
132  // =============================================================================
133 
139  int8_t value() const;
140 
146  void value(int8_t __value);
147 
148  // =============================================================================
149  // Attribute API.
150  // =============================================================================
151 
152  HF::Attributes::IAttribute *attribute(uint8_t uid);
153 
154  HF::Attributes::UIDS attributes(uint8_t pack_id =
156 
157  };
158 
164  struct Client: public Interfaces::InterfaceRole<RSSI::Base, HF::Interface::CLIENT_ROLE>
165  {
167 
168  virtual ~Client() {}
169  };
170 
173  } // namespace RSSI
174 
175  } // namespace Core
176 
177 } // namespace HF
178 
184 // =============================================================================
185 // Stream Helpers
186 // =============================================================================
187 
188 
197 std::ostream &operator<<(std::ostream &stream,
198  const HF::Core::RSSI::Attributes attribute);
201 #endif /* HF_CORE_RSSI_H */
RSSI Interfaces::Interface : Server side implementation.
Definition: rssi.h:116
static constexpr bool WRITABLE
Attribute Read/Write.
Definition: rssi.h:79
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::RSSI::Ser...
List of attributes UIDs.
Definition: attributes.h:176
int8_t value() const
Get the RSSI for the RSSI server.
Return all mandatory attributes for the interface.
Definition: attributes.h:842
RSSI Interfaces::Interface : Parent.
Definition: rssi.h:103
This file contains the forward declarations of the core services and interfaces implementing classes...
Helper class template for parent class implementation of the interfaces.
Definition: interface.h:371
RSSI attribute UID.
Definition: rssi.h:65
Base()
Constructor.
Definition: rssi.h:108
RSSI Interfaces::Interface : Client side implementation.
Definition: rssi.h:164
This file contains the definitions for the HAN-FUN protocol messages.
std::ostream & operator<<(std::ostream &stream, const HF::Core::RSSI::Attributes attribute)
Convert the given attribute into a string and write it to the given stream.
HF::Interface const * owner() const
Definition: attributes.h:414
Helper class to handle the RSSI attribute for the RSSI interface.
Definition: rssi.h:76
Server()
Constructor.
Definition: rssi.h:125
static constexpr uint8_t ID
Attribute UID.
Definition: rssi.h:78
virtual ~Server()
Destructor.
Definition: rssi.h:128
Interface/Service Attribute API.
Definition: attributes.h:44
Helper class template for implementing a given interface role.
Definition: interface.h:394
Helper template class to declare an attribute with the given T type.
Definition: attributes.h:349
Attribute(const uint16_t interface, const uint8_t uid, const HF::Interface *__owner, int8_t data, bool writable=false)
Attribute template constructor.
Definition: attributes.h:360
int8_t _value
RSSI.
Definition: rssi.h:120
RSSI interface UID.
Definition: interface.h:74
Common interface for all Interfaces.
Definition: interface.h:43
Attributes
Attributes.
Definition: rssi.h:63
HF::Attributes::IAttribute * create_attribute(HF::Core::AttributeReporting::IServer *server, uint8_t uid)
Create an attribute object that can hold the attribute with the given uid.
Top-level namespace for the HAN-FUN library.
Definition: attributes.h:22