BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
RevogiRGBLight.h
1 #pragma once
2 
3 #include <Poco/SharedPtr.h>
4 
5 #include "bluetooth/HciConnection.h"
6 #include "bluetooth/RevogiDevice.h"
7 
8 namespace BeeeOn {
9 
20 public:
21  typedef Poco::SharedPtr<RevogiRGBLight> Ptr;
22 
24  const MACAddress& address,
25  const Poco::Timespan& timeout,
26  const std::string& productName,
27  const std::list<ModuleType>& moduleTypes,
28  const RefreshTime& refresh,
29  const HciInterface::Ptr hci);
30  ~RevogiRGBLight();
31 
32 protected:
33  void modifyStatus(const double value, const HciConnection::Ptr conn);
34  void modifyBrightness(
35  const double value,
36  const uint32_t rgb,
37  const HciConnection::Ptr conn);
38  void modifyColor(const double value, const HciConnection::Ptr conn);
39 
40  unsigned char brightnessFromPercents(const double percents) const;
41  unsigned int brightnessToPercents(const double value) const;
42 
47  uint32_t retrieveRGB(const std::vector<unsigned char>& values) const;
48 
49  uint32_t colorChecksum(
50  const uint8_t red,
51  const uint8_t green,
52  const uint8_t blue) const;
53 
54  void prependHeader(std::vector<unsigned char>& payload) const override;
55  void appendFooter(
56  std::vector<unsigned char>& payload,
57  const unsigned char checksum) const override;
58 };
59 
60 }
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.h:24
The class represents generic Revogi RGB light. It allows to control the on/off, brightness and color ...
Definition: RevogiRGBLight.h:19
Definition: MACAddress.h:8
RefreshTime refresh() const override
Regular period telling how often to call the method PollableDevice::poll(). The refresh must contain ...
Definition: BLESmartDevice.cpp:31
uint32_t retrieveRGB(const std::vector< unsigned char > &values) const
Returns RGB contained in uint32_t. The components of RGB are retrieved from recived message contained...
Definition: RevogiRGBLight.cpp:96
Abstract class for Revogi devices.
Definition: RevogiDevice.h:29