BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
TabuLumenSmartLite.h
1 #pragma once
2 
3 #include <Poco/SharedPtr.h>
4 #include <Poco/UUID.h>
5 
6 #include "bluetooth/BLESmartDevice.h"
7 #include "util/ColorBrightness.h"
8 
9 namespace BeeeOn {
10 
16 public:
17  typedef Poco::SharedPtr<TabuLumenSmartLite> Ptr;
18 
19 private:
23  static const Poco::UUID WRITE_VALUES;
24  static const std::vector<uint8_t> ADD_KEY;
25  static const std::vector<uint8_t> XOR_KEY;
26  static const std::string LIGHT_NAME;
27  static const std::string VENDOR_NAME;
28 
29  enum Command {
30  LOGIN = 0x08,
31  OFF = 0x00,
32  ON_ACTION = 0x01
33  };
34 
35 public:
37  const MACAddress& address,
38  const Poco::Timespan& timeout,
39  const RefreshTime& refresh,
40  const HciInterface::Ptr hci);
42 
43  std::list<ModuleType> moduleTypes() const override;
44  std::string productName() const override;
45  std::string vendor() const override;
46 
47  void requestModifyState(
48  const ModuleID& moduleID,
49  const double value) override;
50 
51  static bool match(const std::string& modelID);
52 
53 protected:
54  void modifyStatus(const int64_t value, const HciInterface::Ptr hci);
55  void modifyBrightness(const int64_t value, const HciInterface::Ptr hci);
56  void modifyColor(const int64_t value, const HciInterface::Ptr hci);
57 
58  void writeData(
59  const std::vector<unsigned char>& data,
60  const HciInterface::Ptr hci) const;
61 
66  std::vector<uint8_t> authorizationMessage() const;
67 
72  void encryptMessage(std::vector<uint8_t> &data) const;
73  void decryptMessage(std::vector<uint8_t> &data) const;
74 
75 private:
76  ColorBrightness m_colorBrightness;
77 };
78 
79 }
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.h:24
Definition: MACAddress.h:8
std::vector< uint8_t > authorizationMessage() const
Returns authorization message that must be sent to the device after connection so that it can be mani...
Definition: TabuLumenSmartLite.cpp:169
void requestModifyState(const ModuleID &moduleID, const double value) override
Modifies the device module given by moduleID to a given value.
Definition: TabuLumenSmartLite.cpp:62
RefreshTime refresh() const override
Regular period telling how often to call the method PollableDevice::poll(). The refresh must contain ...
Definition: BLESmartDevice.cpp:31
Definition: ModuleID.h:12
The class represents Tabu Lumen TL 100S Smart Light. It allows to control all its modules...
Definition: TabuLumenSmartLite.h:15
void encryptMessage(std::vector< uint8_t > &data) const
Definition: TabuLumenSmartLite.cpp:180
Abstract class representing generic Bluetooth Low Energy smart device.
Definition: BLESmartDevice.h:26
The class stores color represent by red, green and blue component. It allows to count the brightness ...
Definition: ColorBrightness.h:11