You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB
C++

#ifndef CLIENT_H
#define CLIENT_H
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include <httplib.h>
#include <json.hpp>
#include <codecvt>
#include <string>
#include <iostream>
#include <httplib.h>
#include <QString>
#include <QMenu>
using namespace std;
void delNameFromList(QString element);
class FanClass // 风机类
{
public:
int errorCode;
int fanId;
double angle = 0; // 角度
double distance = 0; // 相对距离
QString errorInfo;
QString fanCode;
QString flangeState;
QString headroomState;
QString gyroState;
};
class FanManage // 所有风机管理类
{
public:
std::map<QString, FanClass> allFans; // 所有风机
std::map<QString, QString> states; // 风机状态
std::vector<QString> interruptedFans; // 通讯中断
std::vector<QString> standbyFans; // 待机等风
std::vector<QString> normalFans; // 正常运行
std::vector<QString> hutdownFans; // 停机维护
std::vector<QString> failureFans; // 故障停机
std::vector<QString> runFans; // 启动
};
class HTTPClient
{
private:
httplib::Headers header;
string loginIndex;
string fanListIndex;
string headroomDetailIndex;
string gyroDetailIndex;
string featureHistoryIndex;
public:
httplib::Client client;
HTTPClient();
void getFanList();
QString getFlangeList(int fanId);
QString getHeadroomList(int fanId);
QString getGyroList(int fanId);
QString getHistoryList(int fanId);
};
extern HTTPClient httpClient;
extern FanManage fans;
#endif // CLIENT_H