2013-08-13 11:10:45 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// QT includes
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2013-08-14 10:54:49 +02:00
|
|
|
// Utils includes
|
|
|
|
#include <utils/RgbColor.h>
|
2013-08-14 17:02:09 +02:00
|
|
|
#include <utils/RgbImage.h>
|
2013-08-14 10:54:49 +02:00
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
// Forward class declaration
|
|
|
|
class DispmanxFrameGrabber;
|
2013-08-14 10:54:49 +02:00
|
|
|
class Hyperion;
|
|
|
|
class ImageProcessor;
|
2013-08-13 11:10:45 +02:00
|
|
|
|
2013-08-14 10:54:49 +02:00
|
|
|
///
|
|
|
|
/// The DispmanxWrapper uses an instance of the DispmanxFrameGrabber to obtain RgbImage's from the
|
|
|
|
/// displayed content. This RgbImage is processed to a RgbColor for each led and commmited to the
|
|
|
|
/// attached Hyperion.
|
|
|
|
///
|
2013-08-13 11:10:45 +02:00
|
|
|
class DispmanxWrapper: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-08-14 10:54:49 +02:00
|
|
|
DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion);
|
2013-08-13 11:10:45 +02:00
|
|
|
|
|
|
|
virtual ~DispmanxWrapper();
|
|
|
|
|
2013-08-14 10:54:49 +02:00
|
|
|
signals:
|
|
|
|
void ledValues(const unsigned priority, const std::vector<RgbColor> ledColors, const unsigned timeout_ms);
|
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
public slots:
|
|
|
|
void start();
|
|
|
|
|
|
|
|
void action();
|
|
|
|
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
2013-08-14 10:54:49 +02:00
|
|
|
const int _updateInterval_ms;
|
|
|
|
const int _timeout_ms;
|
|
|
|
|
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
QTimer _timer;
|
|
|
|
|
2013-08-14 17:02:09 +02:00
|
|
|
RgbImage _image;
|
2013-08-14 10:54:49 +02:00
|
|
|
DispmanxFrameGrabber * _frameGrabber;
|
|
|
|
ImageProcessor * _processor;
|
|
|
|
|
|
|
|
std::vector<RgbColor> _ledColors;
|
|
|
|
|
|
|
|
Hyperion * _hyperion;
|
2013-08-13 11:10:45 +02:00
|
|
|
};
|
|
|
|
|