hyperion.ng/include/jsonserver/JsonServer.h
Paulchen-Panther 657fe00211
Troubleshooting and ...
- More i18n
- Easy use of mutual exclusion in JsonAPI with QMutexLocker
- Smoothing type "linear" hidden in the WebUI, because there is currently only one
- Message forwarding implemented again
- For compatibility to home assistants and other remote controls, "activeEffects" and "activeLedColor" has been added to the JSON-RPC
- FlatBuffer clear now the Priority on disconnect
- The information "available V4L2 devices" is now only displayed if the device list is not empty
- LED device "PiBlaster" excluded from OSX build
2019-02-03 14:36:57 +01:00

79 lines
1.6 KiB
C++

#pragma once
// Qt includes
#include <QSet>
// Hyperion includes
#include <utils/Components.h>
#include <utils/Logger.h>
#include <utils/settings.h>
class QTcpServer;
class QTcpSocket;
class JsonClientConnection;
class BonjourServiceRegister;
class NetOrigin;
///
/// This class creates a TCP server which accepts connections wich can then send
/// in JSON encoded commands. This interface to Hyperion is used by hyperion-remote
/// to control the leds
///
class JsonServer : public QObject
{
Q_OBJECT
public:
///
/// JsonServer constructor
/// @param The configuration
///
JsonServer(const QJsonDocument& config);
~JsonServer();
///
/// @return the port number on which this TCP listens for incoming connections
///
uint16_t getPort() const;
private slots:
///
/// Slot which is called when a client tries to create a new connection
///
void newConnection();
///
/// Slot which is called when a client closes a connection
///
void closedConnection(void);
public slots:
///
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
/// @param type settings type from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
private:
/// The TCP server object
QTcpServer * _server;
/// List with open connections
QSet<JsonClientConnection *> _openConnections;
/// the logger instance
Logger * _log;
NetOrigin* _netOrigin;
/// port
uint16_t _port = 0;
BonjourServiceRegister * _serviceRegister = nullptr;
void start();
void stop();
};