2015-11-08 16:31:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
// hyperion include
|
2016-08-28 07:12:48 +02:00
|
|
|
#include "ProviderHID.h"
|
2015-11-08 16:31:18 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Implementation of the LedDevice interface for writing to an RawHID led device.
|
|
|
|
///
|
2016-08-28 07:12:48 +02:00
|
|
|
class LedDeviceRawHID : public ProviderHID
|
2015-11-08 16:31:18 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
///
|
2016-08-23 20:07:12 +02:00
|
|
|
/// Constructs specific LedDevice
|
2015-11-08 16:31:18 +01:00
|
|
|
///
|
2016-08-23 20:07:12 +02:00
|
|
|
/// @param deviceConfig json device config
|
|
|
|
///
|
|
|
|
LedDeviceRawHID(const Json::Value &deviceConfig);
|
|
|
|
|
|
|
|
/// constructs leddevice
|
|
|
|
static LedDevice* construct(const Json::Value &deviceConfig);
|
2015-11-08 16:31:18 +01:00
|
|
|
|
2016-09-23 08:49:22 +02:00
|
|
|
private slots:
|
|
|
|
/// Write the last data to the leds again
|
|
|
|
void rewriteLeds();
|
|
|
|
|
|
|
|
private:
|
2015-11-08 16:31:18 +01:00
|
|
|
///
|
|
|
|
/// Writes the led color values to the led-device
|
|
|
|
///
|
|
|
|
/// @param ledValues The color-value per led
|
|
|
|
/// @return Zero on succes else negative
|
|
|
|
///
|
|
|
|
virtual int write(const std::vector<ColorRgb> & ledValues);
|
|
|
|
|
|
|
|
/// Timer object which makes sure that led data is written at a minimum rate
|
|
|
|
/// The RawHID device will switch off when it does not receive data at least
|
|
|
|
/// every 15 seconds
|
|
|
|
QTimer _timer;
|
|
|
|
};
|