From 204ed8bff86568e57acae30cd905a4ba70f5f0f0 Mon Sep 17 00:00:00 2001 From: lzx <2246256235@qq.com> Date: 星期六, 09 十一月 2024 17:02:14 +0800 Subject: [PATCH] 项目总结 --- common.h | 1778 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 1,087 insertions(+), 691 deletions(-) diff --git a/common.h b/common.h index 3fb2653..022d89f 100644 --- a/common.h +++ b/common.h @@ -1,718 +1,1176 @@ #ifndef COMMON_H #define COMMON_H -#include <iostream> -#include <cstring> -#include <QString> + +#include <string.h> + +enum TypeInfo { + + //注册登录 + LOGIN_REQ, // 登录请求 + LOGIN_RES, // 登录响应 + REGISTER_REQ, //注册请求 + REGISTER_RES, //注册响应 + RESET_REQ, //重置密码请求 + RESET_RES, //重置密码响应 -enum TypeInfo{ + //权限管理 + QUERY_PMS_REQ, // 按员工编号、名字或职位查询人员权限信息请求 + UPDATE_PMS_REQ, // 按角色id更新权限信息请求 + QUERY_PMS_RES, // 查询人员和角色信息的响应结构体 + UPDATE_PMS_RES, // 权限更新结果响应体 - //娉ㄥ唽鐧诲綍 - LOGIN_REQ, // 鐧诲綍璇锋眰 - LOGIN_RES, // 鐧诲綍鍝嶅簲 - REGISTER_REQ, //娉ㄥ唽璇锋眰 - REGISTER_RES, //娉ㄥ唽鍝嶅簲 - RESET_REQ, //閲嶇疆瀵嗙爜璇锋眰 - RESET_RES, //閲嶇疆瀵嗙爜鍝嶅簲 + //设备管理 + AD_REQ,//添加设备请求 + AD_RES,//添加设备响应 + MD_REQ,//修改设备请求 + MD_RES,//修改设备响应 + QD_REQ,//查询设备请求 + QD_RES,//查询设备响应 + + //地图标注 + MML_REQ,//地图标注加载请求 + MML_RES,//地图标注加载响应 + MMI_REQ,//地图标注插入请求 + MMI_RES,//地图标注插入响应 + MMD_REQ,//地图标注删除请求 + MMD_RES,//地图标注删除响应 + + //大屏显示 + ENVIRONMENT_REQ,//环境数据请求 + ENVIRONMENT_RES,//环境数据响应 + DEVICESTATUS_REQ,//设备状态请求 + DEVICESTATUS_RES,//设备状态响应 + MOVEMENTRECORD_REQ,//操作日志请求 + MOVEMENTRECORD_RES,//操作日志响应 + ALARMRECORD_REQ,//警报记录请求 + ALARMRECORD_RES,//警报记录响应 + YIELD_REQ,//煤矿产量请求 + YIELD_RES,//煤矿产量响应 + COAL_MINE_RODER_REQ,//煤矿订单请求 + COAL_MINE_RODER_RES,//煤矿订单响应 + + //警报管理 + WARNING_REQ, // 警报请求 + WARNING_RES, // 警报响应 + DATA_REQ, // 数据请求 + DATA_RES, // 数据响应 + THRESHOLD_REQ, //阈值请求 + THRESHOLD_RES, //阈值响应 - //鏉冮檺绠$悊 - QUERY_PMS_REQ, // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰 - UPDATE_PMS_REQ, // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰 - QUERY_PMS_RES, // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣� - UPDATE_PMS_RES, // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣� - //璁惧绠$悊 - AD_Req,//娣诲姞璁惧璇锋眰 - AD_Res,//娣诲姞璁惧鍝嶅簲 - DD_Req,//鍋滄璁惧璇锋眰 - DD_Res,//鍋滄璁惧璇锋眰 - PD_Req,//鏆傚仠璁惧璇锋眰 - PD_Res,//鏆傚仠璁惧璇锋眰 - - //鍦板浘鏍囨敞 - MAPMARK_REQ,//鍦板浘鏍囨敞璇锋眰 - MAPMARK_RES//鍦板浘鏍囨敞鍝嶅簲 - - //澶у睆鏄剧ず - ENVIRONMENT_REQ,//鐜鏁版嵁璇锋眰 - ENVIRONMENT_RES,//鐜鏁版嵁鍝嶅簲 - DEVICESTATUS_REQ,//璁惧鐘舵�佽姹� - DEVICESTATUS_RES,//璁惧鐘舵�佸搷搴� - MOVEMENTRECORD_REQ,//鎿嶄綔鏃ュ織璇锋眰 - MOVEMENTRECORD_RES,//鎿嶄綔鏃ュ織鍝嶅簲 - ALARMRECORD_REQ,//璀︽姤璁板綍璇锋眰 - ALARMRECORD_RES,//璀︽姤璁板綍鍝嶅簲 - YIELD_REQ,//鐓ょ熆浜ч噺璇锋眰 - YIELD_RES,//鐓ょ熆浜ч噺鍝嶅簲 - - //璀︽姤绠$悊 - WARNING_REQ, // 璀︽姤璇锋眰 - WARNING_RES, // 璀︽姤鍝嶅簲 + //生产计划管理 + ADD_PDPLAN_REQ,//添加生产计划的请求结构体 + ADD_PDPLAN_RES,//添加生产计划的响应结构体 + DEL_PDPLAN_REQ,//删除生产计划的请求结构体 + DEL_PDPLAN_RES,//删除生产计划的响应结构体 + UPDATE_PDPLAN_REQ,//更改生产计划的请求结构体 + UPDATE_PDPLAN_RES,//更改生产计划的响应结构体 + QUERY_PDPLAN_REQ,//查询生产计划的请求结构体 + QUERY_PDPLAN_RES,//查询生产计划的响应结构体 - //鐢熶骇璁″垝绠$悊 - ADD_PRODUCTION_PLAN_REQ,//娣诲姞涓�琛屾暟鎹殑璇锋眰缁撴瀯浣� - ADD_PRODUCTION_PLAN_RES,//娣诲姞涓�琛屾暟鎹殑鍝嶅簲缁撴瀯浣� - UPDATE_PRODUCTION_PLAN_QUANTITY_REQ,// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑璇锋眰缁撴瀯浣� - UPDATE_PRODUCTION_PLAN_QUANTITY_RES,// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑鍝嶅簲缁撴瀯浣� - UPDATE_PRODUCTION_PLAN_LOG_REQ,//鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勮姹傜粨鏋勪綋 - UPDATE_PRODUCTION_PLAN_LOG_RES,//鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勫搷搴旂粨鏋勪綋 - PRODUCTION_PLAN_REQ,// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勮姹傜粨鏋勪綋 - PRODUCTION_PLAN_RES,// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勫搷搴旂粨鏋勪綋 - FORRECENT_FOURTEEN_PRODUCTION_PLANS_REQ,//鏌ヨ杩戝崄鍥涙潯鐨勮姹傜粨鏋勪綋 - FORRECENT_FOURTEEN_PRODUCTION_PLANS_RES //鏌ヨ杩戝崄鍥涙潯鐨勫搷搴旂粨鏋勪綋 + ADD_MONOUTPUT_REQ,//添加日产量的请求结构体 + ADD_MONOUTPUT_RES,//添加日产量的响应结构体 + DEL_MONOUTPUT_REQ,//删除日产量的请求结构体 + DEL_MONOUTPUT_RES,//删除日产量的响应结构体 + UPDATE_MONOUTPUT_REQ,//更新日产量的请求结构体 + UPDATE_MONOUTPUT_RES,//更新日产量的响应结构体 + QUERY_MONOUTPUT_REQ,//查询日产量的请求结构体 + QUERY_MONOUTPUT_RES,//查询日产量的响应结构体 - //鍘嗗彶鏌ヨ鍒嗘瀽 - HISTORY_QUERY_REQ, // 鍘嗗彶鏌ヨ璇锋眰 - HISTORY_QUERY_RES, // 鍘嗗彶鏌ヨ鍝嶅簲 + //历史查询 + HISTORY_DEV_REQ, //历史查询硬件请求 + HISTORY_DEV_RES, //历史查询硬件响应 + HISTORY_PRODUCE_REQ, //历史查询生产请求 + HISTORY_PRODUCE_RES, //历史查询生产响应 + HISTORY_ENV_REQ, //历史查询环境请求 + HISTORY_ENV_RES, //历史查询环境响应 + HISTORY_MON_REQ, //历史查询月产量请求 + HISTORY_MON_RES, //历史查询月产量响应 - //鑷姩鍗囩骇 - VERSIONNUM_REQ, // 鐗堟湰鍙疯姹� - VERSIONNUM_RES, // 鐗堟湰鍙峰搷搴� - UPLOAD_FILE_REQ, // 涓婁紶鏂囦欢鐨勮姹� - UPLOAD_FILE_RES, // 涓婁紶鏂囦欢鐨勫搷搴� - VERSIONINFOENTRY_REQ, // 鐗堟湰淇℃伅褰曞叆璇锋眰 - VERSIONINFOENTRY_RES, //鐗堟湰淇℃伅褰曞叆鍝嶅簲 - VERSIONUPDATE_REQ, // 鐗堟湰鏇存柊璇锋眰 - VERSIONUPDATE_RES, // 鐗堟湰鏇存柊鍝嶅簲 - FILEDOWNLOADS_REQ, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰 - FILEDOWNLOADS_RES, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲 - DOWNLOADSUCCESSFULLY_RES // 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴� - //鏃ュ織 - LOGSEARCH_REQ;//鏃ュ織鏌ヨ璇锋眰 - LOGSEARCH_RES;//鏃ュ織鏌ヨ鍝嶅簲 + //自动升级 + VERSION_UPDATE_REQ, // 版本更新请求 + VERSION_UPDATE_RES, // 版本更新响应 + FILE_DOWNLOADS_REQ, // 版本更新文件下载请求 + FILE_DOWNLOADS_RES, // 版本更新文件下载响应 + DOWNLOAD_SUCCESSFULLY_RES, // 更新文件下载成功的响应 + + //版本管理 + VERSION_NUM_REQ, // 版本号请求 + VERSION_NUM_RES, // 版本号响应 + UPLOAD_FILE_REQ, // 上传文件的请求 + UPLOAD_FILE_RES, // 上传文件的响应 + VERSION_INFOENTRY_REQ, // 版本信息录入请求 + VERSION_INFOENTRY_RES, //版本信息录入响应 - + //日志 + LOGSEARCH_REQ,//日志查询请求 + LOGSEARCH_RES,//日志查询响应 + }; -struct Head{ - int type; - int len; +struct Head { + int type; + int len; }; -//娉ㄥ唽鐧诲綍 -//鐧诲綍璇锋眰 - struct LoginReq - { - Head head; - char user_name[32]; - char password[32]; - LoginReq(){ - head.type = LOGIN_REQ; - head.len = sizeof(LoginReq); - } - }; - - struct Permission - { - int admin; - int log_search; //鏃ュ織鏌ヨ - int history; //鍘嗗彶璁板綍 - int map_change;//鍦板浘 - int version_manage; // 鐗堟湰绠$悊 - int warning; //璀︽姤 - int device_manage; //璁惧绠$悊 - int pro_plan;//鐢熶骇璁″垝 - char role_name[32]; // 瑙掕壊鍚� - }; - - //鐧诲綍鍝嶅簲 - struct LoginRes - { - Head head; - char user_name[32]; - int status; // 鐧诲綍鐘舵�� - // 鐧诲綍鎴愬姛鏃讹紝璇ヨ处鍙峰搴旂殑鏉冮檺缁勫悎 - Permission per; - LoginRes() - { - head.type = LOGIN_RES; - head.len = sizeof(LoginRes); - }; - }; - - //娉ㄥ唽璇锋眰 - struct RegisterReq - { - Head head; - char user_name[32]; - char password[32]; - char email[50]; - int telephone; - RegisterReq(){ - head.type = REGISTER_REQ; - head.len = sizeof(RegisterReq); - } - }; - - //娉ㄥ唽鍝嶅簲 - struct RegisterRes - { - Head head; - char user_name[32]; - int status; // 娉ㄥ唽鐘舵�� - //娉ㄥ唽鎴愬姛锛岄粯璁ゆ渶灏忔潈闄愮粍鍚� - Permission per; - RegisterRes() - { - head.type = REGISTER_RES; - head.len = sizeof(RegisterRes); - }; - }; - - //閲嶇疆瀵嗙爜璇锋眰 - struct ResetReq - { - Head head; - char email[50]; - char password[32]; - ResetReq(){ - head.type = RESET_REQ; - head.len = sizeof(ResetReq); - } - }; - - //閲嶇疆瀵嗙爜鍝嶅簲 - struct ResetRes - { - Head head; - char user_name[32]; - int status; // 閲嶇疆瀵嗙爜鐘舵�� - ResetRes() - { - head.type = RESET_RES; - head.len = sizeof(ResetRes); - }; - }; - - -//鏉冮檺绠$悊 -// 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰 -typedef struct QueryPmsRequest{ - Head head; - char userNo[32]; - char name[32]; - char permissonType[32]; - QueryPmsRequest(){ - head.type=QUERY_PMS_REQ; - memset(userNo,0,32); - memset(permissonType,0,32); - memset(name,0,32); - head.len = sizeof(QueryPmsRequest); - } -} QueryPmsRequest; - -// 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰 -typedef struct UpdatePmsRequest{ - Head head; - int roleId; - int queryHistory; - int loggerSearch; - int mapMark; - int devManage; - int productPlan; - UpdatePmsRequest(){ - head.type=QUERY_PMS_RES; - head.len = sizeof(UpdatePmsRequest); - } -} UpdatePmsRequest; - -// 鍗曚釜浜哄憳鏉冮檺缁撴瀯浣� -typedef struct PmsRes{ - int queryHistory; - int loggerSearch; - int mapMark; - int devManage; - int productPlan; - int roleId; - char userNo[32]; - char name[32]; - char permissonType[32]; - char startDateTime[32]; - char endDateTime[32]; -} PmsRes; - -// 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣� -typedef struct QueryPmsResponse{ - Head head; - int success; // 1涓烘垚鍔� ,0涓哄け璐� - char pmsList[0]; - QueryPmsResponse(){ - head.type=QUERY_PMS_RES; - } -} QueryPmsResponse; - -// 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣� -struct UpdatePmsResponse{ - Head head; - int success; // 1涓烘垚鍔� ,0涓哄け璐� - UpdatePmsResponse(){ - head.type = UPDATE_PMS_RES; - head.len = sizeof(UpdatePmsResponse); - } - -} UpdatePmsResponse ; - - -//璁惧绠$悊 -//娣诲姞璁惧 -struct ADReq +//注册登录 +//登录请求 +struct LoginReq { Head head; - char Device_Name[32]; - ADReq() { - head.type = AD_Req; - head.len = sizeof(AD_Req); + char userName[32]; + char password[100]; + LoginReq() { + head.type = LOGIN_REQ; + head.len = sizeof(LoginReq); + } +}; + +struct Permission +{ + int admin;//超级管理员 + int loggerSearch; //日志查询 + int queryHistory; //历史记录 + int mapMark;//地图 + int versionManage; // 版本管理 + int warning; //警报 + int devManage; //设备管理 + int productPlan;//生产计划 + char roleName[32]; // 角色名 +}; + +//登录响应 +struct LoginRes +{ + Head head; + char userName[32]; + int status; // 登录状态 + // 登录成功时,该账号对应的权限组合 + Permission per; + LoginRes() + { + head.type = LOGIN_RES; + head.len = sizeof(LoginRes); + } +}; + +//注册请求 +struct RegisterReq +{ + Head head; + char userName[32]; + char password[100]; + char email[32]; + char telephone[32]; + RegisterReq() { + head.type = REGISTER_REQ; + head.len = sizeof(RegisterReq); + } +}; + +//注册响应 +struct RegisterRes +{ + Head head; + char userName[32]; + int status; // 注册状态 + RegisterRes() + { + head.type = REGISTER_RES; + head.len = sizeof(RegisterRes); + } +}; + +//重置密码请求 +struct ResetReq +{ + Head head; + char userName[32]; + char email[32]; + char password[100];//新密码 + ResetReq() { + head.type = RESET_REQ; + head.len = sizeof(ResetReq); + } +}; + +//重置密码响应 +struct ResetRes +{ + Head head; + char userName[32]; + int status; // 重置密码状态 + ResetRes() + { + head.type = RESET_RES; + head.len = sizeof(ResetRes); + } +}; + +//权限管理 +// 按员工编号、名字或职位查询人员权限信息请求 +typedef struct QueryPmsReq { + Head head; + char userNo[32]; + char name[32]; + char permissonType[32]; + QueryPmsReq() { + head.type = QUERY_PMS_REQ; + memset(userNo, 0, 32); + memset(permissonType, 0, 32); + memset(name, 0, 32); + head.len = sizeof(QueryPmsReq); + } +} QueryPmsReq; + +// 按角色id更新权限信息请求 +typedef struct UpdatePmsReq { + Head head; + // 人员表主键id + int id; + int queryHistory; + int loggerSearch; + int mapMark; + int devManage; + int productPlan; + int warningManage; + int versionManage; //版本管理 + int admin; //系统管理员 + + char permissonType[32]; + UpdatePmsReq() { + head.type = QUERY_PMS_RES; + head.len = sizeof(UpdatePmsReq); + } +} UpdatePmsReq; + +// 单个人员和权限联合查询结构体 +typedef struct PmsRes { + int queryHistory; + int loggerSearch; + int mapMark; + int devManage; + int productPlan; + int versionManage; //版本管理 + int warningManage; + int admin; //系统管理员 + + int id; + + char userNo[32]; + char name[32]; + + char permissonType[32]; // 角色类型 + + char department[32]; + char loginTime[32]; + char registerTime[32]; +} PmsRes; + +// 查询人员和角色信息的响应结构体 +typedef struct QueryPmsRes { + Head head; + int success; // 1为成功 ,0为失败 + PmsRes pmsList[0]; + QueryPmsRes() { + head.type = QUERY_PMS_REQ; + } +} QueryPmsRes; + +// 权限更新结果响应体 +struct UpdatePmsRes { + Head head; + int success; // 1为成功 ,0为失败 + UpdatePmsRes() { + head.type = UPDATE_PMS_RES; + head.len = sizeof(UpdatePmsRes); } }; -struct ADPermission + + + + + +//设备管理 +struct DevicesInfo { - char Device_Name[32]; - char Device_Status[32]; - char Start_Time[32]; - char Work_Time[32]; - char Manufacturer[100]; - char Devices_Type[32]; + int id;//设备ID + char deviceName[32];//设备名称 + char deviceType[32];//设备类型 + char deviceSerialNumber[32];//设备编码 + char deviceStatus[32];//设备状态 + char area[100];//地区 + double longitude;//经度 + double latitude;//纬度 + char purchasingTime[15];//购买时间 + char installTime[15];//安装时间 + char manufacturer[100];//厂家 }; -struct ADRes +//添加设备 +struct ADReq//添加请求 { Head head; + DevicesInfo devInfo[0]; + ADReq() { + head.type = AD_REQ; + head.len = sizeof(ADReq); + } - ADPermission per; +}; + +struct ADRes//添加响应 +{ + Head head; + int status; ADRes() { - head.type = AD_Res; + head.type = AD_RES; head.len = sizeof(ADRes); } }; - -//鍋滄璁惧 -struct DDReq +//修改设备 +struct MDReq//修改请求 { Head head; - char Device_Name[32]; - DDReq() { - head.type = DD_Req; - head.len = sizeof(DDReq); + DevicesInfo info; + char condition[32]; + char modifiedContent[100]; + double laOrLo; + MDReq() { + head.type = MD_REQ; + head.len = sizeof(MDReq); } }; -struct DDPermission -{ - char Device_Name[32]; - char Device_Status[32]; - char Start_Time[32]; - char Work_Time[32]; - char Manufacturer[100]; - char Devices_Type[32]; -}; -struct DDRes +struct MDRes//修改响应 { Head head; - - DDPermission per; - DDRes() { - head.type = DD_Res; - head.len = sizeof(DDRes); + int status; + char conditon[32]; + char modifiedContent[100]; + double laOrLo; + MDRes() { + head.type = MD_RES; + head.len = sizeof(MDRes); } }; - -//鏆傚仠璁惧 -struct PDReq +//查询设备 +struct QDReq//查询请求 { Head head; - char Device_Name[32]; - PDReq() { - head.type = PD_Req; - head.len = sizeof(PDReq); + DevicesInfo info; + char buyTimeBegin[15]; + char buyTimeEnd[15]; + char installTimeBegin[15]; + char installTimeEnd[15]; + QDReq() { + head.type = QD_REQ; + head.len = sizeof(QDReq); } }; -struct PDPermission -{ - char Device_Name[32]; - char Device_Status[32]; - char Start_Time[32]; - char Work_Time[32]; - char Manufacturer[100]; - char Devices_Type[32]; -}; -struct PDRes +struct QDRes//查询响应 { Head head; - - PDPermission per; - PDRes() { - head.type = PD_Res; - head.len = sizeof(PDRes); + int status; + DevicesInfo info[0]; + QDRes() { + head.type = QD_RES; + head.len = sizeof(QDRes); } }; -//鍦板浘鏍囨敞 -struct MapMarkReq -{ - Head head; - int marktype;//鎻掑叆銆佸垹闄ゃ�佸姞杞� - MaskInfo msg[0];//鏌旀�ф暟缁� - MapMarkReq(){ - head.type = MAPMARK_REQ; - head.len = sizeof(MapMarkReq); - } -}; - -//鍦板浘鍝嶅簲锛� +//地图标注 struct MarkInfo { - int markId;//鏍囨敞鐐筰d - double latitude;//绾害 - double longitude;//缁忓害 - int deviceId;//璁惧ID - int deviceStatus;//璁惧鐘舵�� - char deviceName[32];//璁惧鍚嶇О + char markId[32];//标注点id设备编号 + double latitude;//纬度 + double longitude;//经度 + char deviceStatus[32];//设备状态 + char deviceName[32];//设备名称 }; - -struct MapMarkRes +//地图标注加载请求 +struct MMLReq//地图 { Head head; - int markType;//鎻掑叆杩樻槸鍒犻櫎 - int status; // 鎿嶄綔鐘舵�乢鎴愬姛/澶辫触 - MaskInfo info[0];//鏌旀�ф暟缁� - MapMarkRes() - { - head.type = MAPMARK_RES; - head.len = sizeof(MapMarkRes); - }; + MMLReq() { + head.type = MML_REQ; + head.len = sizeof(MMLReq); + } +}; +//地图标注加载响应: +struct MMLRes +{ + Head head; + int status;//操作状态 + MarkInfo info[0]; + MMLRes() { + head.type = MML_RES; + head.len = sizeof(MMLRes); + } +}; +//地图标注插入请求 +struct MMIReq//地图 +{ + Head head; + MarkInfo info[0]; + MMIReq() { + head.type = MMI_REQ; + head.len = sizeof(MMIReq); + } +}; +//地图标注插入响应: +struct MMIRes +{ + Head head; + int status;//操作状态 + MarkInfo info[0]; + MMIRes() { + head.type = MMI_RES; + head.len = sizeof(MMIRes); + } }; -//澶у睆鏄剧ず -//鐜鏁版嵁璇锋眰 +//地图标注删除请求 +struct MMDReq//地图 +{ + Head head; + MarkInfo info[0]; + MMDReq() { + head.type = MMD_REQ; + head.len = sizeof(MMDReq); + } +}; +//地图标注删除响应: +struct MMDRes +{ + Head head; + int status;//操作状态 + MarkInfo info[0]; + MMDRes() { + head.type = MMD_RES; + head.len = sizeof(MMDRes); + } +}; + +//大屏显示 +//环境数据请求 struct EnvironmentReq { Head head; - float temp;//娓╁害 - float humidity;//婀垮害 - float oxygen;//姘ф皵娴撳害 - float carbon;//涓�姘у寲纰虫祿搴� + char place[32];//地区 + char nowTime[32];//当时时间 EnvironmentReq(){ head.type = ENVIRONMENT_REQ; head.len = sizeof(EnvironmentReq); } }; -//璁惧鐘舵�佽姹� +//环境数据响应 +struct Environment +{ + char dataType[32];//数据类型 + float envdata;//数据 +}; +struct EnvironmentRes +{ + Head head; + int status; + Environment environment[0]; + EnvironmentRes(){ + head.type = ENVIRONMENT_RES; + head.len = sizeof(EnvironmentRes); + } +}; +//设备状态请求 struct DeviceStatusReq { Head head; - int device_ID;//璁惧缂栧彿 - char device_Name[32];//璁惧鍚嶇О - char device_Status[32];//璁惧鐘舵�� DeviceStatusReq(){ head.type = DEVICESTATUS_REQ; head.len = sizeof(DeviceStatusReq); } }; -//鎿嶄綔鏃ュ織璇锋眰 +//设备状态响应 +struct Area +{ + double longitude;//经度 + double latitude;//纬度AA + char area[64];//地区 +}; +struct DeviceStatus +{ + int deviceID;//设备编号 + char deviceName[32];//设备名称 + double longitude;//经度 + double latitude;//纬度AA + char deviceStatus[32];//设备状态 + char area[64];//地区 +}; +struct DeviceStatusRes +{ + Head head; + int status; + DeviceStatus deviceStatus[0]; + DeviceStatusRes(){ + head.type = DEVICESTATUS_RES; + head.len = sizeof(DeviceStatusRes); + } +}; +//操作日志请求 struct MovementRecordReq { Head head; - char user_Name;//鎿嶄綔鐢ㄦ埛鍚� - char operate_Time[32];//鎿嶄綔鏃堕棿 - char device_Name[32];//鎿嶄綔璁惧 - char movement[256];//鎿嶄綔鎻忚堪 MovementRecordReq(){ head.type = MOVEMENTRECORD_REQ; head.len = sizeof(MovementRecordReq); } }; -//璀︽姤璁板綍璇锋眰 +//操作日志响应 +struct MovementRecord +{ + char userName[32];//操作用户名 + char operateTime[32];//操作时间 + char deviceName[32];//操作设备 + double longitude;//经度 + double latitude;//纬度 + char movement[256];//操作描述 +}; +struct MovementRecordRes +{ + Head head; + int status; + MovementRecord movementRecord[0]; + MovementRecordRes(){ + head.type = MOVEMENTRECORD_RES; + head.len = sizeof(MovementRecordRes); + } +}; +//警报记录请求 struct AlarmRecordReq { Head head; - char alarm_Time[32];//璀︽姤鏃堕棿 - char alarm_type[32];//瑙e喅鏃堕棿 - char alarm_Content[256];//璀︽姤鍐呭 AlarmRecordReq(){ head.type = ALARMRECORD_REQ; head.len = sizeof(AlarmRecordReq); } }; -//鐓ょ熆浜ч噺璇锋眰 +//警报记录响应 +struct AlarmRecord +{ + char alarmTime[32];//警报时间 + char alarmtype[32];//处理状态 + double longitude;//经度 + double latitude;//纬度 + char alarmContent[256];//警报内容 +}; +struct AlarmRecordRes +{ + Head head; + int status; + AlarmRecord alarmRecord[0]; + AlarmRecordRes(){ + head.type = ALARMRECORD_RES; + head.len = sizeof(AlarmRecordRes); + } +}; +//煤矿产量请求 struct YieldReq { Head head; - int month;//鏈堜唤 - int yield;//浜ч噺 + char startTime[64];//开始时间 + char finishTime[64];//结束时间 YieldReq(){ head.type = YIELD_REQ; head.len = sizeof(YieldReq); } }; - -//璀︽姤绠$悊 -// 璀︽姤璇锋眰缁撴瀯浣� -struct WarningReq { - Head head; - float oxygen; // 姘ф皵娴撳害 - float carbon; // 涓�姘у寲纰虫祿搴� - float temp; // 娓╁害 - float humidity; // 婀垮害 - - WarningReq() { - head.type = WARNING_REQ; - head.len = sizeof(WarningReq); - } -}; - -// 璀︽姤鍝嶅簲缁撴瀯浣� -struct WarningRes { - Head head; - int status; // 鍝嶅簲鐘舵�侊紙姣斿 0 琛ㄧず鎴愬姛锛�1 琛ㄧず澶辫触绛夛級 - const char* message; // 鍝嶅簲娑堟伅鎻忚堪 - - WarningRes(int stat, const char* msg) { - head.type = WARNING_RES; - head.len = sizeof(WarningRes); - status = stat; - message = msg; - } -}; - -//鐢熶骇璁″垝绠$悊 -//娣诲姞涓�琛屾暟鎹殑璇锋眰缁撴瀯浣� -struct AddProductionPlanReq { - Head head; - int type; - char productionDate[32]; - int productionQuantity; - int plannedProductionQuantity; - int predictedProductionQuantity; - char logText[256]; - AddProductionPlanReq() { - head.type = ADD_PRODUCTION_PLAN_REQ; - head.len = sizeof(AddProductionPlanReq); - } +//煤矿产量响应 +struct Yield +{ + double sumA;//A产量 + double sumB;//B产量 + double sumC;//C产量 }; -//娣诲姞涓�琛屾暟鎹殑鍝嶅簲缁撴瀯浣� -struct AddProductionPlanRes { - Head head; - int type; - int status; // 鍙互琛ㄧず娣诲姞鏄惁鎴愬姛锛� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛 - AddProductionPlanRes() { - head.type = ADD_PRODUCTION_PLAN_RES; - head.len = sizeof(AddProductionPlanRes); - } -}; - -// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑璇锋眰缁撴瀯浣� -struct UpdateProductionPlanQuantityReq { - Head head; - int type; - int plannedProductionQuantity; - char productionDate[32]; - UpdateProductionPlanQuantityReq() { - head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ; - head.len = sizeof(UpdateProductionPlanQuantityReq); - } -}; -// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑鍝嶅簲缁撴瀯浣� -struct UpdateProductionPlanQuantityRes { - Head head; - int type; - int status; // 鍙互琛ㄧず鏇存柊鏄惁鎴愬姛锛屼緥濡� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛 - UpdateProductionPlanQuantityRes() { - head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_RES; - head.len = sizeof(UpdateProductionPlanQuantityRes); - } -}; - - -// 鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勮姹傜粨鏋勪綋 -struct UpdateProductionPlanLogReq { - Head head; - int type; - char logText[256]; - char productionDate[32]; - UpdateProductionPlanLogReq() { - head.type = UPDATE_PRODUCTION_PLAN_LOG_REQ; - head.len = sizeof(UpdateProductionPlanLogReq); - } -}; -// 鏇存柊鐢熶骇璁″垝璇锋眰锛堟棩蹇楋級鐨勫搷搴旂粨鏋勪綋 -struct UpdateProductionPlanLogRes { - Head head; - int type; - int status; // 鍙互琛ㄧず鏇存柊鏄惁鎴愬姛锛屼緥濡� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛 - UpdateProductionPlanLogRes() { - head.type = UPDATE_PRODUCTION_PLAN_LOG_RES; - head.len = sizeof(UpdateProductionPlanLogRes); - } -}; - - - -// 鏌ヨ鐢熶骇璁″垝淇℃伅璇锋眰 -struct ProductionPlanReq { - Head head; - int type; - int len; - char productionDate[32]; - int productionQuantity; - int plannedProductionQuantity; - int predictedProductionQuantity; - char logText[256]; - ProductionPlanReq() { - head.type = PRODUCTION_PLAN_REQ; - head.len = sizeof(ProductionPlanReq); - } -}; -// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勫搷搴旂粨鏋勪綋 -struct ProductionPlanRes { - Head head; - int type; - int len; - int productionQuantity; - int plannedProductionQuantity; - int predictedProductionQuantity; - int roleId; - char productionDate[32]; - char logText[256]; - ProductionPlanRes() { - head.type = PRODUCTION_PLAN_REQ; - head.len = sizeof(ProductionPlanRes); - } -}; - - - -//鏌ヨ杩戝崄鍥涙潯鐨勮姹傜粨鏋勪綋 -struct RecentFourteenProductionPlansReq { - Head head; - int requestType; - RecentFourteenProductionPlansReq() { - head.type = RECENTFOURTEENPRODUCTIONPLANS_REQ; - head.len = sizeof(RecentFourteenProductionPlansReq); - } -}; -//鏌ヨ杩戝崄鍥涙潯鐨勫搷搴旂粨鏋勪綋 -struct RecentFourteenProductionPlansRes { - Head head; - int responseType; - int responseLength; - int productionQuantities[14]; - int plannedProductionQuantities[14]; - int predictedProductionQuantities[14]; - int roleIds[14]; - char productionDates[14][32]; - char logTexts[14][256]; - RecentFourteenProductionPlansRes() { - head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ; - head.len = sizeof(RecentFourteenProductionPlansRes); - } -}; - - - -//鍘嗗彶鏌ヨ鍒嗘瀽 -// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣� -struct HistoryQueryReq { +struct YieldRes +{ Head head; - //鏍规嵁鏃堕棿鑼冨洿鏌ヨ - char start_time[32]; - char end_time[32]; - - HistoryQueryReq() { - // 鍒濆鍖栨暟鎹ご - head.type = HISTORY_QUERY_REQ; - head.len = sizeof(HistoryQueryReq); - // 鍒濆鍖栨煡璇㈡潯浠跺瓧娈� - std::memset(start_time, 0, sizeof(start_time)); - std::memset(end_time, 0, sizeof(end_time)); + int status; + Yield yield[0]; + YieldRes(){ + head.type = YIELD_RES; + head.len = sizeof(YieldRes); + } +}; +//订单查询请求 +struct CoaMinRodReq +{ + Head head; + char planName[64];//订单名 + CoaMinRodReq(){ + head.type = COAL_MINE_RODER_REQ; + head.len = sizeof(CoaMinRodReq); + } +}; +//订单查询响应 +struct CoaMinRod +{ + char startTime[64];//起始日期 + char finishTime[64];//交付日期 + char proName[64];//产品名 + double planPro;//计划生产量 + double actPro;//实际生产量 +}; +struct CoaMinRodRes +{ + Head head; + int status; + CoaMinRod coaMinRod[0]; + CoaMinRodRes(){ + head.type = COAL_MINE_RODER_RES; + head.len = sizeof(CoaMinRodReS); } }; -// 绯荤粺杩愯鐘舵�佽〃鐩稿叧淇℃伅 -struct Histroy_Info{ - int sysId; // 瀵瑰簲绯荤粺杩愯鐘舵�佽〃鐨勮褰曠紪鍙� - QString sysDataCollectionTime; // 鏁版嵁閲囬泦鏃堕棿 - QString sysDeviceType; // 璁惧绫诲瀷 - QString sysDeviceId; // 璁惧缂栧彿 - QString sysDeviceStatus; // 璁惧鐘舵�� - QString sysSystemStatus; // 绯荤粺鏁翠綋杩愯鐘舵�佹弿杩� - - int devId; // 瀵瑰簲璁惧璇︾粏淇℃伅琛ㄧ殑璁板綍缂栧彿 - QString devDeviceType; // 璁惧绫诲瀷锛堜笌绯荤粺杩愯鐘舵�佽〃涓殑璁惧绫诲瀷瀵瑰簲锛屽彲鐢ㄤ簬鍏宠仈锛� - QString devDeviceId; // 璁惧缂栧彿锛堜笌绯荤粺杩愯鐘舵�佽〃涓殑璁惧缂栧彿瀵瑰簲锛屽彲鐢ㄤ簬鍏宠仈锛� - QString devModel; // 璁惧鍨嬪彿 - QString runDeviceStatus; // 璁惧鐘舵�� - QString runFaultAlarmTime; // 鏁呴殰鎶ヨ鏃堕棿 - QString runFaultDescription; // 鏁呴殰璇︾粏鎻忚堪 - - int safetyId; // 瀵瑰簲璁惧瀹夊叏鐘舵�佽〃鐨勮褰曠紪鍙� - QString safetyDataCollectionTime; // 鏁版嵁閲囬泦鏃堕棿锛堝彲鐢ㄤ簬鍏宠仈涓嶅悓琛ㄥ湪鍚屼竴鏃堕棿鐐圭殑鏁版嵁鎯呭喌锛� - QString safetyDeviceType; // 璁惧绫诲瀷锛堢敤浜庡叧鑱旓級 - QString safetyDeviceId; // 璁惧缂栧彿锛堢敤浜庡叧鑱旓級 - QString safetyStatus; // 璁惧瀹夊叏鐘舵�� - QString safetyParameter; // 瀹夊叏鍙傛暟 +//警报管理 +struct warningInfo { + char device_name[32];//设备名称 + char des[32];//警报描述 + char time[32];//警报时间 + float warningdata;//警报数据 + char type[16];//警报类型 + char status[16];//警报状态 }; -// 鍘嗗彶鏌ヨ鍝嶅簲缁撴瀯浣� -// 瀹夊叏鐘舵�佽〃鐩稿叧淇℃伅 -struct HistoryQueryRes { + +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; + warningInfo info[0]; + + 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 WarningRes { + Head head; + int status;// 响应状态 + warningInfo warninginfo[0]; + + 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 +{ + char planName[32];//订单划名字 + char startDate[32];//起始日期 + char closingDate[32];//交付日期 + char pdName[8];//产品名 + double plannedPd;//计划生产量 + double actualPd;//实际生产量 + double progress;//生产进度 + int finishOntime;//是否按期完成 +}; + +struct MonoutputInfo +{ +<<<<<<< HEAD + char month[32];//鏈堜唤 + double aOutput;//a浜у搧鏈堜骇閲� + double bOutput;//b浜у搧鏈堜骇閲� + double cOutput;//c浜у搧鏈堜骇閲� +======= + char date[32];//日期 + double aOutput;//a产品月产量 + double bOutput;//b产品月产量 + double cOutput;//c产品月产量 +>>>>>>> 83817169914cd859e4a7e0b5f0685dd0c072a974 +}; + +//添加生产计划的请求结构体 +struct AddPdplanReq +{ + Head head; + PdplanInfo info[0]; + AddPdplanReq() { + head.type = ADD_PDPLAN_REQ; + head.len = sizeof(AddPdplanReq); + } +}; +//添加一条生产计划的响应结构体 +struct AddPdplanRes +{ + Head head; + int status;//表示是否添加成功,0否1是 + AddPdplanRes() { + head.type = ADD_PDPLAN_RES; + head.len = sizeof(AddPdplanRes); + } +}; + +//删除生产计划的请求结构体 +struct DelPdplanReq +{ + Head head; + PdplanInfo info[0]; + DelPdplanReq() { + head.type = DEL_PDPLAN_REQ; + head.len = sizeof(DelPdplanReq); + } +}; + +//删除生产计划的响应结构体 +struct DelPdplanRes +{ + Head head; + int status;//表示是否删除成功,0否1是 + DelPdplanRes() { + head.type = DEL_PDPLAN_RES; + head.len = sizeof(DelPdplanRes); + } +}; + +//更改生产计划的请求结构体. +struct UpdatePdplanReq +{ + Head head; + PdplanInfo info; + UpdatePdplanReq() { + head.type = UPDATE_PDPLAN_REQ; + head.len = sizeof(UpdatePdplanReq); + } +}; + +//更改生产计划的响应结构体 +struct UpdatePdplanRes +{ + Head head; + int status;//表示是否更新成功,0否1是 + UpdatePdplanRes() { + head.type = UPDATE_PDPLAN_RES; + head.len = sizeof(UpdatePdplanRes); + } +}; + +//查询生产计划的请求结构体 +struct QueryPdplanReq +{ + Head head; + int planId;//订单编号 + char planName[32];//订单划名字 + char startDate[32];//起始日期 + char closingDate[32];//交付日期 + char pdName[8];//产品名 + double plannedPd;//计划生产量 + double actualPd;//实际生产量 + double progress;//生产进度 + int finishOntime;//是否按期完成 + QueryPdplanReq() { + head.type = QUERY_PDPLAN_REQ; + head.len = sizeof(QueryPdplanReq); + } +}; + +//查询生产计划的响应结构体 +struct QueryPdplanRes +{ + Head head; + int status;//表示是否添加成功,0否1是 + PdplanInfo info[0]; + QueryPdplanRes() { + head.type = QUERY_PDPLAN_RES; + head.len = sizeof(QueryPdplanRes); + } +}; + + +//添加日产量的请求结构体 +struct AddMonoutputReq +{ + Head head; + MonoutputInfo info[0]; + AddMonoutputReq() { + head.type = ADD_MONOUTPUT_REQ; + head.len = sizeof(AddMonoutputReq); + } +}; + +//添加日产量的响应结构体 +struct AddMonoutputRes +{ + Head head; + int status;//表示是否添加成功,0否1是 + AddMonoutputRes() { + head.type = ADD_MONOUTPUT_RES; + head.len = sizeof(AddMonoutputRes); + } +}; + +//删除日产量的请求结构体 +struct DelMonoutputReq +{ + Head head; + MonoutputInfo info[0]; + DelMonoutputReq() { + head.type = DEL_MONOUTPUT_REQ; + head.len = sizeof(DelMonoutputReq); + } +}; + +//删除日产量的响应结构体 +struct DelMonoutputRes +{ + Head head; + int status;//表示是否删除成功,0否1是 + DelMonoutputRes() { + head.type = DEL_MONOUTPUT_RES; + head.len = sizeof(DelMonoutputRes); + } +}; + +//更改日产量的请求结构体. +struct UpdateMonoutputReq +{ + Head head; + MonoutputInfo info[0]; + UpdateMonoutputReq() { + head.type = UPDATE_MONOUTPUT_REQ; + head.len = sizeof(UpdateMonoutputReq); + } +}; + +//更改日产量的响应结构体 +struct UpdateMonoutputRes +{ + Head head; + int status;//表示是否更新成功,0否1是 + MonoutputInfo info[0]; + UpdateMonoutputRes() { + head.type = UPDATE_MONOUTPUT_RES; + head.len = sizeof(UpdateMonoutputRes); + } +}; + +//查询日产量的请求结构体 +struct QueryMonoutputReq +{ + Head head; + int date;//日期 + double aOutput;//a产品月产量 + double bOutput;//b产品月产量 + double cOutput;//c产品月产量 + + QueryMonoutputReq() { + head.type = QUERY_MONOUTPUT_REQ; + head.len = sizeof(QueryMonoutputReq); + } +}; + +//查询日产量的响应结构体 +struct QueryMonoutputRes +{ + Head head; + int status;//表示是否添加成功,0否1是 + MonoutputInfo info[0]; + QueryMonoutputRes() { + head.type = QUERY_MONOUTPUT_RES; + head.len = sizeof(QueryMonoutputRes); + } +}; + + + +//历史查询 +// 历史查询设备信息请求结构体 +struct HistoryDevReq { Head head; - Histroy_Info sys[0]; - - HistoryQueryRes() { - // 鍒濆鍖栨暟鎹ご - head.type = HISTORY_QUERY_RES; - head.len = sizeof(HistoryQueryRes); + //根据时间范围查询 + char startTime[32]; + char endTime[32]; + //关键字查询 + char keyWord[32]; + HistoryDevReq() { + // 初始化数据头 + memset(this,0,sizeof(HistoryDevReq)); + head.type = HISTORY_DEV_REQ; + head.len = sizeof(HISTORY_DEV_REQ); + // 初始化查询条件字段 } - +}; +// 历史查询生产计划请求结构体 +struct HistoryProReq { + Head head; + //根据时间范围查询 + char startTime[32]; + char endTime[32]; + //关键字查询 + char keyWord[32]; + HistoryProReq() { + // 初始化数据头 + memset(this,0,sizeof(HistoryProReq )); + head.type = HISTORY_PRODUCE_REQ; + head.len = sizeof(HistoryProReq); + // 初始化查询条件字段 + } +}; +// 历史查询月产量请求结构体 +struct HistoryMonReq { + Head head; + //根据时间范围查询 + char startTime[32]; + char endTime[32]; + //关键字查询 + char keyWord[32]; + HistoryMonReq() { + // 初始化数据头 + memset(this,0,sizeof(HistoryMonReq)); + head.type = HISTORY_MON_REQ; + head.len = sizeof(HistoryMonReq); + // 初始化查询条件字段 + } +}; +// 历史查询环境信息请求结构体 +struct HistoryEnvReq { + Head head; + //根据时间范围查询 + char startTime[32]; + char endTime[32]; + //关键字查询 + char keyWord[32]; + HistoryEnvReq() { + // 初始化数据头 + memset(this,0,sizeof(HistoryEnvReq)); + head.type = HISTORY_ENV_REQ; + head.len = sizeof(HistoryEnvReq); + // 初始化查询条件字段 + } +}; +//查询设备信息响应结构体 +struct HistoryDevRes { + Head head; + DevicesInfo dev[0]; + HistoryDevRes() { + // 初始化数据头 + 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 VersionNumReq // 鐗堟湰鍙疯姹� -{ +//查询环境信息响应结构体 +struct HistoryEnvRes { + Head head; + dataInfo env[0]; + HistoryEnvRes() { + // 初始化数据头 + head.type = HISTORY_ENV_RES; + head.len = sizeof(HistoryEnvRes); + } +}; +//查询月产量 +struct HistoryMonRes { + Head head; + MonoutputInfo mon[0]; + HistoryMonRes() { + // 初始化数据头 + head.type = HISTORY_MON_RES; + head.len = sizeof(HistoryMonRes); + } +}; + + +//自动升级 +// 版本更新请求 +struct VersionUpdateReq { Head head; - VersionNumReq() { - head.type = VERSIONNUM_REQ; - head.len = sizeof(VersionNumReq); + + char curVersionId[64]; // 版本号 + VersionUpdateReq() + { + head.type = VERSION_UPDATE_REQ; + head.len = sizeof(VersionUpdateReq); } }; -struct VersionNumRes // 鐗堟湰鍙峰搷搴� -{ + +// 版本更新响应 +struct VersionUpdateRes { Head head; - char version_id[64]; // 鐗堟湰鍙� - VersionNumRes() { - head.type = VERSIONNUM_RES; - head.len = sizeof(VersionNumRes); + bool state = false; + char versionId[64]; // 版本号 + char updateDate[32]; // 更新时间 + char versionDescription[1024]; //更新描述 + + VersionUpdateRes() + { + head.type = VERSION_UPDATE_RES; + head.len = sizeof(VersionUpdateRes); } }; -// 鏂囦欢浼犺緭 +// 版本更新文件下载请求 +struct FileDownloadsReq { + Head head; + char versionId[64]; // 版本号 + FileDownloadsReq() + { + head.type = FILE_DOWNLOADS_REQ; + head.len = sizeof(FileDownloadsReq); + } +}; + +// 版本更新文件下载响应 +struct FileDownloadsRes { + Head head; + char versionId[64]; // 版本号 + char filename[128]; //文件名 + long long filesize; //文件大小 + char c_filepath[128]; //客户端放最新版本的本地路径 + int fileNum; // 文件数量 + long long allFileSize; // 文件总大小 + char content[0]; + FileDownloadsRes() + { + head.type = FILE_DOWNLOADS_RES; + head.len = sizeof(FileDownloadsRes); + } +}; + +// 更新文件下载成功的响应 +struct DownloadSuccessfullyRes { + Head head; + bool state = false; + char fileName[256]; + long long fileSize; + DownloadSuccessfullyRes() + { + head.type = DOWNLOAD_SUCCESSFULLY_RES; + head.len = sizeof(DownloadSuccessfullyRes); + } +}; + +//版本管理 +struct VersionNumReq // 版本号请求 +{ + Head head; + VersionNumReq() { + head.type = VERSION_NUM_REQ; + head.len = sizeof(VersionNumReq); + } +}; + +struct VersionNumRes // 版本号响应 +{ + Head head; + char versionId[64]; // 版本号 + VersionNumRes() { + head.type = VERSION_NUM_RES; + head.len = sizeof(VersionNumRes); + } +}; + +// 文件传输 struct FileInfo { - char file_name[256]; - long long file_size; + char fileName[256]; + long long fileSize; char s_filepath[128]; - char content[0]; }; -struct UploadFileReq // 涓婁紶鏂囦欢鐨勮姹� +struct UploadFileReq // 上传文件的请求 { - Head head; - FileInfo fileInfo; - UploadFileReq() { - head.type = UPLOAD_FILE_REQ; - head.len = sizeof(UploadFileReq); - } + Head head; + FileInfo fileInfo; + UploadFileReq() { + head.type = UPLOAD_FILE_REQ; + head.len = sizeof(UploadFileReq); + } }; -struct UploadFileRes { // 涓婁紶鏂囦欢鐨勫搷搴� +struct UploadFileRes { // 上传文件的响应 Head head; bool state = false; - char file_name[256]; + char fileName[256]; long long file_size; UploadFileRes() { @@ -721,141 +1179,79 @@ } }; -// 鐗堟湰淇℃伅褰曞叆 -// 璇锋眰 +// 版本信息录入 +// 请求 struct VersionInfoEntryReq { Head head; - char version_id[64]; // 鐗堟湰鍙� - char version_id_old[64]; // 涓婁竴涓増鏈彿 - char s_filepath[16][128]; //鏈嶅姟鍣ㄦ斁鏈�鏂扮増鏈殑璺緞 - char version_description[256]; //鏇存柊鍐呭 - char version_creattime[32]; // 鏇存柊鏃堕棿 - char filename[16][128]; - long long filesize[16]; - char c_filepath[16][128]; + char versionId[64]; // 版本号 + char versionIdOld[64]; // 上一个版本号 int fileNum; + char c_filepath[32]; //服务器放最新版本的路径 + char versionDescription[256]; //更新内容 + char versionCreattime[32]; // 更新时间 + FileInfo fileInfo[0] ; //包含下载文件信息 VersionInfoEntryReq() { - head.type = VERSIONINFOENTRY_REQ; + head.type = VERSION_INFOENTRY_REQ; head.len = sizeof(VersionInfoEntryReq); } }; -// 鐗堟湰淇℃伅褰曞叆鍝嶅簲 +// 版本信息录入响应 struct VersionInfoEntryRes { Head head; bool state = false; VersionInfoEntryRes() { - head.type = VERSIONINFOENTRY_RES; + head.type = VERSION_INFOENTRY_RES; head.len = sizeof(VersionInfoEntryRes); } }; -// 鐗堟湰鏇存柊璇锋眰 -struct VersionUpdateReq { - Head head; - - char cur_version_id[64]; // 鐗堟湰鍙� - VersionUpdateReq() - { - head.type = VERSIONUPDATE_REQ; - head.len = sizeof(VersionUpdateReq); - } +//日志 +struct ParsedLog { + char timeStamp[64]; // 时间戳 + char deviceId[64]; // 设备ID + char level[16]; // 日志级别 + char content[256]; // 日志内容 + char userId[64]; // 用户ID + char fileName[32]; //文件名 + int problemLine; //产生错误行号 + char functionName[32]; //函数名 }; -// 鐗堟湰鏇存柊鍝嶅簲 -struct VersionUpdateRes { - Head head; - bool state = false; - char version_id[64]; // 鐗堟湰鍙� - char update_date[32]; // 鏇存柊鏃堕棿 - char version_description[1024]; //鏇存柊鎻忚堪 - - VersionUpdateRes() - { - head.type = VERSIONUPDATE_RES; - head.len = sizeof(VersionUpdateRes); - } -}; - -// 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰 -struct FileDownloadsReq { - Head head; - char version_id[64]; // 鐗堟湰鍙� - FileDownloadsReq() - { - head.type = FILEDOWNLOADS_REQ; - head.len = sizeof(FileDownloadsReq); - } -}; - -// 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲 -struct FileDownloadsRes { - Head head; - char version_id[64]; // 鐗堟湰鍙� - char filename[128]; //鏂囦欢鍚� - long long filesize; //鏂囦欢澶у皬 - char c_filepath[128]; //瀹㈡埛绔斁鏈�鏂扮増鏈殑鏈湴璺緞 - int fileNum; // 鏂囦欢鏁伴噺 - long long all_fileSize; // 鏂囦欢鎬诲ぇ灏� - char content[0]; - FileDownloadsRes() - { - head.type = FILEDOWNLOADS_RES; - head.len = sizeof(FileDownloadsRes); - } -}; - -// 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴� -struct DownloadSuccessfullyRes{ - Head head; - bool state = false; - char file_name[256]; - long long file_size; - DownloadSuccessfullyRes() - { - head.type = DOWNLOADSUCCESSFULLY_RES; - head.len = sizeof(DownloadSuccessfullyRes); - } -}; - -//鏃ュ織 -struct ParsedLog { - char timestamp[64]; // 鏃堕棿鎴� - char device_id[64]; // 璁惧ID - char level[16]; 聽 聽 // 鏃ュ織绾у埆 - char content[256]; 聽// 鏃ュ織鍐呭 - char source[64]; 聽 聽// 鏉ユ簮妯″潡 - char user_id[64]; 聽 // 鐢ㄦ埛ID -}; - -// 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣� +// 日志查询请求结构体 struct LogQueryReq { - Head head; // 鏁版嵁澶� - char keyWords[32]; // 瀛樺偍鍏抽敭瀛楃殑鏁扮粍 - // 鏃犲弬鏋勯�犲嚱鏁� + Head head; // 数据头 + int logLimit; //服务端发送日志数量限制 + char startTime[20]; // 根据实际需要调整大小 + char endTime[20]; // 根据实际需要调整大小 + char content[256]; // 日志内容 + char level[16]; //日志级别 + char deviceId[64]; // 设备ID + // 无参构造函数 LogQueryReq() { head.type = LOGSEARCH_REQ; - head.len = sizeof(LogQueryReq); + head.len = sizeof(LogQueryReq); } }; -// 鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣� +// 日志查询响应结构体 struct LogQueryRes { - Head head; - int status; // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触) - char errorMessage[256]; // 閿欒淇℃伅锛堝鏋滄湁锛� - - // 鏃犲弬鏋勯�犲嚱鏁� - LogQueryRes() { - head.type = LOGSEARCH_RES; + Head head; + int status; // 响应状态 (如 1 表示成功) + ParsedLog parsedLog[0]; // 使用柔性数组存储查询结果 + + // 无参构造函数 + LogQueryRes() { + head.type = LOGSEARCH_RES; head.len = sizeof(LogQueryRes); - } + } }; + #endif // COMMON_H \ No newline at end of file -- Gitblit v1.8.0