second part of PR #578

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther
2019-07-14 22:43:22 +02:00
parent ea796160af
commit 90599e820a
52 changed files with 2354 additions and 536 deletions

View File

@@ -11,8 +11,12 @@
#include <QMutex>
#include <QString>
// HyperionInstanceManager
#include <hyperion/HyperionIManager.h>
class JsonCB;
class AuthManager;
class HyperionIManager;
class JsonAPI : public QObject
{
@@ -68,6 +72,14 @@ private slots:
///
void handleTokenResponse(const bool& success, QObject* caller, const QString& token, const QString& comment, const QString& id);
///
/// @brief Handle whenever the state of a instance (HyperionIManager) changes according to enum instanceState
/// @param instaneState A state from enum
/// @param instance The index of instance
/// @param name The name of the instance, just available with H_CREATED
///
void handleInstanceStateChange(const instanceState& state, const quint8& instance, const QString& name = QString());
signals:
///
/// Signal emits with the reply message provided with handleMessage()
@@ -99,6 +111,9 @@ private:
/// Log instance
Logger* _log;
/// Hyperion instance manager
HyperionIManager* _instanceManager;
/// Hyperion instance
Hyperion* _hyperion;
@@ -125,6 +140,14 @@ private:
/// timeout for led color refresh
volatile qint64 _led_stream_timeout;
///
/// @brief Handle the switches of Hyperion instances
/// @param instance the instance to switch
/// @param forced indicate if it was a forced switch by system
/// @return true on success. false if not found
///
const bool handleInstanceSwitch(const quint8& instance = 0, const bool& forced = false);
///
/// Handle an incoming JSON Color message
///
@@ -181,6 +204,13 @@ private:
///
void handleClearCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Clearall message
///
/// @param message the incoming message
///
void handleClearallCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Adjustment message
///
@@ -259,12 +289,11 @@ private:
///
const bool handleHTTPAuth(const QString& command, const int& tan, const QString& token);
///
/// Handle an incoming JSON Clearall message
/// Handle an incoming JSON instance message
///
/// @param message the incoming message
///
void handleClearallCommand(const QJsonObject & message, const QString &command, const int tan);
void handleInstanceCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON message of unknown type

View File

@@ -23,7 +23,7 @@ class JsonCB : public QObject
Q_OBJECT
public:
JsonCB(QObject* parent);
JsonCB(Hyperion* hyperion, QObject* parent);
///
/// @brief Subscribe to future data updates given by cmd
@@ -94,6 +94,11 @@ private slots:
///
void handleSettingsChange(const settings::type& type, const QJsonDocument& data);
///
/// @brief Handle Hyperion instance manager change
///
void handleInstanceChange();
private:
/// pointer of Hyperion instance
Hyperion* _hyperion;