leddevice refactoring. code style and extension of baseclass to avoid dups (#174)

This commit is contained in:
redPanther
2016-08-14 10:46:44 +02:00
committed by GitHub
parent bc0c9c469f
commit 97181fa83c
63 changed files with 483 additions and 533 deletions

View File

@@ -3,16 +3,13 @@
// STL includes
#include <string>
// Qt includes
#include <QTimer>
// hyperion incluse
#include "LedRs232Device.h"
// hyperion include
#include "LedDeviceAdalight.h"
///
/// Implementation of the LedDevice interface for writing to an Adalight led device for APA102.
///
class LedDeviceAdalightApa102 : public LedRs232Device
class LedDeviceAdalightApa102 : public LedDeviceAdalight
{
Q_OBJECT
@@ -32,19 +29,7 @@ public:
/// @return Zero on succes else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues);
/// Switch the leds off
virtual int switchOff();
private slots:
/// Write the last data to the leds again
void rewriteLeds();
private:
/// The buffer containing the packed RGB values
std::vector<uint8_t> _ledBuffer;
unsigned int ledCount;
/// Timer object which makes sure that led data is written at a minimum rate
/// The Adalight device will switch off when it does not receive data at least
/// every 15 seconds
QTimer _timer;
};