hyperion.ng
LedDeviceAtmoOrb.h
1 #pragma once
2 
3 // Qt includes
4 #include <QObject>
5 #include <QString>
6 #include <QNetworkAccessManager>
7 #include <QHostAddress>
8 #include <QMap>
9 #include <QVector>
10 
11 // Leddevice includes
12 #include <leddevice/LedDevice.h>
13 
14 class QUdpSocket;
15 
16 class AtmoOrbLight {
17 public:
18  unsigned int id;
19 
24  AtmoOrbLight(unsigned int id);
25 };
26 
35 {
36  Q_OBJECT
37 public:
38  // Last send color map
39  QMap<int, int> lastColorRedMap;
40  QMap<int, int> lastColorGreenMap;
41  QMap<int, int> lastColorBlueMap;
42 
43  // Multicast status
44  bool joinedMulticastgroup;
45 
51  LedDeviceAtmoOrb(const QJsonObject &deviceConfig);
52 
58  bool init(const QJsonObject &deviceConfig);
59 
61  static LedDevice* construct(const QJsonObject &deviceConfig);
65  virtual ~LedDeviceAtmoOrb();
66 
67  virtual int switchOff();
68 
69 private:
76  virtual int write(const std::vector <ColorRgb> &ledValues);
77 
79  QNetworkAccessManager *_manager;
80 
82  QString _multicastGroup;
83 
85  bool _useOrbSmoothing;
86 
88  int _transitiontime;
89 
90  // Maximum allowed color difference, will skip Orb (external) smoothing once reached
91  int _skipSmoothingDiff;
92 
94  int _multiCastGroupPort;
95 
97  int _numLeds;
98 
100  QHostAddress _groupAddress;
101 
103  QUdpSocket * _udpSocket;
104 
106  QVector<unsigned int> _orbIds;
107 
115  void setColor(unsigned int orbId, const ColorRgb &color, int commandType);
116 
122  void sendCommand(const QByteArray &bytes);
123 };
Interface (pure virtual base class) for LedDevices.
Definition: LedDevice.h:32
Implementation for the AtmoOrb.
Definition: LedDeviceAtmoOrb.h:34
AtmoOrbLight(unsigned int id)
Constructs the light.
Definition: LedDeviceAtmoOrb.cpp:11
Definition: LedDeviceAtmoOrb.h:16
Plain-Old-Data structure containing the red-green-blue color specification.
Definition: ColorRgb.h:13