2016-02-15 18:25:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// STL includes
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
// QT includes
|
|
|
|
#include <QList>
|
|
|
|
#include <QStringList>
|
2016-02-15 20:53:03 +01:00
|
|
|
#include <QHostAddress>
|
2018-12-27 23:11:32 +01:00
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
2016-02-15 18:25:18 +01:00
|
|
|
|
|
|
|
// Utils includes
|
|
|
|
#include <utils/ColorRgb.h>
|
2018-12-27 23:11:32 +01:00
|
|
|
#include <utils/settings.h>
|
|
|
|
#include <utils/Logger.h>
|
|
|
|
|
|
|
|
class Hyperion;
|
|
|
|
|
|
|
|
class MessageForwarder : public QObject
|
2016-02-15 18:25:18 +01:00
|
|
|
{
|
2018-12-27 23:11:32 +01:00
|
|
|
Q_OBJECT
|
2016-02-15 18:25:18 +01:00
|
|
|
public:
|
2016-02-15 20:53:03 +01:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
MessageForwarder(Hyperion* hyperion, const QJsonDocument & config);
|
2016-02-15 18:25:18 +01:00
|
|
|
~MessageForwarder();
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
void addJsonSlave(QString slave);
|
|
|
|
void addProtoSlave(QString slave);
|
2016-02-19 13:31:08 +01:00
|
|
|
|
|
|
|
bool protoForwardingEnabled();
|
2016-09-07 20:10:37 +02:00
|
|
|
bool jsonForwardingEnabled();
|
|
|
|
bool forwardingEnabled() { return jsonForwardingEnabled() || protoForwardingEnabled(); };
|
2018-12-27 23:11:32 +01:00
|
|
|
QStringList getProtoSlaves() const { return _protoSlaves; };
|
|
|
|
QStringList getJsonSlaves() const { return _jsonSlaves; };
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
///
|
|
|
|
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
|
|
|
/// @param type settingyType from enum
|
|
|
|
/// @param config configuration object
|
|
|
|
///
|
|
|
|
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
2016-02-15 18:25:18 +01:00
|
|
|
|
|
|
|
private:
|
2018-12-27 23:11:32 +01:00
|
|
|
Hyperion* _hyperion;
|
|
|
|
Logger* _log;
|
|
|
|
QStringList _protoSlaves;
|
|
|
|
QStringList _jsonSlaves;
|
2016-02-15 18:25:18 +01:00
|
|
|
};
|