From 3ed51f1c3194d7a4a1e992fe845e023a488563f3 Mon Sep 17 00:00:00 2001 From: wangky <m1561510467@163.com> Date: 星期四, 07 十一月 2024 17:34:51 +0800 Subject: [PATCH] 最新 --- common.h | 877 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 498 insertions(+), 379 deletions(-) diff --git a/common.h b/common.h index 2eb4a0f..bb0a5f2 100644 --- a/common.h +++ b/common.h @@ -3,9 +3,9 @@ #include <string.h> -enum TypeInfo{ +enum TypeInfo { - //娉ㄥ唽鐧诲綍 + //娉ㄥ唽鐧诲綍 LOGIN_REQ, // 鐧诲綍璇锋眰 LOGIN_RES, // 鐧诲綍鍝嶅簲 REGISTER_REQ, //娉ㄥ唽璇锋眰 @@ -14,47 +14,51 @@ RESET_RES, //閲嶇疆瀵嗙爜鍝嶅簲 - //鏉冮檺绠$悊 - QUERY_PMS_REQ, // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰 - UPDATE_PMS_REQ, // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰 - QUERY_PMS_RES, // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣� - UPDATE_PMS_RES, // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣� + //鏉冮檺绠$悊 + QUERY_PMS_REQ, // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰 + UPDATE_PMS_REQ, // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰 + QUERY_PMS_RES, // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣� + UPDATE_PMS_RES, // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣� - //璁惧绠$悊 - AD_REQ,//娣诲姞璁惧璇锋眰 + //璁惧绠$悊 + AD_REQ,//娣诲姞璁惧璇锋眰 AD_RES,//娣诲姞璁惧鍝嶅簲 MD_REQ,//淇敼璁惧璇锋眰 MD_RES,//淇敼璁惧鍝嶅簲 QD_REQ,//鏌ヨ璁惧璇锋眰 QD_RES,//鏌ヨ璁惧鍝嶅簲 - //鍦板浘鏍囨敞 - MML_REQ,//鍦板浘鏍囨敞鍔犺浇璇锋眰 - MML_RES//鍦板浘鏍囨敞鍔犺浇鍝嶅簲 + //鍦板浘鏍囨敞 + MML_REQ,//鍦板浘鏍囨敞鍔犺浇璇锋眰 + MML_RES,//鍦板浘鏍囨敞鍔犺浇鍝嶅簲 MMI_REQ,//鍦板浘鏍囨敞鎻掑叆璇锋眰 - MMI_RES//鍦板浘鏍囨敞鎻掑叆鍝嶅簲 + MMI_RES,//鍦板浘鏍囨敞鎻掑叆鍝嶅簲 MMD_REQ,//鍦板浘鏍囨敞鍒犻櫎璇锋眰 - MMD_RES//鍦板浘鏍囨敞鍒犻櫎鍝嶅簲 + MMD_RES,//鍦板浘鏍囨敞鍒犻櫎鍝嶅簲 //澶у睆鏄剧ず ENVIRONMENT_REQ,//鐜鏁版嵁璇锋眰 - ENVIRONMENT_RES,//鐜鏁版嵁鍝嶅簲 - DEVICESTATUS_REQ,//璁惧鐘舵�佽姹� - DEVICESTATUS_RES,//璁惧鐘舵�佸搷搴� - MOVEMENTRECORD_REQ,//鎿嶄綔鏃ュ織璇锋眰 - MOVEMENTRECORD_RES,//鎿嶄綔鏃ュ織鍝嶅簲 - ALARMRECORD_REQ,//璀︽姤璁板綍璇锋眰 - ALARMRECORD_RES,//璀︽姤璁板綍鍝嶅簲 - YIELD_REQ,//鐓ょ熆浜ч噺璇锋眰 - YIELD_RES,//鐓ょ熆浜ч噺鍝嶅簲 + ENVIRONMENT_RES,//鐜鏁版嵁鍝嶅簲 + DEVICESTATUS_REQ,//璁惧鐘舵�佽姹� + DEVICESTATUS_RES,//璁惧鐘舵�佸搷搴� + MOVEMENTRECORD_REQ,//鎿嶄綔鏃ュ織璇锋眰 + MOVEMENTRECORD_RES,//鎿嶄綔鏃ュ織鍝嶅簲 + ALARMRECORD_REQ,//璀︽姤璁板綍璇锋眰 + ALARMRECORD_RES,//璀︽姤璁板綍鍝嶅簲 + YIELD_REQ,//鐓ょ熆浜ч噺璇锋眰 + YIELD_RES,//鐓ょ熆浜ч噺鍝嶅簲 //璀︽姤绠$悊 WARNING_REQ, // 璀︽姤璇锋眰 WARNING_RES, // 璀︽姤鍝嶅簲 + DATA_REQ, // 鏁版嵁璇锋眰 + DATA_RES, // 鏁版嵁鍝嶅簲 + THRESHOLD_REQ, //闃堝�艰姹� + THRESHOLD_RES, //闃堝�煎搷搴� - //鐢熶骇璁″垝绠$悊 - ADD_PDPLAN_REQ,//娣诲姞涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣� + //鐢熶骇璁″垝绠$悊 + ADD_PDPLAN_REQ,//娣诲姞涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣� ADD_PDPLAN_RES,//娣诲姞涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣� DEL_PDPLAN_REQ,//鍒犻櫎涓�鏉$敓浜ц鍒掔殑璇锋眰缁撴瀯浣� DEL_PDPLAN_RES,//鍒犻櫎涓�鏉$敓浜ц鍒掔殑鍝嶅簲缁撴瀯浣� @@ -74,29 +78,36 @@ QUERY_MONOUTPUT_RES,//鏌ヨ鏈堜骇閲忕殑鍝嶅簲缁撴瀯浣� - //鑷姩鍗囩骇 - VERSION_NUM_REQ, // 鐗堟湰鍙疯姹� - VERSION_NUM_RES, // 鐗堟湰鍙峰搷搴� - UPLOAD_FILE_REQ, // 涓婁紶鏂囦欢鐨勮姹� - UPLOAD_FILE_RES, // 涓婁紶鏂囦欢鐨勫搷搴� - VERSION_INFOENTRY_REQ, // 鐗堟湰淇℃伅褰曞叆璇锋眰 - VERSION_INFOENTRY_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, //鐗堟湰淇℃伅褰曞叆鍝嶅簲 + VERSION_UPDATE_REQ, // 鐗堟湰鏇存柊璇锋眰 + VERSION_UPDATE_RES, // 鐗堟湰鏇存柊鍝嶅簲 + FILE_DOWNLOADS_REQ, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰 + FILE_DOWNLOADS_RES, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲 + DOWNLOAD_SUCCESSFULLY_RES, // 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴� - //鏃ュ織 - LOGSEARCH_REQ;//鏃ュ織鏌ヨ璇锋眰 - LOGSEARCH_RES;//鏃ュ織鏌ヨ鍝嶅簲 + //鏃ュ織 + LOGSEARCH_REQ,//鏃ュ織鏌ヨ璇锋眰 + LOGSEARCH_RES,//鏃ュ織鏌ヨ鍝嶅簲 + + //鍘嗗彶鏌ヨ鍒嗘瀽 + HISTORY_DEV_REQ, //鍘嗗彶鏌ヨ纭欢璇锋眰 + HISTORY_DEV_RES, //鍘嗗彶鏌ヨ纭欢鍝嶅簲 + HISTORY_PRODUCE_REQ, //鍘嗗彶鏌ヨ鐢熶骇璇锋眰 + HISTORY_PRODUCE_RES, //鍘嗗彶鏌ヨ鐢熶骇鍝嶅簲 + HISTORY_ENV_REQ, //鍘嗗彶鏌ヨ鐜璇锋眰 + HISTORY_ENV_RES, //鍘嗗彶鏌ヨ鐜鍝嶅簲 - }; -struct Head{ - int type; - int len; +struct Head { + int type; + int len; }; //娉ㄥ唽鐧诲綍 @@ -106,12 +117,12 @@ Head head; char userName[32]; char password[32]; - LoginReq(){ + LoginReq() { head.type = LOGIN_REQ; head.len = sizeof(LoginReq); } }; - + struct Permission { int admin;//瓒呯骇绠$悊鍛� @@ -124,7 +135,7 @@ int productPlan;//鐢熶骇璁″垝 char roleName[32]; // 瑙掕壊鍚� }; - + //鐧诲綍鍝嶅簲 struct LoginRes { @@ -149,7 +160,7 @@ char email[50]; char capcha[10];//楠岃瘉鐮� char telephone[32]; - RegisterReq(){ + RegisterReq() { head.type = REGISTER_REQ; head.len = sizeof(RegisterReq); } @@ -176,7 +187,7 @@ char capcha[10];//楠岃瘉鐮� char password[32];//鏂板瘑鐮� char confirmPassword[32];//纭瀵嗙爜 - ResetReq(){ + ResetReq() { head.type = RESET_REQ; head.len = sizeof(ResetReq); } @@ -197,79 +208,79 @@ //鏉冮檺绠$悊 // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰 -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); - } +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; // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰 -typedef struct UpdatePmsReq{ - Head head; - // 浜哄憳琛ㄤ富閿甶d - int id; - int queryHistory; - int loggerSearch; - int mapMark; - int devManage; - int productPlan; - int warningManage; - int versionManage; //鐗堟湰绠$悊 - int admin; //绯荤粺绠$悊鍛� - UpdatePmsReq(){ - head.type=QUERY_PMS_RES; - head.len = sizeof(UpdatePmsReq); - } +typedef struct UpdatePmsReq { + Head head; + // 浜哄憳琛ㄤ富閿甶d + int id; + int queryHistory; + int loggerSearch; + int mapMark; + int devManage; + int productPlan; + int warningManage; + int versionManage; //鐗堟湰绠$悊 + int admin; //绯荤粺绠$悊鍛� + 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 id; +typedef struct PmsRes { + int queryHistory; + int loggerSearch; + int mapMark; + int devManage; + int productPlan; + int id; - char userNo[32]; - char name[32]; + char userNo[32]; + char name[32]; - char permissonType[32]; // 瑙掕壊绫诲瀷 - int versionManage; //鐗堟湰绠$悊 - int admin; //绯荤粺绠$悊鍛� - char department[32]; - char loginTime[32]; - char registerTime[32]; + char permissonType[32]; // 瑙掕壊绫诲瀷 + int versionManage; //鐗堟湰绠$悊 + int admin; //绯荤粺绠$悊鍛� + 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; - } +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 UpdatePmsRes { + Head head; + int success; // 1涓烘垚鍔� ,0涓哄け璐� + UpdatePmsRes() { + head.type = UPDATE_PMS_RES; + head.len = sizeof(UpdatePmsRes); + } -} UpdatePmsRes ; +} UpdatePmsRes; @@ -277,22 +288,22 @@ //璁惧绠$悊 struct DevicesInfo { - int deviceID; char deviceName[32];//璁惧鍚嶇О char deviceStatus[32];//璁惧鐘舵�� + char area[32]; // 鍦板尯 + double longitude;//缁忓害 + double latitude;//绾害 + char purchasingTime[15];//璐拱鏃堕棿 + char installTime[15];//瀹夎鏃堕棿 char manufacturer[100];//鍘傚 + char devicesSerialNumber[32];//璁惧缂栫爜 char devicesType[32];//璁惧绫诲瀷 - double longitude;//缁忓害 - double latitude;//绾害 - char purchasingTime[15];//璐拱鏃堕棿 - char installTime[15];//瀹夎鏃堕棿 - char devicesSerialNumber[32];//璁惧缂栫爜 }; //娣诲姞璁惧 struct ADReq//娣诲姞璇锋眰 { Head head; - char deviceName[32]; + DevicesInfo devInfo[0]; ADReq() { head.type = AD_REQ; head.len = sizeof(ADReq); @@ -303,7 +314,7 @@ struct ADRes//娣诲姞鍝嶅簲 { Head head; - int type; + int status; ADRes() { head.type = AD_RES; head.len = sizeof(ADRes); @@ -311,22 +322,23 @@ }; //淇敼璁惧 -struct MDRes//淇敼璇锋眰 +struct MDReq//淇敼璇锋眰 { Head head; DevicesInfo info; - MDRes() { - head.type = MD_RES; - head.len = sizeof(MDRes); - } -}; -struct MDReq//淇敼鍝嶅簲 -{ - Head head; - int type; MDReq() { head.type = MD_REQ; head.len = sizeof(MDReq); + } +}; +struct MDRes//淇敼鍝嶅簲 +{ + Head head; + DevicesInfo info; + int status; + MDRes() { + head.type = MD_RES; + head.len = sizeof(MDRes); } }; //鏌ヨ璁惧 @@ -342,7 +354,8 @@ struct QDRes//鏌ヨ鍝嶅簲 { Head head; - int type; + int status; + DevicesInfo info[0]; QDRes() { head.type = QD_RES; head.len = sizeof(QDRes); @@ -364,7 +377,7 @@ struct MMLReq//鍦板浘 { Head head; - MMLReq(){ + MMLReq() { head.type = MML_REQ; head.len = sizeof(MMLReq); } @@ -375,7 +388,7 @@ Head head; int status;//鎿嶄綔鐘舵�� MarkInfo info[0]; - MMLRes(){ + MMLRes() { head.type = MML_RES; head.len = sizeof(MMLRes); } @@ -385,7 +398,7 @@ { Head head; MarkInfo info[0]; - MMIReq(){ + MMIReq() { head.type = MMI_REQ; head.len = sizeof(MMIReq); } @@ -396,7 +409,7 @@ Head head; int status;//鎿嶄綔鐘舵�� MarkInfo info[0]; - MMIRes(){ + MMIRes() { head.type = MMI_RES; head.len = sizeof(MMIRes); } @@ -407,7 +420,7 @@ { Head head; MarkInfo info[0]; - MMIReq(){ + MMDReq() { head.type = MMD_REQ; head.len = sizeof(MMDReq); } @@ -418,7 +431,7 @@ Head head; int status;//鎿嶄綔鐘舵�� MarkInfo info[0]; - MMDRes(){ + MMDRes() { head.type = MMD_RES; head.len = sizeof(MMDRes); } @@ -428,186 +441,242 @@ //鐜鏁版嵁璇锋眰 struct EnvironmentReq { - Head head; - EnvironmentReq(){ - head.type = ENVIRONMENT_REQ; - head.len = sizeof(EnvironmentReq); - } + Head head; + EnvironmentReq() { + head.type = ENVIRONMENT_REQ; + head.len = sizeof(EnvironmentReq); + } }; //鐜鏁版嵁鍝嶅簲 struct Environment { - float temp;//娓╁害 - float humidity;//婀垮害 - float oxygen;//姘ф皵娴撳害 - float carbon;//涓�姘у寲纰虫祿搴� + double longitude;//缁忓害 + double latitude;//绾害 + float temp;//娓╁害 + float humidity;//婀垮害 + float oxygen;//姘ф皵娴撳害 + float carbon;//涓�姘у寲纰虫祿搴� }; struct EnvironmentRes { - Head head; - int status; - Environment environment[0]; - EnvironmentRes(){ - head.type = ENVIRONMENT_RES; - head.len = sizeof(EnvironmentRes); - } + Head head; + int status; + Environment environment[0]; + EnvironmentRes() { + head.type = ENVIRONMENT_RES; + head.len = sizeof(EnvironmentRes); + } }; //璁惧鐘舵�佽姹� struct DeviceStatusReq { - Head head; - DeviceStatusReq(){ - head.type = DEVICESTATUS_REQ; - head.len = sizeof(DeviceStatusReq); - } + Head head; + DeviceStatusReq() { + head.type = DEVICESTATUS_REQ; + head.len = sizeof(DeviceStatusReq); + } }; //璁惧鐘舵�佸搷搴� struct DeviceStatus { - int deviceID;//璁惧缂栧彿 - char deviceName[32];//璁惧鍚嶇О - char deviceStatus[32];//璁惧鐘舵�� + double longitude;//缁忓害 + double latitude;//绾害 + int deviceID;//璁惧缂栧彿 + char deviceName[32];//璁惧鍚嶇О + char deviceStatus[32];//璁惧鐘舵�� }; struct DeviceStatusRes { - Head head; - int status; - DeviceStatus deviceStatus[0]; - DeviceStatusRes(){ - head.type = DEVICESTATUS_RES; - head.len = sizeof(DeviceStatusRes); - } + Head head; + int status; + DeviceStatus deviceStatus[0]; + DeviceStatusRes() { + head.type = DEVICESTATUS_RES; + head.len = sizeof(DeviceStatusRes); + } }; //鎿嶄綔鏃ュ織璇锋眰 struct MovementRecordReq { - Head head; - MovementRecordReq(){ - head.type = MOVEMENTRECORD_REQ; - head.len = sizeof(MovementRecordReq); - } + Head head; + MovementRecordReq() { + head.type = MOVEMENTRECORD_REQ; + head.len = sizeof(MovementRecordReq); + } }; //鎿嶄綔鏃ュ織鍝嶅簲 struct MovementRecord { - char userName;//鎿嶄綔鐢ㄦ埛鍚� - char operateTime[32];//鎿嶄綔鏃堕棿 - char deviceName[32];//鎿嶄綔璁惧 - char movement[256];//鎿嶄綔鎻忚堪 + double longitude;//缁忓害 + double latitude;//绾害 + char userName;//鎿嶄綔鐢ㄦ埛鍚� + char operateTime[32];//鎿嶄綔鏃堕棿 + char deviceName[32];//鎿嶄綔璁惧 + char movement[256];//鎿嶄綔鎻忚堪 }; struct MovementRecordRes { - Head head; - int status; - MovementRecord movementRecord[0]; - MovementRecordRes(){ - head.type = MOVEMENTRECORD_RES; - head.len = sizeof(MovementRecordRes); - } + Head head; + int status; + MovementRecord movementRecord[0]; + MovementRecordRes() { + head.type = MOVEMENTRECORD_RES; + head.len = sizeof(MovementRecordRes); + } }; //璀︽姤璁板綍璇锋眰 struct AlarmRecordReq { - Head head; - AlarmRecordReq(){ - head.type = ALARMRECORD_REQ; - head.len = sizeof(AlarmRecordReq); - } + Head head; + AlarmRecordReq() { + head.type = ALARMRECORD_REQ; + head.len = sizeof(AlarmRecordReq); + } }; //璀︽姤璁板綍鍝嶅簲 struct AlarmRecord { - char alarmTime[32];//璀︽姤鏃堕棿 - char alarmtype[32];//閫氱煡鏃堕棿 - char alarmContent[256];//璀︽姤鍐呭 + double longitude;//缁忓害 + double latitude;//绾害 + char alarmTime[32];//璀︽姤鏃堕棿 + char alarmtype[32];//澶勭悊鏃堕棿 + char alarmContent[256];//璀︽姤鍐呭 }; struct AlarmRecordRes { - Head head; - int status; - AlarmRecord alarmRecord[0]; - AlarmRecordRes(){ - head.type = ALARMRECORD_RES; - head.len = sizeof(AlarmRecordRes); - } + Head head; + int status; + AlarmRecord alarmRecord[0]; + AlarmRecordRes() { + head.type = ALARMRECORD_RES; + head.len = sizeof(AlarmRecordRes); + } }; //鐓ょ熆浜ч噺璇锋眰 struct YieldReq { - Head head; - YieldReq(){ - head.type = YIELD_REQ; - head.len = sizeof(YieldReq); - } + Head head; + YieldReq() { + head.type = YIELD_REQ; + head.len = sizeof(YieldReq); + } }; //鐓ょ熆浜ч噺鍝嶅簲 struct Yield { - int month;//鏈堜唤 - int output;//浜ч噺 + int month;//鏈堜唤 + int output;//浜ч噺 }; struct YieldRes { - Head head; - int status; - Yield yield[0]; - YieldRes(){ - head.type = YIELD_RES; - head.len = sizeof(YieldRes); - } + Head head; + int status; + Yield yield[0]; + YieldRes() { + head.type = YIELD_RES; + head.len = sizeof(YieldRes); + } }; //璀︽姤绠$悊 -// 璀︽姤璇锋眰缁撴瀯浣� -struct WarningReq { - Head head; - - float oxygenWarning; - float carbonWarning; - float tempWarning; - float humidityWarning; - - WarningReq() { - head.type = WARNING_REQ; - head.len = sizeof(WarningReq); - } -}; - - -struct DataThreshold{ - //闃堝�� - float oxygenThreshold; - float carbonThreshold; - float tempThreshold; - float humidityThreshold; +struct warningInfo { + char device_name[32];//璁惧鍚嶇О + char des[32];//璀︽姤鎻忚堪 + char time[32];//璀︽姤鏃堕棿 + float warningdata;//璀︽姤鏁版嵁 + char type[16];//璀︽姤绫诲瀷 + char status[16];//璀︽姤鐘舵�� }; -struct Data{ - float oxygen; // 姘ф皵娴撳害 - float carbon; // 涓�姘у寲纰虫祿搴� - float temp; // 娓╁害 - float humidity; // 婀垮害 +struct dataInfo { + char device_name[32]; + char type[16];//鐜鏁版嵁绫诲瀷 + float data; + char time[32];//涓婁紶鏁版嵁鏃堕棿 }; -// 璀︽姤鍝嶅簲缁撴瀯浣� -struct WarningRes { - Head head; - int status; // 鍝嶅簲鐘舵�侊紙姣斿 0 琛ㄧず鎴愬姛锛�1 琛ㄧず澶辫触绛夛級 - const char* message; // 鍝嶅簲娑堟伅鎻忚堪 +struct threshInfo { + char device_name[32]; + char type[16];//鐜绫诲瀷 + float min;//鏈�灏忛槇鍊� + float max;//鏈�澶ч槇鍊� + char time[32];//闃堝�间慨鏀规椂闂� +}; - WarningRes(int stat, const char* msg) { - head.type = WARNING_RES; - head.len = sizeof(WarningRes); - status = stat; - message = msg; - } -}; +//璀︽姤璇锋眰缁撴瀯浣� +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 { int planId;//璁㈠崟缂栧彿 - char planName[32];//璁㈠崟鍒掑悕瀛� + char planName[32];//璁㈠崟鍚嶅瓧 char startDate[32];//璧峰鏃ユ湡 char closingDate[32];//浜や粯鏃ユ湡 char pdName[8];//浜у搧鍚� @@ -820,42 +889,92 @@ //鍘嗗彶鏌ヨ鍒嗘瀽 -// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣� -struct HistoryQueryReq { - Head head; - //鏍规嵁鏃堕棿鑼冨洿鏌ヨ - char startTime[32]; - char endTime[32]; - //鍏抽敭瀛楁煡璇� - char keyWord[32]; - HistoryQueryReq() { - // 鍒濆鍖栨暟鎹ご - head.type = HISTORY_QUERY_REQ; - head.len = sizeof(HistoryQueryReq); - // 鍒濆鍖栨煡璇㈡潯浠跺瓧娈� - std::memset(startTime, 0, sizeof(startTime)); - std::memset(endTime, 0, sizeof(endTime)); - } +//鍘嗗彶鏌ヨ鍒嗘瀽 + +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]; + 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() { + // 鍒濆鍖栨暟鎹ご + 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;//璁惧鏌ヨ - ProductionPlanRes pro;//鐢熶骇璁″垝鏌ヨ +//鏌ヨ璁惧淇℃伅鍝嶅簲缁撴瀯浣� +struct HistoryDevRes { + Head head; + DevicesInfo dev[0]; + HistoryDevRes() { + // 鍒濆鍖栨暟鎹ご + head.type = HISTORY_DEV_RES; + head.len = sizeof(HistoryDevRes); + } }; -struct HistoryQueryRes { - Head head; - HistroyInfo sys[0]; - HistoryQueryRes() { - // 鍒濆鍖栨暟鎹ご - head.type = HISTORY_QUERY_RES; - head.len = sizeof(HistoryQueryRes); - sys = nullptr; - } +//鏌ヨ鐢熶骇璁″垝鍝嶅簲缁撴瀯浣� +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); + } }; @@ -884,7 +1003,7 @@ { char fileName[256]; long long fileSize; - char s_filepath[128]; + char s_filepath[128]; char content[0]; }; @@ -899,120 +1018,120 @@ }; struct UploadFileRes { // 涓婁紶鏂囦欢鐨勫搷搴� - Head head; - bool state = false; - char fileName[256]; - long long file_size; - UploadFileRes() - { - head.type = UPLOAD_FILE_RES; - head.len = sizeof(UploadFileRes); - } + Head head; + bool state = false; + char fileName[256]; + long long file_size; + UploadFileRes() + { + head.type = UPLOAD_FILE_RES; + head.len = sizeof(UploadFileRes); + } }; // 鐗堟湰淇℃伅褰曞叆 // 璇锋眰 struct VersionInfoEntryReq { - Head head; - char versionId[64]; // 鐗堟湰鍙� - char versionIdOld[64]; // 涓婁竴涓増鏈彿 - char context[0]; //鍖呭惈涓嬭浇鏂囦欢淇℃伅 - int fileNum; + Head head; + char versionId[64]; // 鐗堟湰鍙� + char versionIdOld[64]; // 涓婁竴涓増鏈彿 + int fileNum; + char context[0]; //鍖呭惈涓嬭浇鏂囦欢淇℃伅 - VersionInfoEntryReq() - { - head.type = VERSION_INFOENTRY_REQ; - head.len = sizeof(VersionInfoEntryReq); - } + VersionInfoEntryReq() + { + head.type = VERSION_INFOENTRY_REQ; + head.len = sizeof(VersionInfoEntryReq); + } }; // 鐗堟湰淇℃伅褰曞叆鍝嶅簲 struct VersionInfoEntryRes { - Head head; - bool state = false; - VersionInfoEntryRes() - { - head.type = VERSION_INFOENTRY_RES; - head.len = sizeof(VersionInfoEntryRes); - } + Head head; + bool state = false; + VersionInfoEntryRes() + { + head.type = VERSION_INFOENTRY_RES; + head.len = sizeof(VersionInfoEntryRes); + } }; // 鐗堟湰鏇存柊璇锋眰 struct VersionUpdateReq { - Head head; + Head head; - char curVersionId[64]; // 鐗堟湰鍙� - VersionUpdateReq() - { - head.type = VERSION_UPDATE_REQ; - head.len = sizeof(VersionUpdateReq); - } + char curVersionId[64]; // 鐗堟湰鍙� + VersionUpdateReq() + { + head.type = VERSION_UPDATE_REQ; + head.len = sizeof(VersionUpdateReq); + } }; // 鐗堟湰鏇存柊鍝嶅簲 struct VersionUpdateRes { - Head head; - bool state = false; - char versionId[64]; // 鐗堟湰鍙� - char updateDate[32]; // 鏇存柊鏃堕棿 - char versionDescription[1024]; //鏇存柊鎻忚堪 + Head head; + bool state = false; + char versionId[64]; // 鐗堟湰鍙� + char updateDate[32]; // 鏇存柊鏃堕棿 + char versionDescription[1024]; //鏇存柊鎻忚堪 - VersionUpdateRes() - { - head.type = VERSION_UPDATE_RES; - head.len = sizeof(VersionUpdateRes); - } + 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); - } + 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); - } + 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 DownloadSuccessfullyRes { + Head head; + bool state = false; + char fileName[256]; + long long fileSize; + DownloadSuccessfullyRes() + { + head.type = DOWNLOAD_SUCCESSFULLY_RES; + head.len = sizeof(DownloadSuccessfullyRes); + } }; //鏃ュ織 -struct ParsedLog { - char timeStamp[64]; // 鏃堕棿鎴� - char deviceId[64]; // 璁惧ID - char level[16]; 聽 聽 // 鏃ュ織绾у埆 - char content[256]; 聽// 鏃ュ織鍐呭 - char userId[64]; 聽 // 鐢ㄦ埛ID +struct ParsedLog { + char timeStamp[64]; // 鏃堕棿鎴� + char deviceId[64]; // 璁惧ID + char level[16]; // 鏃ュ織绾у埆 + char content[256]; // 鏃ュ織鍐呭 + char userId[64]; // 鐢ㄦ埛ID char fileName[32]; //鏂囦欢鍚� char functionName[32]; //鍑芥暟鍚� int problemLine; //浜х敓閿欒琛屽彿 @@ -1021,29 +1140,29 @@ // 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣� // 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣� struct LogQueryReq { - Head head; // 鏁版嵁澶� - char timeStamp[64]; // 鏃堕棿鎴� - char content[256]; 聽 // 鏃ュ織鍐呭 - char level[16]; //鏃ュ織绾у埆 - char deviceId[64]; // 璁惧ID - // 鏃犲弬鏋勯�犲嚱鏁� - LogQueryReq() { - head.type = LOGSEARCH_REQ; - head.len = sizeof(LogQueryReq); - } + Head head; // 鏁版嵁澶� + char timeStamp[64]; // 鏃堕棿鎴� + char content[256]; // 鏃ュ織鍐呭 + char level[16]; //鏃ュ織绾у埆 + char deviceId[64]; // 璁惧ID + // 鏃犲弬鏋勯�犲嚱鏁� + LogQueryReq() { + head.type = LOGSEARCH_REQ; + head.len = sizeof(LogQueryReq); + } }; // 鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣� struct LogQueryRes { - Head head; - int status; // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触) - char errorMessage[256]; // 閿欒淇℃伅锛堝鏋滄湁锛� - - // 鏃犲弬鏋勯�犲嚱鏁� - LogQueryRes() { - head.type = LOGSEARCH_RES; - head.len = sizeof(LogQueryRes); - } + Head head; + int status; // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触) + char errorMessage[256]; // 閿欒淇℃伅锛堝鏋滄湁锛� + + // 鏃犲弬鏋勯�犲嚱鏁� + LogQueryRes() { + head.type = LOGSEARCH_RES; + head.len = sizeof(LogQueryRes); + } }; -- Gitblit v1.8.0