mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Websocket auto serverinfo responder (#443)
* serverinfo cb * remove webui cron * missing header file * tcp connection should trigger to
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonArray>
|
||||
#include <QTimer>
|
||||
|
||||
// hyperion-utils includes
|
||||
#include <utils/Image.h>
|
||||
@@ -170,9 +171,9 @@ public:
|
||||
|
||||
ComponentRegister& getComponentRegister() { return _componentRegister; };
|
||||
|
||||
bool configModified();
|
||||
bool configModified() { return _configMod; };
|
||||
|
||||
bool configWriteable();
|
||||
bool configWriteable() { return _configWrite; };
|
||||
|
||||
/// gets the methode how image is maped to leds
|
||||
int getLedMappingType() { return _ledMAppingType; };
|
||||
@@ -308,6 +309,9 @@ signals:
|
||||
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
||||
void closing();
|
||||
|
||||
/// Signal which is emitted, when state of config or bonjour or priorityMuxer changed
|
||||
void hyperionStateChanged();
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// Updates the priority muxer with the current time and (re)writes the led color with applied
|
||||
@@ -316,9 +320,12 @@ private slots:
|
||||
void update();
|
||||
|
||||
void currentBonjourRecordsChanged(const QList<BonjourRecord> &list);
|
||||
void bonjourRecordResolved(const QHostInfo &hostInfo, int port);
|
||||
void bonjourRecordResolved(const QHostInfo &hostInfo, int port);
|
||||
void bonjourResolve();
|
||||
|
||||
/// check for configWriteable and modified changes, called by _cTimer timeout()
|
||||
void checkConfigState();
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
@@ -335,6 +342,7 @@ private:
|
||||
LedString _ledStringClone;
|
||||
|
||||
std::vector<ColorOrder> _ledStringColorOrder;
|
||||
|
||||
/// The priority muxer
|
||||
PriorityMuxer _muxer;
|
||||
|
||||
@@ -356,7 +364,7 @@ private:
|
||||
// json configuration
|
||||
const QJsonObject& _qjsonConfig;
|
||||
|
||||
// the name of config file
|
||||
/// the name of config file
|
||||
QString _configFile;
|
||||
|
||||
/// The timer for handling priority channel timeouts
|
||||
@@ -396,4 +404,15 @@ private:
|
||||
BonjourServiceResolver _bonjourResolver;
|
||||
BonjourRegister _hyperionSessions;
|
||||
QString _bonjourCurrentServiceToResolve;
|
||||
|
||||
/// Interval timer to check config write and mod
|
||||
QTimer _cTimer;
|
||||
|
||||
/// holds the prev states of configWriteable and modified
|
||||
bool _prevConfigMod = false;
|
||||
bool _prevConfigWrite = true;
|
||||
|
||||
/// holds the current states of configWriteable and modified
|
||||
bool _configMod = false;
|
||||
bool _configWrite = true;
|
||||
};
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
// QT includes
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/ColorRgb.h>
|
||||
@@ -18,8 +20,9 @@
|
||||
/// and the muxer keeps track of all active priorities. The current priority can be queried and per
|
||||
/// priority the led colors.
|
||||
///
|
||||
class PriorityMuxer
|
||||
class PriorityMuxer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
/// The information structure for a single priority channel
|
||||
@@ -118,6 +121,18 @@ public:
|
||||
///
|
||||
void setCurrentTime(const int64_t& now);
|
||||
|
||||
signals:
|
||||
///
|
||||
/// Signal which is called, when a effect or color with timeout is running, once per second
|
||||
///
|
||||
void timerunner();
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// Slots which is called to adapt to 1s interval for signal timerunner()
|
||||
///
|
||||
void emitReq();
|
||||
|
||||
private:
|
||||
/// The current priority (lowest value in _activeInputs)
|
||||
int _currentPriority;
|
||||
@@ -128,4 +143,7 @@ private:
|
||||
/// The information of the lowest priority channel
|
||||
InputInfo _lowestPriorityInfo;
|
||||
|
||||
QTimer _timer;
|
||||
QTimer _blockTimer;
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user