webservercontrol.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef WEBSERVERCONTROL_H
  2. #define WEBSERVERCONTROL_H
  3. #include <QObject>
  4. #include <vector>
  5. #include <map>
  6. #include "platformobject.h"
  7. #include "parametersetting.h"
  8. using namespace std;
  9. QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
  10. QT_FORWARD_DECLARE_CLASS(QWebSocket)
  11. QT_FORWARD_DECLARE_CLASS(QString)
  12. class WebServerControl : public QObject
  13. {
  14. Q_OBJECT
  15. public:
  16. private:
  17. static WebServerControl* m_pWebServerControl;
  18. public:
  19. static WebServerControl*GetInstance();
  20. static void FreeInstance();
  21. explicit WebServerControl(quint16 port, QObject *parent = nullptr);
  22. WebServerControl(QObject *parent = nullptr);
  23. ~WebServerControl();
  24. void InitQWebSocketServer(quint16 port );
  25. private slots:
  26. void onNewConnection();
  27. void processMessage(const QByteArray &message);
  28. void socketDisconnected();
  29. void processMessageText(const QString &message);
  30. void InitHeadCooko();
  31. void Parse_Now_Json(const QByteArray &arrayjson);
  32. void InsertMapPlatObject(QString strType,const DataPlatform &item);
  33. public:
  34. void CalcAver();
  35. void CalcdeviationCompensation();
  36. void CalculateDeviationPercentage();
  37. void ParseJson(const QByteArray &arrayjson);
  38. private:
  39. QWebSocketServer *m_pWebSocketServer;
  40. vector<QWebSocket *> m_vClients;
  41. PlatformObject* m_pBinancePlatformObject;
  42. map<QString,PlatformObject*> m_mPlatformObjects;
  43. ParameterSetting m_ParameterSetting;
  44. };
  45. #endif // WEBSERVERCONTROL_H