stec-platform
autoqtcpserver.h
1 #ifndef AUTOQTCPSERVER_H
2 #define AUTOQTCPSERVER_H
3 
4 
5 #include <QObject>
6 #include <QString>
7 #include <QHash>
8 #include <QTcpServer>
9 #include <QTcpSocket>
10 #include <QVariant>
11 #include <QVariantList>
12 #include <algo.h>
13 #include <platform_global.h>
14 
15 namespace ADI {
16 
17 
18 
19 class AutoQTcpSocket;
20 
28 class PLATFORMSHARED_EXPORT AutoQTcpServer : public QObject
29 {
30  Q_OBJECT
31 
32 private :
33 
34  QHash <QString, AutoQTcpSocket *> PeerClients;
35  QHash <QString, AutoQTcpSocket *> PeerServers;
36  QTcpServer *server;
37  QString ourKey;
38  QList<QString> selfAdrList();
39 
40  public:
42  explicit AutoQTcpServer( QObject *parent = nullptr);
43 
45  virtual ~AutoQTcpServer();
46 
48  void StartDaemon(QString interface, QString netmask, int servicePort, bool doDaemon = true, bool doClient = true);
49 
50 private slots :
51 
53  void PacketReadyDaemon( QString interfaceAddress, int servicePort, QVariantList va);
54 
56  void PacketReadyClient( QString interfaceAddress, int servicePort, QVariantList va);
57 
58 
60  void SlotConnectedClient(QString interface, int port);
61 
63  void SlotDisconnectedClient(QString interface, int port);
64 
66  void SlotDisconnectedDaemon(QString interface, int port);
67 
69  void KnockKnock();
70 
71 
72 public slots :
73 
79  void WriteAsDaemon( QString Key, QVariantList &vl );
80 
86  void WriteAsClient( QString Key, QVariantList &vl );
87 
88 signals :
89 
91  void SigClientConnected(QString key);
92 
94  void SigClientDisconnected(QString key);
95 
97  void SigDaemonConnected(QString key);
98 
100  void SigDaemonDisconnected(QString key);
101 
103  void SigDaemonPacketReady( QString key, QVariantList msg );
104 
106  void SigClientPacketReady( QString key, QVariantList msg );
107 
108 };
109 }
110 #endif // AUTOQTCPSERVER_H
The AutoQTcpServer class This is a level #1 layer class.. It does all the connections to all the node...
Definition: autoqtcpserver.h:29
void SigDaemonPacketReady(QString key, QVariantList msg)
signal Daemon message packet ready for key of key
void SigClientConnected(QString key)
signal client connected with the key of key
void SigClientPacketReady(QString key, QVariantList msg)
signal Client message packet ready for key of key
void SigClientDisconnected(QString key)
signal client disconnected with the key of key
void SigDaemonDisconnected(QString key)
signal daemon disconnected with key of key
void SigDaemonConnected(QString key)
signal daemon connected with key of key
Definition: autoqtcpdistribution.cpp:10