BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
JablotronGadget.h
1 #pragma once
2 
3 #include <list>
4 #include <string>
5 #include <vector>
6 
7 #include <Poco/Timespan.h>
8 
9 #include "model/ModuleType.h"
10 #include "model/RefreshTime.h"
11 #include "model/SensorValue.h"
12 #include "jablotron/JablotronReport.h"
13 
14 namespace BeeeOn {
15 
21 public:
22  enum Type {
23  NONE = -1,
24  AC88,
25  JA80L,
26  JA81M,
27  JA82SH,
28  JA83M,
29  JA83P,
30  JA85ST,
31  RC86K,
32  TP82N,
33  };
34 
40  struct Info {
41  const uint32_t firstAddress;
42  const uint32_t lastAddress;
43  const Type type;
44  const RefreshTime refreshTime;
45  const std::list<ModuleType> modules;
46 
47  operator bool() const;
48  bool operator !() const;
49  std::string name() const;
50 
55  std::vector<SensorValue> parse(const JablotronReport &report) const;
56 
60  static Info resolve(const uint32_t address);
61 
66  static uint32_t primaryAddress(const uint32_t address);
67 
72  static uint32_t secondaryAddress(const uint32_t address);
73  };
74 
76  const unsigned int slot,
77  const uint32_t address,
78  const Info &info);
79 
80  unsigned int slot() const;
81  uint32_t address() const;
82  const Info &info() const;
83 
88  bool isSecondary() const;
89 
90  std::string toString() const;
91 
92 private:
93  const unsigned int m_slot;
94  const uint32_t m_address;
95  const Info m_info;
96 
97  static const std::vector<Info> GADGETS;
98 };
99 
100 }
Report with data coming from a sensor. Each report comes in format [AAAAAAAA] TYPE PAYLOAD...
Definition: JablotronReport.h:13
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.h:24
std::vector< SensorValue > parse(const JablotronReport &report) const
Parses the data payload of the given report and converts it into BeeeOn-specific data format...
Definition: JablotronGadget.cpp:129
static uint32_t secondaryAddress(const uint32_t address)
Definition: JablotronGadget.cpp:213
Information about a Jablotron Gadget device type. Gadget types are distinguished by their address...
Definition: JablotronGadget.h:40
static uint32_t primaryAddress(const uint32_t address)
Definition: JablotronGadget.cpp:205
bool isSecondary() const
Definition: JablotronGadget.cpp:246
Representation of a real Jablotron Gadget registered inside the associated Turris Dongle...
Definition: JablotronGadget.h:20
static Info resolve(const uint32_t address)
Definition: JablotronGadget.cpp:113