mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			84 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| // stl includes
 | |
| #include <list>
 | |
| 
 | |
| // QT includes
 | |
| #include <QObject>
 | |
| #include <QTimer>
 | |
| 
 | |
| // hyperion-utils includes
 | |
| #include <utils/RgbImage.h>
 | |
| 
 | |
| // Hyperion includes
 | |
| #include <hyperion/LedString.h>
 | |
| #include <hyperion/LedDevice.h>
 | |
| #include <hyperion/PriorityMuxer.h>
 | |
| 
 | |
| // Forward class declaration
 | |
| class HsvTransform;
 | |
| class ColorTransform;
 | |
| 
 | |
| class Hyperion : public QObject
 | |
| {
 | |
| 	Q_OBJECT
 | |
| public:
 | |
| 	typedef PriorityMuxer::InputInfo InputInfo;
 | |
| 
 | |
| 	enum Color
 | |
| 	{
 | |
| 		RED, GREEN, BLUE, INVALID
 | |
| 	};
 | |
| 
 | |
| 	enum Transform
 | |
| 	{
 | |
| 		SATURATION_GAIN, VALUE_GAIN, THRESHOLD, GAMMA, BLACKLEVEL, WHITELEVEL
 | |
| 	};
 | |
| 
 | |
| 	Hyperion(const Json::Value& jsonConfig);
 | |
| 
 | |
| 	~Hyperion();
 | |
| 
 | |
| 	unsigned getLedCount() const;
 | |
| 
 | |
| 	void setColor(int priority, RgbColor &ledColor, const int timeout_ms);
 | |
| 
 | |
| 	void setColors(int priority, std::vector<RgbColor> &ledColors, const int timeout_ms);
 | |
| 
 | |
| 	void setTransform(Transform transform, Color color, double value);
 | |
| 
 | |
| 	void clear(int priority);
 | |
| 
 | |
| 	void clearall();
 | |
| 
 | |
| 	double getTransform(Transform transform, Color color) const;
 | |
| 
 | |
| 	QList<int> getActivePriorities() const;
 | |
| 
 | |
| 	const InputInfo& getPriorityInfo(const int priority) const;
 | |
| 
 | |
| 	static LedDevice* constructDevice(const Json::Value & deviceConfig);
 | |
| 	static LedString createLedString(const Json::Value & ledsConfig);
 | |
| 	static HsvTransform * createHsvTransform(const Json::Value & hsvConfig);
 | |
| 	static ColorTransform* createColorTransform(const Json::Value & colorConfig);
 | |
| 
 | |
| private slots:
 | |
| 	void update();
 | |
| 
 | |
| private:
 | |
| 	void applyTransform(std::vector<RgbColor>& colors) const;
 | |
| 
 | |
| 	LedString _ledString;
 | |
| 
 | |
| 	PriorityMuxer _muxer;
 | |
| 
 | |
| 	HsvTransform * _hsvTransform;
 | |
| 	ColorTransform * _redTransform;
 | |
| 	ColorTransform * _greenTransform;
 | |
| 	ColorTransform * _blueTransform;
 | |
| 
 | |
| 	LedDevice* _device;
 | |
| 
 | |
| 	QTimer _timer;
 | |
| };
 |