BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
ConradDevice.h
1 #pragma once
2 
3 #include <list>
4 #include <string>
5 
6 #include <Poco/SharedPtr.h>
7 #include <Poco/JSON/Object.h>
8 
9 #include "conrad/FHEMClient.h"
10 #include "model/DeviceID.h"
11 #include "model/ModuleType.h"
12 #include "model/RefreshTime.h"
13 #include "model/SensorData.h"
14 #include "util/Loggable.h"
15 
16 namespace BeeeOn {
17 
21 class ConradDevice : protected Loggable {
22 public:
23  typedef Poco::SharedPtr<ConradDevice> Ptr;
24 
25  static const std::string VENDOR_NAME;
26 
28  const DeviceID& id,
29  const RefreshTime &refresh,
30  const std::string& productName,
31  const std::list<ModuleType>& moduleTypes);
32  virtual ~ConradDevice();
33 
34  DeviceID id() const;
35  RefreshTime refreshTime() const;
36  std::list<ModuleType> moduleTypes() const;
37  std::string vendor() const;
38  std::string productName() const;
39 
40  virtual void requestModifyState(
41  const ModuleID& moduleID,
42  const double value,
43  FHEMClient::Ptr fhemClient);
44 
48  virtual SensorData parseMessage(const Poco::JSON::Object::Ptr message) = 0;
49 
53  static std::string constructFHEMDeviceId(const DeviceID& id);
54 
55 protected:
59  bool isNumber(const std::string& s);
60 
61 protected:
62  const DeviceID m_deviceId;
63  RefreshTime m_refresh;
64  std::string m_productName;
65  std::list<ModuleType> m_moduleTypes;
66 };
67 
68 }
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.h:24
Definition: SensorData.h:20
Definition: ModuleID.h:12
static std::string constructFHEMDeviceId(const DeviceID &id)
Returns FHEM device id constructed from a given DeviceID.
Definition: ConradDevice.cpp:60
Abstract class representing generic Conrad device.
Definition: ConradDevice.h:21
Definition: Loggable.h:19
bool isNumber(const std::string &s)
Returns true or false depending if the string is number or not.
Definition: ConradDevice.cpp:70
virtual SensorData parseMessage(const Poco::JSON::Object::Ptr message)=0
Transforms received ZMQ message to SensorData.
Definition: DeviceID.h:17