2016-08-11 07:13:55 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <utils/Logger.h>
|
|
|
|
#include <utils/Components.h>
|
2016-08-12 23:07:32 +02:00
|
|
|
#include <utils/GrabbingMode.h>
|
2016-08-11 07:13:55 +02:00
|
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
|
|
|
|
class ImageProcessor;
|
|
|
|
|
|
|
|
class GrabberWrapper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
GrabberWrapper(std::string grabberName, const int priority);
|
|
|
|
|
|
|
|
virtual ~GrabberWrapper();
|
|
|
|
|
2016-08-12 23:07:32 +02:00
|
|
|
///
|
|
|
|
/// Starts the grabber wich produces led values with the specified update rate
|
|
|
|
///
|
2016-08-11 07:13:55 +02:00
|
|
|
virtual bool start();
|
2016-08-12 23:07:32 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Stop grabber
|
|
|
|
///
|
2016-08-11 07:13:55 +02:00
|
|
|
virtual void stop();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void componentStateChanged(const hyperion::Components component, bool enable);
|
2016-08-12 23:07:32 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// virtual method, should perform single frame grab and computes the led-colors
|
|
|
|
///
|
2016-08-11 07:13:55 +02:00
|
|
|
virtual void action() = 0;
|
|
|
|
|
2016-08-12 23:07:32 +02:00
|
|
|
///
|
|
|
|
/// Set the grabbing mode
|
|
|
|
/// @param[in] mode The new grabbing mode
|
|
|
|
///
|
|
|
|
void setGrabbingMode(const GrabbingMode mode);
|
|
|
|
|
2016-08-11 07:13:55 +02:00
|
|
|
signals:
|
|
|
|
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
|
|
|
|
|
|
|
protected:
|
2016-08-12 23:07:32 +02:00
|
|
|
|
|
|
|
virtual void kodiPlay();
|
|
|
|
virtual void kodiOff();
|
|
|
|
virtual void kodiPause();
|
|
|
|
|
2016-08-11 07:13:55 +02:00
|
|
|
std::string _grabberName;
|
|
|
|
|
|
|
|
/// Pointer to Hyperion for writing led values
|
|
|
|
Hyperion * _hyperion;
|
|
|
|
|
|
|
|
/// The priority of the led colors
|
|
|
|
const int _priority;
|
|
|
|
|
|
|
|
/// The timer for generating events with the specified update rate
|
|
|
|
QTimer _timer;
|
|
|
|
|
|
|
|
/// The Logger instance
|
|
|
|
Logger * _log;
|
|
|
|
|
|
|
|
// forwarding enabled
|
|
|
|
bool _forward;
|
|
|
|
|
|
|
|
/// The processor for transforming images to led colors
|
|
|
|
ImageProcessor * _processor;
|
|
|
|
|
|
|
|
};
|