hyperion.ng
ProtoServer.h
1 #pragma once
2 
3 // util
4 #include <utils/Logger.h>
5 #include <utils/settings.h>
6 
7 // qt
8 #include <QVector>
9 
10 class QTcpServer;
12 
18 class ProtoServer : public QObject
19 {
20  Q_OBJECT
21 
22 public:
23  ProtoServer(const QJsonDocument& config, QObject* parent = nullptr);
24  ~ProtoServer();
25 
26 public slots:
32  void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
33 
34  void initServer();
35 
36 private slots:
40  void newConnection();
41 
45  void clientDisconnected();
46 
47 private:
51  void startServer();
52 
56  void stopServer();
57 
58 
59 private:
60  QTcpServer* _server;
61  Logger* _log;
62  int _timeout;
63  quint16 _port;
64  const QJsonDocument _config;
65 
66  QVector<ProtoClientConnection*> _openConnections;
67 };
Definition: Logger.h:32
This class creates a TCP server which accepts connections wich can then send in Protocol Buffer encod...
Definition: ProtoServer.h:18
void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config)
Handle settings update.
Definition: ProtoServer.cpp:33
The Connection object created by a ProtoServer when a new connection is established.
Definition: ProtoClientConnection.h:23