hyperion.ng
LedDeviceFadeCandy.h
1 #pragma once
2 
3 // STL/Qt includes
4 #include <QTcpSocket>
5 #include <QString>
6 
7 // Leddevice includes
8 #include <leddevice/LedDevice.h>
9 
15 {
16  Q_OBJECT
17 
18 public:
42  LedDeviceFadeCandy(const QJsonObject &deviceConfig);
43 
47  virtual ~LedDeviceFadeCandy();
48 
50  static LedDevice* construct(const QJsonObject &deviceConfig);
51 
57  bool init(const QJsonObject &deviceConfig);
58 
59 private:
66  virtual int write(const std::vector<ColorRgb>& ledValues);
67 
68 protected:
69  QTcpSocket* _client;
70  QString _host;
71  uint16_t _port;
72  unsigned _channel;
73  QByteArray _opc_data;
74 
75  // fadecandy sysEx
76  bool _setFcConfig;
77  double _gamma;
78  double _whitePoint_r;
79  double _whitePoint_g;
80  double _whitePoint_b;
81  bool _noDither;
82  bool _noInterp;
83  bool _manualLED;
84  bool _ledOnOff;
85 
90  bool tryConnect();
91 
96  bool isConnected();
97 
102  int transferData();
103 
110  int sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg);
111 
114 
115 };
bool isConnected()
return the conenction state
Definition: LedDeviceFadeCandy.cpp:67
Interface (pure virtual base class) for LedDevices.
Definition: LedDevice.h:32
Implementation of the LedDevice interface for sending to fadecandy/opc-server via network by using th...
Definition: LedDeviceFadeCandy.h:14
bool tryConnect()
try to establish connection to opc server, if not connected yet
Definition: LedDeviceFadeCandy.cpp:72
virtual ~LedDeviceFadeCandy()
Destructor of the LedDevice; closes the tcp client.
Definition: LedDeviceFadeCandy.cpp:16
int sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg)
send system exclusive commands
Definition: LedDeviceFadeCandy.cpp:112
bool init(const QJsonObject &deviceConfig)
Sets configuration.
Definition: LedDeviceFadeCandy.cpp:26
static LedDevice * construct(const QJsonObject &deviceConfig)
constructs leddevice
Definition: LedDeviceFadeCandy.cpp:21
int transferData()
transfer current opc_data buffer to opc server
Definition: LedDeviceFadeCandy.cpp:103
void sendFadeCandyConfiguration()
sends the configuration to fcserver
Definition: LedDeviceFadeCandy.cpp:136
LedDeviceFadeCandy(const QJsonObject &deviceConfig)
Constructs the LedDevice for fadecandy/opc server.
Definition: LedDeviceFadeCandy.cpp:8