enable components at runtime + grabber refactoring (#160)

* implement enable/disable on runtime for:
- smoothing
- kodi
- udplistener
- boblight

* implement enable/disable for forwarder
refactor component

* - implement grabber enable/disable at runtime
- big grabber refactoring. now with common base class for all grabbers

* implement enable/disable at runtime for bb detector

* osx fix

* try to fix cutted travis output for osx build
This commit is contained in:
redPanther
2016-08-11 07:13:55 +02:00
committed by GitHub
parent 0d3f6c7ba1
commit f1cc82b8c7
36 changed files with 471 additions and 495 deletions

View File

@@ -0,0 +1,52 @@
#pragma once
#include <QObject>
#include <QTimer>
#include <string>
#include <utils/Logger.h>
#include <utils/Components.h>
#include <hyperion/Hyperion.h>
class ImageProcessor;
class GrabberWrapper : public QObject
{
Q_OBJECT
public:
GrabberWrapper(std::string grabberName, const int priority);
virtual ~GrabberWrapper();
virtual bool start();
virtual void stop();
public slots:
void componentStateChanged(const hyperion::Components component, bool enable);
virtual void action() = 0;
signals:
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
protected:
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;
};

View File

@@ -156,7 +156,7 @@ public:
/// @param component The component [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]
/// @param state The state of the component [true | false]
///
void setComponentState(const Components component, const bool state);
void setComponentState(const hyperion::Components component, const bool state);
public slots:
///
/// Writes a single color to all the leds for the given time and priority
@@ -294,6 +294,8 @@ signals:
/// This signal will not be emitted when a priority channel time out
void allChannelsCleared();
void componentStateChanged(const hyperion::Components component, bool enabled);
private slots:
///
/// Updates the priority muxer with the current time and (re)writes the led color with applied

View File

@@ -41,6 +41,9 @@ public:
/// Enable or disable the black border detector
void enableBlackBorderDetector(bool enable);
/// Returns starte of black border detector
bool blackBorderDetectorEnabled();
///
/// Processes the image to a list of led colors. This will update the size of the buffer-image
/// if required and call the image-to-leds mapping to determine the mean color per led.
@@ -104,7 +107,6 @@ private:
/// given led-string specification
///
/// @param[in] ledString The led-string specification
/// @param[in] enableBlackBorderDetector Flag indicating if the blacborder detector should be enabled
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
ImageProcessor(const LedString &ledString, const Json::Value &blackborderConfig);