add led color streaming mutex and

timeout for led color refresh
This commit is contained in:
Paulchen Panther 2018-12-20 15:05:38 +01:00 committed by GitHub
parent ccbfe4c5b3
commit 4c81614c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,6 @@
#include <hyperion/Hyperion.h> #include <hyperion/Hyperion.h>
// qt includess // qt includess
#include <QTimer>
#include <QJsonObject> #include <QJsonObject>
#include <QMutex> #include <QMutex>
#include <QString> #include <QString>
@ -64,8 +63,11 @@ public:
void forceServerInfo(); void forceServerInfo();
public slots: public slots:
/// _timer_ledcolors requests ledcolor updates (if enabled) ///
void streamLedcolorsUpdate(); /// @brief is called whenever the current Hyperion instance pushes new led raw values (if enabled)
/// @param ledColors The current ledColors
///
void streamLedcolorsUpdate(const std::vector<ColorRgb>& ledColors);
/// push images whenever hyperion emits (if enabled) /// push images whenever hyperion emits (if enabled)
void setImage(int priority, const Image<ColorRgb> & image, int duration_ms); void setImage(int priority, const Image<ColorRgb> & image, int duration_ms);
@ -107,23 +109,26 @@ private:
/// returns if hyperion is on or off /// returns if hyperion is on or off
inline bool hyperionIsActive() { return JsonProcessor::_componentsPrevState.empty(); }; inline bool hyperionIsActive() { return JsonProcessor::_componentsPrevState.empty(); };
/// timer for ledcolors streaming
QTimer _timer_ledcolors;
// streaming buffers // streaming buffers
QJsonObject _streaming_leds_reply; QJsonObject _streaming_leds_reply;
QJsonObject _streaming_image_reply; QJsonObject _streaming_image_reply;
QJsonObject _streaming_logging_reply; QJsonObject _streaming_logging_reply;
bool _ledcolorsLedsActive = false;
/// flag to determine state of log streaming /// flag to determine state of log streaming
bool _streaming_logging_activated; bool _streaming_logging_activated;
/// mutex to determine state of image streaming /// mutex to determine state of image streaming
QMutex _image_stream_mutex; QMutex _image_stream_mutex;
/// mutex to determine state of led color streaming
QMutex _led_stream_mutex;
/// timeout for live video refresh /// timeout for live video refresh
volatile qint64 _image_stream_timeout; volatile qint64 _image_stream_timeout;
/// timeout for led color refresh
volatile qint64 _led_stream_timeout;
/// ///
/// Handle an incoming JSON Color message /// Handle an incoming JSON Color message
/// ///