BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
FitpDevice.h
1 #pragma once
2 
3 #include <Poco/SharedPtr.h>
4 
5 #include "core/DeviceManager.h"
6 #include "model/DeviceID.h"
7 #include "model/ModuleType.h"
8 #include "model/SensorData.h"
9 #include "util/Loggable.h"
10 
11 namespace BeeeOn {
12 
16 class FitpDevice : public Loggable {
17 public:
18  enum DeviceType {
19  // end device - it can send values and it is not able to route data
20  END_DEVICE,
21  // coordinator - it can send values and it is able to route data
22  COORDINATOR,
23  };
24  typedef Poco::SharedPtr<FitpDevice> Ptr;
25 
26  FitpDevice(DeviceID id);
27  virtual ~FitpDevice();
28 
29  DeviceID deviceID() const;
30  void setDeviceID(const DeviceID &deviceId);
31 
32  DeviceType type() const;
33 
39  std::list<ModuleType> modules() const;
40 
44  size_t moduleEDOffset(const uint8_t &id) const;
45 
49  size_t moduleCOORDOffset(const uint8_t &id) const;
50 
55  SensorData parseMessage(const std::vector<uint8_t> &data, DeviceID deviceID) const;
56 
60  static double extractValue(const std::vector<uint8_t> &values);
61  static double voltsToPercentage(double milivolts);
62 
66  static double moduleValue(uint8_t id, const std::vector<uint8_t> &data);
67 
71  static ModuleID deriveEDModuleID(const uint8_t id);
72 
76  static ModuleID deriveCOORDModuleID(const uint8_t id);
77 
78 private:
79  DeviceID m_deviceID;
80  DeviceType m_type;
81 };
82 
83 }
size_t moduleEDOffset(const uint8_t &id) const
Definition: FitpDevice.cpp:82
Definition: SensorData.h:20
static ModuleID deriveCOORDModuleID(const uint8_t id)
Definition: FitpDevice.cpp:245
std::list< ModuleType > modules() const
Definition: FitpDevice.cpp:74
static double moduleValue(uint8_t id, const std::vector< uint8_t > &data)
Definition: FitpDevice.cpp:151
Definition: ModuleID.h:12
SensorData parseMessage(const std::vector< uint8_t > &data, DeviceID deviceID) const
Definition: FitpDevice.cpp:182
Definition: Loggable.h:19
Definition: FitpDevice.h:16
size_t moduleCOORDOffset(const uint8_t &id) const
Definition: FitpDevice.cpp:111
static double extractValue(const std::vector< uint8_t > &values)
Definition: FitpDevice.cpp:165
Definition: DeviceID.h:17
static ModuleID deriveEDModuleID(const uint8_t id)
Definition: FitpDevice.cpp:227