hyperion.ng
JsonServer.h
1 #pragma once
2 
3 // Qt includes
4 #include <QSet>
5 
6 // Hyperion includes
7 #include <utils/Components.h>
8 #include <utils/Logger.h>
9 #include <utils/settings.h>
10 
11 class QTcpServer;
12 class QTcpSocket;
15 class NetOrigin;
16 
22 class JsonServer : public QObject
23 {
24  Q_OBJECT
25 
26 public:
31  JsonServer(const QJsonDocument& config);
32  ~JsonServer();
33 
37  uint16_t getPort() const;
38 
39 
40 private slots:
44  void newConnection();
45 
49  void closedConnection(void);
50 
51 public slots:
57  void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
58 
59 private:
61  QTcpServer * _server;
62 
64  QSet<JsonClientConnection *> _openConnections;
65 
67  Logger * _log;
68 
69  NetOrigin* _netOrigin;
70 
72  uint16_t _port = 0;
73 
74  BonjourServiceRegister * _serviceRegister = nullptr;
75 
76  void start();
77  void stop();
78 };
Definition: Logger.h:32
This class creates a TCP server which accepts connections wich can then send in JSON encoded commands...
Definition: JsonServer.h:22
void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config)
Handle settings update from Hyperion Settingsmanager emit or this constructor.
Definition: JsonServer.cpp:73
Definition: bonjourserviceregister.h:43
The Connection object created by JsonServer when a new connection is established. ...
Definition: JsonClientConnection.h:18
JsonServer(const QJsonDocument &config)
JsonServer constructor.
Definition: JsonServer.cpp:17
uint16_t getPort() const
Definition: JsonServer.cpp:87