| | |
| | | |
| | | //警报管理 |
| | | WARNING_REQ, // 警报请求 |
| | | WARNING_RES, // 警报响应 |
| | | WARNING_RES, // 警报响应 |
| | | DATA_REQ, // 数据请求 |
| | | DATA_RES, // 数据响应 |
| | | THRESHOLD_REQ, //阈值请求 |
| | | THRESHOLD_RES, //阈值响应 |
| | | |
| | | |
| | | //生产计划管理 |
| | |
| | | //日志 |
| | | LOGSEARCH_REQ,//日志查询请求 |
| | | LOGSEARCH_RES,//日志查询响应 |
| | | |
| | | //历史查询分析 |
| | | HISTORY_DEV_REQ, //历史查询硬件请求 |
| | | HISTORY_DEV_RES, //历史查询硬件响应 |
| | | HISTORY_PRODUCE_REQ, //历史查询生产请求 |
| | | HISTORY_PRODUCE_RES, //历史查询生产响应 |
| | | HISTORY_ENV_REQ, //历史查询环境请求 |
| | | HISTORY_ENV_RES, //历史查询环境响应 |
| | | |
| | | }; |
| | | |
| | |
| | | struct MDReq//修改请求 |
| | | { |
| | | Head head; |
| | | |
| | | DevicesInfo info; |
| | | MDReq() { |
| | | head.type = MD_REQ; |
| | | head.len = sizeof(MDReq); |
| | |
| | | { |
| | | Head head; |
| | | int status; |
| | | DevicesInfo info[0]; |
| | | QDRes() { |
| | | head.type = QD_RES; |
| | | head.len = sizeof(QDRes); |
| | |
| | | }; |
| | | |
| | | //警报管理 |
| | | // 警报请求结构体 |
| | | struct warningInfo { |
| | | char device_name[32];//设备名称 |
| | | char des[32];//警报描述 |
| | | char time[32];//警报时间 |
| | | float warningdata;//警报数据 |
| | | char type[16];//警报类型 |
| | | char status[16];//警报状态 |
| | | }; |
| | | |
| | | struct dataInfo { |
| | | char device_name[32]; |
| | | char type[16];//环境数据类型 |
| | | float data; |
| | | char time[32];//上传数据时间 |
| | | }; |
| | | |
| | | struct threshInfo { |
| | | char device_name[32]; |
| | | char type[16];//环境类型 |
| | | float min;//最小阈值 |
| | | float max;//最大阈值 |
| | | char time[32];//阈值修改时间 |
| | | }; |
| | | |
| | | //警报请求结构体 |
| | | struct WarningReq { |
| | | Head head; |
| | | Head head; |
| | | warningInfo info[0]; |
| | | |
| | | float oxygenWarning; |
| | | float carbonWarning; |
| | | float tempWarning; |
| | | float humidityWarning; |
| | | WarningReq() { |
| | | head.type = WARNING_REQ; |
| | | head.len = sizeof(WarningReq); |
| | | } |
| | | }; |
| | | |
| | | WarningReq() { |
| | | head.type = WARNING_REQ; |
| | | head.len = sizeof(WarningReq); |
| | | } |
| | | //数据请求结构体 |
| | | struct DataReq { |
| | | Head head; |
| | | dataInfo Info[0]; |
| | | |
| | | DataReq() { |
| | | head.type = DATA_REQ; |
| | | head.len = sizeof(DataReq); |
| | | } |
| | | }; |
| | | |
| | | //阈值请求结构体 |
| | | struct ThresholdReq { |
| | | Head head; |
| | | threshInfo threInfo[0]; |
| | | |
| | | ThresholdReq() { |
| | | head.type = THRESHOLD_REQ; |
| | | head.len = sizeof(ThresholdReq); |
| | | } |
| | | }; |
| | | |
| | | |
| | | struct DataThreshold { |
| | | //阈值 |
| | | float oxygenThreshold; |
| | | float carbonThreshold; |
| | | float tempThreshold; |
| | | float humidityThreshold; |
| | | }; |
| | | |
| | | struct Data { |
| | | float oxygen; // 氧气浓度 |
| | | float carbon; // 一氧化碳浓度 |
| | | float temp; // 温度 |
| | | float humidity; // 湿度 |
| | | }; |
| | | |
| | | // 警报响应结构体 |
| | | //警报响应结构体 |
| | | struct WarningRes { |
| | | Head head; |
| | | int status; // 响应状态(比如 0 表示成功,1 表示失败等) |
| | | const char* message; // 响应消息描述 |
| | | Head head; |
| | | int status;// 响应状态 |
| | | warningInfo warninginfo[0]; |
| | | |
| | | WarningRes(int stat, const char* msg) { |
| | | head.type = WARNING_RES; |
| | | head.len = sizeof(WarningRes); |
| | | status = stat; |
| | | message = msg; |
| | | } |
| | | WarningRes() { |
| | | head.type = WARNING_RES; |
| | | head.len = sizeof(WarningRes); |
| | | } |
| | | }; |
| | | |
| | | struct DataRes { |
| | | Head head; |
| | | int status;// 响应状态 |
| | | dataInfo datainfo[0]; |
| | | |
| | | DataRes() { |
| | | head.type = DATA_RES; |
| | | head.len = sizeof(DataRes); |
| | | } |
| | | }; |
| | | |
| | | struct ThresholdRes { |
| | | Head head; |
| | | int status;// 响应状态 |
| | | threshInfo threInfo[0]; |
| | | |
| | | ThresholdRes() { |
| | | head.type = THRESHOLD_RES; |
| | | head.len = sizeof(ThresholdRes); |
| | | } |
| | | }; |
| | | |
| | | |
| | | //生产计划管理 |
| | | struct PdplanInfo |
| | |
| | | |
| | | |
| | | //历史查询分析 |
| | | // 历史查询请求结构体 |
| | | struct HistoryQueryReq { |
| | | |
| | | //历史查询分析 |
| | | |
| | | struct warningInfo { |
| | | int device_id; |
| | | char des[32]; |
| | | char time[32]; |
| | | float data; |
| | | char type[16]; |
| | | char status[16]; |
| | | }; |
| | | // 历史查询设备信息请求结构体 |
| | | struct HistoryDevReq { |
| | | Head head; |
| | | //根据时间范围查询 |
| | | char startTime[32]; |
| | | char endTime[32]; |
| | | //关键字查询 |
| | | char keyWord[32]; |
| | | HistoryQueryReq() { |
| | | HistoryDevReq() { |
| | | // 初始化数据头 |
| | | head.type = QUERY_MONOUTPUT_REQ; |
| | | head.len = sizeof(HistoryQueryReq); |
| | | head.type = HISTORY_DEV_REQ; |
| | | head.len = sizeof(HISTORY_DEV_REQ); |
| | | // 初始化查询条件字段 |
| | | std::memset(startTime, 0, sizeof(startTime)); |
| | | std::memset(endTime, 0, sizeof(endTime)); |
| | | |
| | | } |
| | | }; |
| | | // 历史查询生产计划请求结构体 |
| | | struct HistoryProReq { |
| | | Head head; |
| | | //根据时间范围查询 |
| | | char startTime[32]; |
| | | char endTime[32]; |
| | | //关键字查询 |
| | | char keyWord[32]; |
| | | HistoryProReq() { |
| | | // 初始化数据头 |
| | | head.type = HISTORY_PRODUCE_REQ; |
| | | head.len = sizeof(HistoryProReq); |
| | | // 初始化查询条件字段 |
| | | } |
| | | }; |
| | | // 历史查询环境信息请求结构体 |
| | | struct HistoryEnvReq { |
| | | Head head; |
| | | //根据时间范围查询 |
| | | char startTime[32]; |
| | | char endTime[32]; |
| | | //关键字查询 |
| | | char keyWord[32]; |
| | | HistoryEnvReq() { |
| | | // 初始化数据头 |
| | | head.type = HISTORY_ENV_REQ; |
| | | head.len = sizeof(HistoryEnvReq); |
| | | // 初始化查询条件字段 |
| | | } |
| | | }; |
| | | |
| | | // 历史查询响应结构体 |
| | | |
| | | // 系统运行状态表相关信息 |
| | | struct HistroyInfo { |
| | | WarningRes warn;//警报查询 |
| | | QDRes dev;//设备查询 |
| | | QueryPdplanRes pro;//生产计划查询 |
| | | }; |
| | | struct HistoryQueryRes { |
| | | //查询设备信息响应结构体 |
| | | struct HistoryDevRes { |
| | | Head head; |
| | | HistroyInfo sys[0]; |
| | | HistoryQueryRes() { |
| | | DevicesInfo dev[0]; |
| | | HistoryDevRes() { |
| | | // 初始化数据头 |
| | | head.type = QUERY_MONOUTPUT_RES; |
| | | head.len = sizeof(HistoryQueryRes); |
| | | head.type = HISTORY_DEV_RES; |
| | | head.len = sizeof(HistoryDevRes); |
| | | } |
| | | }; |
| | | //查询生产计划响应结构体 |
| | | struct HistoryProRes { |
| | | Head head; |
| | | PdplanInfo pro[0]; |
| | | HistoryProRes() { |
| | | // 初始化数据头 |
| | | head.type = HISTORY_PRODUCE_RES; |
| | | head.len = sizeof(HistoryProRes); |
| | | } |
| | | }; |
| | | //查询环境信息响应结构体 |
| | | struct HistoryEnvRes { |
| | | Head head; |
| | | warningInfo env[0]; |
| | | HistoryEnvRes() { |
| | | // 初始化数据头 |
| | | head.type = HISTORY_ENV_RES; |
| | | head.len = sizeof(HistoryEnvRes); |
| | | } |
| | | }; |
| | | |