From 2a2feed3709c00aa01ec383ae8ab6fbe467942a3 Mon Sep 17 00:00:00 2001
From: lzx <2246256235@qq.com>
Date: 星期二, 05 十一月 2024 22:13:26 +0800
Subject: [PATCH] 结构体
---
common.h | 101 ++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 80 insertions(+), 21 deletions(-)
diff --git a/common.h b/common.h
index e6d913b..6d36e1f 100644
--- a/common.h
+++ b/common.h
@@ -90,6 +90,14 @@
//鏃ュ織
LOGSEARCH_REQ,//鏃ュ織鏌ヨ璇锋眰
LOGSEARCH_RES,//鏃ュ織鏌ヨ鍝嶅簲
+
+ //鍘嗗彶鏌ヨ鍒嗘瀽
+ HISTORY_DEV_REQ, //鍘嗗彶鏌ヨ纭欢璇锋眰
+ HISTORY_DEV_RES, //鍘嗗彶鏌ヨ纭欢鍝嶅簲
+ HISTORY_PRODUCE_REQ, //鍘嗗彶鏌ヨ鐢熶骇璇锋眰
+ HISTORY_PRODUCE_RES, //鍘嗗彶鏌ヨ鐢熶骇鍝嶅簲
+ HISTORY_ENV_REQ, //鍘嗗彶鏌ヨ鐜璇锋眰
+ HISTORY_ENV_RES, //鍘嗗彶鏌ヨ鐜鍝嶅簲
};
@@ -828,40 +836,91 @@
//鍘嗗彶鏌ヨ鍒嗘瀽
-// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣�
-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);
}
};
--
Gitblit v1.8.0