wsserver.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef WSSERVER_H
  2. #define WSSERVER_H
  3. #include <QObject>
  4. #include <QList>
  5. #include <QByteArray>
  6. #include <QJsonArray>
  7. #include <QJsonDocument>
  8. #include <QJsonObject>
  9. #include <QJsonValue>
  10. #include <QJsonParseError>
  11. #include "QtWebSockets/QWebSocketServer"
  12. #include "QtWebSockets/QWebSocket"
  13. #include "../share/algorithms/coder_array.h"
  14. #include "../share/algorithms/fun1_false_target_distance.h"
  15. #include "../share/algorithms/fun2.h"
  16. #include "../share/algorithms/fun4_S_jam.h"
  17. #include "../share/algorithms/fun8_2_FMjamming_H.h"
  18. #include "../share/algorithms/fun8_AMJamming_H.h"
  19. #include "../share/algorithms/fun8_3_jamming_H.h"
  20. #include "../share/algorithms/fun5.h"
  21. #include "../share/algorithms/fun6.h"
  22. #include "../share/algorithms/fun7_DRFMRF.h"
  23. //QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
  24. //QT_FORWARD_DECLARE_CLASS(QWebSocket)
  25. class WSServer : public QObject
  26. {
  27. Q_OBJECT
  28. public:
  29. QWebSocketServer *m_pWebSocketServer;
  30. QList<QWebSocket *> m_clients;
  31. explicit WSServer(QObject *parent = nullptr, quint16 port = 80);
  32. virtual ~WSServer();
  33. signals:
  34. public slots:
  35. void onNewConnection();
  36. QJsonObject processJsonObj(QJsonObject objin);
  37. void processMessage(QString message);
  38. void socketDisconnected();
  39. void getInit(QWebSocket *pSender, QJsonObject obj);
  40. void getPlatformTable(QWebSocket *pSender, QJsonObject obj);
  41. void getLeadPost(QWebSocket *pSender, QJsonObject obj);
  42. void getTaskPlan(QWebSocket *pSender, QJsonObject obj);
  43. void getGlobalMap(QWebSocket *pSender, QJsonObject obj);
  44. void getRadarInstances(QWebSocket *pSender, QJsonObject obj);
  45. void getRadarParams(QWebSocket *pSender, QJsonObject obj);
  46. void getJammingInstances(QWebSocket *pSender, QJsonObject obj);
  47. void getJammingParams(QWebSocket *pSender, QJsonObject obj);
  48. void setJammingStyle(QWebSocket *pSender, QJsonObject obj);
  49. void getJammingSig(QWebSocket *pSender, QJsonObject obj);
  50. void returnMessage(QWebSocket *pSender, QJsonObject *obj);
  51. };
  52. #endif // WSSERVER_H