From faac4132e073b87ab9722780742f3d39ff74e190 Mon Sep 17 00:00:00 2001
From: MoYue <18168119590@163.com>
Date: Sat, 11 Mar 2023 12:53:23 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=8A=A0=E5=8D=8F=E8=AE=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
MonitoringTechnology/Ble/BleDevice.cs | 77 ++++++
.../Models/MonitoringSensorModel.cs | 254 +++++++++++++++++-
2 files changed, 330 insertions(+), 1 deletion(-)
diff --git a/MonitoringTechnology/Ble/BleDevice.cs b/MonitoringTechnology/Ble/BleDevice.cs
index 55f27cd..5a70ac9 100644
--- a/MonitoringTechnology/Ble/BleDevice.cs
+++ b/MonitoringTechnology/Ble/BleDevice.cs
@@ -565,6 +565,83 @@ namespace MonitoringTechnology.Ble
_message = "系统校时失败";
ReceiveValueChangedChanged(null, _message);
}
+ break;
+
+ //擦除历史数据功能
+ case 0x08:
+ switch (byteList[6])
+ {
+ case 0x00:
+ _message += "擦除完成";
+ ReceiveValueChangedChanged(null, _message);
+ break;
+ case 0x01:
+ _message += "等待擦除";
+ ReceiveValueChangedChanged(null, _message);
+ break;
+ case 0x02:
+ _message += "擦除失败";
+ ReceiveValueChangedChanged(null, _message);
+ break;
+ default:
+ break;
+ }
+ break;
+ //查询历史数据
+ case 0x04:
+ //UTC时间
+ if ((int)byteList[6] == 0 && (int)byteList[7] == 0 && (int)byteList[8] == 0 && (int)byteList[9] == 0)
+ {
+ dt = DateTime.Now;
+ }
+ else
+ {
+ dt = startTime.AddSeconds(Convert.ToInt32(byteList[6].ToString("X2") + byteList[7].ToString("X2") + byteList[8].ToString("X2") + byteList[9].ToString("X2"), 16));
+ }
+ monitoringSensorModel.f_CreateDate = time_DataBase;
+ monitoringSensorModel._datetime_Sensor = dt;
+
+ //温度 10,11,12,13
+ monitoringSensorModel._Tem = tools.bytetofloat(byteList, 10);
+
+ //湿度 14,15,16,17
+ monitoringSensorModel._Hum = tools.bytetofloat(byteList, 14);
+
+ //气压 18,19,20,21
+ monitoringSensorModel._pressure = tools.bytetofloat(byteList, 18);
+
+ //加速度X 22,23,24,25
+ monitoringSensorModel._acceleration_X = tools.bytetofloat(byteList, 22);
+
+ //加速度Y 26,27,28,29
+ monitoringSensorModel._acceleration_Y = tools.bytetofloat(byteList, 26);
+
+ //加速度Z 30,31,32,33
+ monitoringSensorModel._acceleration_Z = tools.bytetofloat(byteList, 30);
+
+ //角速度X 34,35,36,37
+ monitoringSensorModel._angularVelocity_X = tools.bytetofloat(byteList, 34);
+
+ //角速度Y 38,39,40,41
+ monitoringSensorModel._angularVelocity_Y = tools.bytetofloat(byteList, 38);
+
+ //角速度Z 42,43,44,45
+ monitoringSensorModel._angularVelocity_Z = tools.bytetofloat(byteList, 42);
+
+ //角度X 46,47,48,49
+ monitoringSensorModel.degrees_x = tools.bytetofloat(byteList, 46);
+
+ //角度Y 50,51,52,53
+ monitoringSensorModel.degrees_y = tools.bytetofloat(byteList, 50);
+
+ //角度Z 54,55,56,57
+ monitoringSensorModel.degrees_z = tools.bytetofloat(byteList, 54);
+
+ //温度-主系统
+
+
+
+
break;
default:
break;
diff --git a/MonitoringTechnology/Models/MonitoringSensorModel.cs b/MonitoringTechnology/Models/MonitoringSensorModel.cs
index 14a3f57..753b223 100644
--- a/MonitoringTechnology/Models/MonitoringSensorModel.cs
+++ b/MonitoringTechnology/Models/MonitoringSensorModel.cs
@@ -222,7 +222,259 @@ namespace MonitoringTechnology.Models
set { z = value; this.DoNotify(); }
}
-
+ ///
+ /// 温度--主系统
+ ///
+ private int tem;
+
+ public int Tem
+ {
+ get { return tem; }
+ set { tem = value; }
+ }
+
+ ///
+ /// 湿度 --主系统
+ ///
+ private int hum;
+
+ public int Hum
+ {
+ get { return hum; }
+ set { hum = value; }
+ }
+
+ ///
+ /// 气压 --主系统
+ ///
+ private int preeure;
+
+ public int Pressure
+ {
+ get { return preeure; }
+ set { preeure = value; }
+ }
+
+ ///
+ /// 电压1 --主系统
+ ///
+ private int voltage1;
+
+ public int Voltage1
+ {
+ get { return voltage1; }
+ set { voltage1 = value; }
+ }
+
+ ///
+ /// 电压2 --主系统
+ ///
+ private int voltage2;
+
+ public int Voltage2
+ {
+ get { return voltage2; }
+ set { voltage2 = value; }
+ }
+
+ ///
+ /// 电压3 --主系统
+ ///
+ private int voltage3;
+
+ public int Voltage3
+ {
+ get { return voltage3; }
+ set { voltage3 = value; }
+ }
+
+ ///
+ /// 电压4 --主系统
+ ///
+ private int voltage4;
+
+ public int Voltage4
+ {
+ get { return voltage4; }
+ set { voltage4 = value; }
+ }
+
+ ///
+ /// 电压5 --主系统
+ ///
+ private int voltage5;
+
+ public int Voltage5
+ {
+ get { return voltage5; }
+ set { voltage5 = value; }
+ }
+
+ ///
+ /// 电压6 --主系统
+ ///
+ private int voltage6;
+
+ public int Voltage6
+ {
+ get { return voltage6; }
+ set { voltage6 = value; }
+ }
+
+ ///
+ /// 电压7 --主系统
+ ///
+ private int voltage7;
+
+ public int Voltage7
+ {
+ get { return voltage7; }
+ set { voltage7 = value; }
+ }
+
+ ///
+ /// 电压8 --主系统
+ ///
+ private int voltage8;
+
+ public int Voltage8
+ {
+ get { return voltage8; }
+ set { voltage8 = value; }
+ }
+
+ ///
+ /// 电压9 --主系统
+ ///
+ private int voltage9;
+
+ public int Voltage9
+ {
+ get { return voltage9; }
+ set { voltage9 = value; }
+ }
+
+ ///
+ /// 电压10 --主系统
+ ///
+ private int voltage10;
+
+ public int Voltage10
+ {
+ get { return voltage10; }
+ set { voltage10 = value; }
+ }
+
+ ///
+ /// 电流1 --主系统
+ ///
+ private int current1;
+
+ public int Current1
+ {
+ get { return current1; }
+ set { current1 = value; }
+ }
+
+ ///
+ /// 电流2 --主系统
+ ///
+ private int current2;
+
+ public int Current2
+ {
+ get { return current2; }
+ set { current2 = value; }
+ }
+
+ ///
+ /// 电流3 --主系统
+ ///
+ private int current3;
+
+ public int Current3
+ {
+ get { return current3; }
+ set { current3 = value; }
+ }
+
+ ///
+ /// 电流4 --主系统
+ ///
+ private int current4;
+
+ public int Current4
+ {
+ get { return current4; }
+ set { current4 = value; }
+ }
+
+ ///
+ /// 电流5 --主系统
+ ///
+ private int current5;
+
+ public int Current5
+ {
+ get { return current5; }
+ set { current5 = value; }
+ }
+
+ ///
+ /// 电流6 --主系统
+ ///
+ private int current6;
+
+ public int Current6
+ {
+ get { return current6; }
+ set { current6 = value; }
+ }
+
+ ///
+ /// 电流7 --主系统
+ ///
+ private int current7;
+
+ public int Current7
+ {
+ get { return current7; }
+ set { current7 = value; }
+ }
+
+
+ ///
+ /// 电流8 --主系统
+ ///
+ private int current8;
+
+ public int Current8
+ {
+ get { return current8; }
+ set { current8 = value; }
+ }
+
+ ///
+ /// 电流9 --主系统
+ ///
+ private int current9;
+
+ public int Current9
+ {
+ get { return current9; }
+ set { current9 = value; }
+ }
+
+ ///
+ /// 电流10 --主系统
+ ///
+ private int current10;
+
+ public int Current10
+ {
+ get { return current10; }
+ set { current10 = value; }
+ }
#endregion
}