| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #pragma once
- #define CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH 65535
- #include "httplib.h"
- #include <QThread>
- #include <QMutex>
- #include "json/json.h"
- //#include "zkthttpserverlib_global.h"
- using namespace httplib;
- class QThreadHttpServer : public QThread
- {
- Q_OBJECT
- public:
- QThreadHttpServer(QObject *parent);
- ~QThreadHttpServer();
- void InitHttpServer();
- void run();
- static std::string logData(const Request& req, const Response& res);
- void StopThread();
- void setIPPost(QString strIp,int nServerPost);
- //初始化控制
- static void InitLink(const Request& req, Response& res);
- static QString initOptions(QString strSN,QString PushOptionsFlag);
- //处理上传数据
- static void RtData(const Request& req, Response& res);
- static void AddLogJson(std::string strRequest, std::string strResponse, std::string nAPIID, bool bStatus,bool ServerData=false);
- //void setCallBackData(void* pWND, UserLoginCallBack pCallback);
- //获取所有设备状态
- static void SendAllEqpmtData(Json::Value& pJson);
- //设置设备控制
- static void SetEqpmtData(Json::Value& InJson);
- //设置故障
- static void SetEqpmtFault(Json::Value& InJson);
- //获取子系统设备状态
- static void SendAllSystemData(Json::Value& pJson);
- //课程开启
- static void SetSystemRun(Json::Value& pJson);
- //课程结束
- static void SetSystemStop();
- //获取设备故障列表
- static void GetEqpmtFault(std::string strEqpmt, Json::Value& pJson);
- signals:
- void signal_LoginData(QString strID);
- private:
- //服务器类
- Server* svr;
- //服务器位置信息
- QString m_strServerIP;
- int m_nServerPost;
- static void* pFunWnd;
- //static UserLoginCallBack pFunCtrl;
- QMutex pInitMutex;
- };
|