1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef BACKGROUNDSERVER_H
- #define BACKGROUNDSERVER_H
- #include <QObject>
- #include <QList>
- #include <QByteArray>
- #include <QJsonArray>
- #include <QJsonDocument>
- #include <QJsonObject>
- #include <QJsonValue>
- #include <QJsonParseError>
- #include "QtWebSockets/QWebSocketServer"
- #include "QtWebSockets/QWebSocket"
- #include <QThread>
- #include <QMutex>
- #include "simulationcontrol.h"
- //QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
- //QT_FORWARD_DECLARE_CLASS(QWebSocket)
- class BackgroundServer : public QObject
- {
- Q_OBJECT
- public:
- QThread *SimThread;
- SimulationControl *sim;
- QWebSocketServer *m_pWebSocketServer;
- QList<QWebSocket *> m_clients;
- explicit BackgroundServer(QObject *parent = nullptr, quint16 port = 80);
- virtual ~BackgroundServer();
- signals:
- void sigGetInit(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetLeadPost(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetTaskPlan(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetGlobalMap(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetPlatformTable(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetInstanceTable(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetRadarInstances(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetRadarParams(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetThaadInstances(QWebSocket *pSender, QJsonObject jsonObj);
- void sigSetThaadStyle(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetThaadParams(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetJammingInstances(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetJammingParams(QWebSocket *pSender, QJsonObject jsonObj);
- void sigSetJammingStyle(QWebSocket *pSender, QJsonObject jsonObj);
- void sigGetESMParams(QWebSocket *pSender, QJsonObject jsonObj);
- public slots:
- void onNewConnection();
- QJsonObject processJsonObj(QJsonObject objin);
- void processMessage(QString message);
- void socketDisconnected();
- void getInit(QJsonObject *obj);
- void getLeadPost(QJsonObject *obj);
- void getTaskPlan(QJsonObject *obj);
- void getGlobalMap(QJsonObject *obj);
- void getPlatformTable(QJsonObject *obj);
- void getInstanceTable(QJsonObject *obj);
- void getESMParams(QJsonObject *obj);
- void getESMData(QJsonObject *obj);
- void getNavParams(QJsonObject *obj);
- void setFreePost(QJsonObject *obj);
- void SlotReturnData(QWebSocket *pSender, QJsonObject *obj);
- };
- #endif // BACKGROUNDSERVER_H
|