hyperion.ng
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LedDeviceFadeCandy Class Reference

Implementation of the LedDevice interface for sending to fadecandy/opc-server via network by using the 'open pixel control' protocol. More...

#include <LedDeviceFadeCandy.h>

Inheritance diagram for LedDeviceFadeCandy:
LedDevice

Public Member Functions

 LedDeviceFadeCandy (const QJsonObject &deviceConfig)
 Constructs the LedDevice for fadecandy/opc server. More...
 
virtual ~LedDeviceFadeCandy ()
 Destructor of the LedDevice; closes the tcp client.
 
bool init (const QJsonObject &deviceConfig)
 Sets configuration. More...
 
- Public Member Functions inherited from LedDevice
 LedDevice (const QJsonObject &config=QJsonObject(), QObject *parent=nullptr)
 
virtual int switchOff ()
 Switch the leds off (led hardware disable)
 
virtual int switchOn ()
 Switch the leds on (led hardware enable), used if reinitialization is required for the device implementation.
 
virtual int setLedValues (const std::vector< ColorRgb > &ledValues)
 
const QString & getColorOrder ()
 Get color order of device. More...
 
void setActiveDevice (QString dev)
 
const QString & getActiveDevice ()
 
void setLedCount (int ledCount)
 
int getLedCount ()
 
void setEnable (bool enable)
 
bool enabled ()
 
int getLatchTime ()
 
bool componentState ()
 

Static Public Member Functions

static LedDeviceconstruct (const QJsonObject &deviceConfig)
 constructs leddevice
 

Protected Member Functions

bool tryConnect ()
 try to establish connection to opc server, if not connected yet More...
 
bool isConnected ()
 return the conenction state More...
 
int transferData ()
 transfer current opc_data buffer to opc server More...
 
int sendSysEx (uint8_t systemId, uint8_t commandId, QByteArray msg)
 send system exclusive commands More...
 
void sendFadeCandyConfiguration ()
 sends the configuration to fcserver
 
- Protected Member Functions inherited from LedDevice
virtual int open ()
 Opens and configures the output device. More...
 

Protected Attributes

QTcpSocket * _client
 
QString _host
 
uint16_t _port
 
unsigned _channel
 
QByteArray _opc_data
 
bool _setFcConfig
 
double _gamma
 
double _whitePoint_r
 
double _whitePoint_g
 
double _whitePoint_b
 
bool _noDither
 
bool _noInterp
 
bool _manualLED
 
bool _ledOnOff
 
- Protected Attributes inherited from LedDevice
QJsonObject _devConfig
 
Logger_log
 The common Logger instance for all LedDevices.
 
std::vector< uint8_t > _ledBuffer
 The buffer containing the packed RGB values.
 
bool _deviceReady
 
QString _activeDevice
 
int _ledCount
 
int _ledRGBCount
 
int _ledRGBWCount
 
QTimer _refresh_timer
 Timer object which makes sure that led data is written at a minimum rate e.g. More...
 
unsigned int _refresh_timer_interval
 
qint64 _last_write_time
 
unsigned int _latchTime_ms
 

Additional Inherited Members

- Public Slots inherited from LedDevice
virtual void start ()
 Is called on thread start, all construction tasks and init should run here.
 
- Signals inherited from LedDevice
void enableStateChanged (bool newState)
 Emits whenever the led device switches between on/off. More...
 
void visiblePriorityChanged (const quint8 &priority)
 PIPER signal for Priority Muxer -> LedDevice. More...
 
- Protected Slots inherited from LedDevice
int rewriteLeds ()
 Write the last data to the leds again.
 

Detailed Description

Implementation of the LedDevice interface for sending to fadecandy/opc-server via network by using the 'open pixel control' protocol.

Constructor & Destructor Documentation

§ LedDeviceFadeCandy()

LedDeviceFadeCandy::LedDeviceFadeCandy ( const QJsonObject &  deviceConfig)

Constructs the LedDevice for fadecandy/opc server.

following code shows all config options

"device" :
{
"name" : "MyPi",
"type" : "fadecandy",
"output" : "localhost",
"colorOrder" : "rgb",
"setFcConfig" : false,
"gamma" : 1.0,
"whitepoint" : [1.0, 1.0, 1.0],
"dither" : false,
"interpolation" : false,
"manualLed" : false,
"ledOn" : false
},
Parameters
deviceConfigjson config for fadecandy

Member Function Documentation

§ init()

bool LedDeviceFadeCandy::init ( const QJsonObject &  deviceConfig)
virtual

Sets configuration.

Parameters
deviceConfigthe json device config
Returns
true if success

Reimplemented from LedDevice.

§ isConnected()

bool LedDeviceFadeCandy::isConnected ( )
protected

return the conenction state

Returns
True if connection established

§ sendSysEx()

int LedDeviceFadeCandy::sendSysEx ( uint8_t  systemId,
uint8_t  commandId,
QByteArray  msg 
)
protected

send system exclusive commands

Parameters
systemIdfadecandy device identifier (for standard fadecandy always: 1)
commandIdid of command
msgthe sysEx message
Returns
amount bytes written, -1 if fail

§ transferData()

int LedDeviceFadeCandy::transferData ( )
protected

transfer current opc_data buffer to opc server

Returns
amount of transfered bytes. -1 error while transfering, -2 error while connecting

§ tryConnect()

bool LedDeviceFadeCandy::tryConnect ( )
protected

try to establish connection to opc server, if not connected yet

Returns
true if connection is established

The documentation for this class was generated from the following files: