2013-07-26 20:38:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
2013-08-19 20:33:36 +02:00
|
|
|
// stl includes
|
|
|
|
#include <list>
|
|
|
|
|
2013-08-14 15:02:09 +00:00
|
|
|
// QT includes
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2013-07-26 20:38:34 +00:00
|
|
|
// hyperion-utils includes
|
|
|
|
#include <utils/RgbImage.h>
|
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
// Hyperion includes
|
2013-07-26 20:38:34 +00:00
|
|
|
#include <hyperion/LedString.h>
|
|
|
|
#include <hyperion/LedDevice.h>
|
2013-08-13 11:10:45 +02:00
|
|
|
#include <hyperion/PriorityMuxer.h>
|
|
|
|
|
|
|
|
// Forward class declaration
|
2013-08-21 21:50:17 +02:00
|
|
|
namespace hyperion {
|
|
|
|
class HsvTransform;
|
|
|
|
class ColorTransform;
|
|
|
|
}
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-14 15:02:09 +00:00
|
|
|
class Hyperion : public QObject
|
2013-07-26 20:38:34 +00:00
|
|
|
{
|
2013-08-14 15:02:09 +00:00
|
|
|
Q_OBJECT
|
2013-07-26 20:38:34 +00:00
|
|
|
public:
|
2013-08-19 20:33:36 +02:00
|
|
|
typedef PriorityMuxer::InputInfo InputInfo;
|
|
|
|
|
2013-08-19 19:57:35 +02:00
|
|
|
enum Color
|
|
|
|
{
|
2013-08-21 21:50:17 +02:00
|
|
|
RED, GREEN, BLUE, INVALID
|
2013-08-19 19:57:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Transform
|
|
|
|
{
|
2013-08-21 21:50:17 +02:00
|
|
|
SATURATION_GAIN, VALUE_GAIN, THRESHOLD, GAMMA, BLACKLEVEL, WHITELEVEL
|
2013-08-19 19:57:35 +02:00
|
|
|
};
|
|
|
|
|
2013-08-15 19:11:02 +00:00
|
|
|
static LedString createLedString(const Json::Value& ledsConfig);
|
|
|
|
|
2013-08-21 14:25:27 +00:00
|
|
|
static Json::Value loadConfig(const std::string& configFile);
|
|
|
|
|
|
|
|
Hyperion(const std::string& configFile);
|
2013-07-26 20:38:34 +00:00
|
|
|
Hyperion(const Json::Value& jsonConfig);
|
|
|
|
|
|
|
|
~Hyperion();
|
|
|
|
|
2013-08-14 08:54:49 +00:00
|
|
|
unsigned getLedCount() const;
|
|
|
|
|
2013-08-18 13:33:56 +02:00
|
|
|
void setColor(int priority, RgbColor &ledColor, const int timeout_ms);
|
|
|
|
|
|
|
|
void setColors(int priority, std::vector<RgbColor> &ledColors, const int timeout_ms);
|
|
|
|
|
2013-08-19 19:57:35 +02:00
|
|
|
void setTransform(Transform transform, Color color, double value);
|
|
|
|
|
2013-08-18 13:33:56 +02:00
|
|
|
void clear(int priority);
|
|
|
|
|
|
|
|
void clearall();
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-19 20:33:36 +02:00
|
|
|
double getTransform(Transform transform, Color color) const;
|
|
|
|
|
|
|
|
QList<int> getActivePriorities() const;
|
|
|
|
|
|
|
|
const InputInfo& getPriorityInfo(const int priority) const;
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-14 15:02:09 +00:00
|
|
|
private slots:
|
|
|
|
void update();
|
|
|
|
|
2013-07-26 20:38:34 +00:00
|
|
|
private:
|
|
|
|
void applyTransform(std::vector<RgbColor>& colors) const;
|
|
|
|
|
2013-08-18 13:33:56 +02:00
|
|
|
LedString _ledString;
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-18 13:33:56 +02:00
|
|
|
PriorityMuxer _muxer;
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-21 21:50:17 +02:00
|
|
|
hyperion::HsvTransform * _hsvTransform;
|
|
|
|
hyperion::ColorTransform * _redTransform;
|
|
|
|
hyperion::ColorTransform * _greenTransform;
|
|
|
|
hyperion::ColorTransform * _blueTransform;
|
2013-07-26 20:38:34 +00:00
|
|
|
|
2013-08-18 13:33:56 +02:00
|
|
|
LedDevice* _device;
|
2013-08-14 15:02:09 +00:00
|
|
|
|
|
|
|
QTimer _timer;
|
2013-07-26 20:38:34 +00:00
|
|
|
};
|