From a2a845c7ca4ba4aa08fde7f63d5b24975bcd294c Mon Sep 17 00:00:00 2001
From: 小驴在此and <2154553021@qq.com>
Date: 星期四, 07 十一月 2024 15:09:08 +0800
Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/昆仑_1025
---
common.h | 127 ++++++++++++++++++++++++++++++------------
1 files changed, 90 insertions(+), 37 deletions(-)
diff --git a/common.h b/common.h
index 6d36e1f..bb0a5f2 100644
--- a/common.h
+++ b/common.h
@@ -50,7 +50,11 @@
//璀︽姤绠$悊
WARNING_REQ, // 璀︽姤璇锋眰
- WARNING_RES, // 璀︽姤鍝嶅簲
+ WARNING_RES, // 璀︽姤鍝嶅簲
+ DATA_REQ, // 鏁版嵁璇锋眰
+ DATA_RES, // 鏁版嵁鍝嶅簲
+ THRESHOLD_REQ, //闃堝�艰姹�
+ THRESHOLD_RES, //闃堝�煎搷搴�
//鐢熶骇璁″垝绠$悊
@@ -321,7 +325,7 @@
struct MDReq//淇敼璇锋眰
{
Head head;
-
+ DevicesInfo info;
MDReq() {
head.type = MD_REQ;
head.len = sizeof(MDReq);
@@ -351,6 +355,7 @@
{
Head head;
int status;
+ DevicesInfo info[0];
QDRes() {
head.type = QD_RES;
head.len = sizeof(QDRes);
@@ -574,51 +579,99 @@
};
//璀︽姤绠$悊
-// 璀︽姤璇锋眰缁撴瀯浣�
+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
{
--
Gitblit v1.8.0