From 7d770a1814cf6e4833700f903b3d3aa6e8231ef6 Mon Sep 17 00:00:00 2001 From: MoYue <18168119590@163.com> Date: Mon, 13 Mar 2023 06:44:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=A2=9E=E5=8A=A0=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MonitoringTechnology/Ble/BleDevice.cs | 70 ++++++++++++++++++- .../Models/MonitoringSensorModel.cs | 46 ++++++------ 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/MonitoringTechnology/Ble/BleDevice.cs b/MonitoringTechnology/Ble/BleDevice.cs index 5a70ac9..d1e95d8 100644 --- a/MonitoringTechnology/Ble/BleDevice.cs +++ b/MonitoringTechnology/Ble/BleDevice.cs @@ -637,11 +637,79 @@ namespace MonitoringTechnology.Ble //角度Z 54,55,56,57 monitoringSensorModel.degrees_z = tools.bytetofloat(byteList, 54); - //温度-主系统 + //温度-主系统 58,59 + monitoringSensorModel.tem = Convert.ToInt16(byteList[59].ToString("X2") + byteList[58].ToString("X2")); + //湿度-主系统 60,61 + monitoringSensorModel.hum = Convert.ToInt16(byteList[61].ToString("X2") + byteList[60].ToString("X2")); + //气压 -主系统 62,63 + monitoringSensorModel.preeure = Convert.ToInt16(byteList[63].ToString("X2") + byteList[62].ToString("X2")); + //电压1 -主系统 64,65 + monitoringSensorModel.voltage1 = Convert.ToInt16(byteList[65].ToString("X2") + byteList[64].ToString("X2")); + //电压2 -主系统 66,67 + monitoringSensorModel.voltage2 = Convert.ToInt16(byteList[67].ToString("X2") + byteList[66].ToString("X2")); + + //电压3 -主系统 68,69 + monitoringSensorModel.voltage3 = Convert.ToInt16(byteList[69].ToString("X2") + byteList[68].ToString("X2")); + + //电压4 -主系统 70,71 + monitoringSensorModel.voltage4 = Convert.ToInt16(byteList[71].ToString("X2") + byteList[70].ToString("X2")); + + //电压5 -主系统 72,73 + monitoringSensorModel.voltage5 = Convert.ToInt16(byteList[73].ToString("X2") + byteList[72].ToString("X2")); + + //电压6 -主系统 74,75 + monitoringSensorModel.voltage6 = Convert.ToInt16(byteList[75].ToString("X2") + byteList[74].ToString("X2")); + + //电压7 -主系统 76,77 + monitoringSensorModel.voltage7 = Convert.ToInt16(byteList[77].ToString("X2") + byteList[76].ToString("X2")); + + //电压8 -主系统 78,79 + monitoringSensorModel.voltage8 = Convert.ToInt16(byteList[79].ToString("X2") + byteList[78].ToString("X2")); + + //电压9 -主系统 80,81 + monitoringSensorModel.voltage9 = Convert.ToInt16(byteList[81].ToString("X2") + byteList[80].ToString("X2")); + + //电压10 -主系统 82,83 + monitoringSensorModel.voltage10 = Convert.ToInt16(byteList[83].ToString("X2") + byteList[82].ToString("X2")); + + //电流1 -主系统 84,85 + monitoringSensorModel.current1 = Convert.ToInt16(byteList[85].ToString("X2") + byteList[84].ToString("X2")); + + //电流2 -主系统 86,87 + monitoringSensorModel.current2 = Convert.ToInt16(byteList[87].ToString("X2") + byteList[86].ToString("X2")); + + //电流3 -主系统 88,89 + monitoringSensorModel.current3 = Convert.ToInt16(byteList[88].ToString("X2") + byteList[89].ToString("X2")); + + //电流4 -主系统 90,91 + monitoringSensorModel.current4 = Convert.ToInt16(byteList[91].ToString("X2") + byteList[90].ToString("X2")); + + //电流5 -主系统 92,93 + monitoringSensorModel.current5 = Convert.ToInt16(byteList[93].ToString("X2") + byteList[92].ToString("X2")); + + //电流6 -主系统 94,95 + monitoringSensorModel.current6 = Convert.ToInt16(byteList[95].ToString("X2") + byteList[94].ToString("X2")); + + //电流7 -主系统 96,97 + monitoringSensorModel.current7 = Convert.ToInt16(byteList[97].ToString("X2") + byteList[96].ToString("X2")); + + //电流8 -主系统 98,99 + monitoringSensorModel.current8 = Convert.ToInt16(byteList[99].ToString("X2") + byteList[98].ToString("X2")); + + //电流9 -主系统 100,101 + monitoringSensorModel.current9 = Convert.ToInt16(byteList[101].ToString("X2") + byteList[100].ToString("X2")); + + //电流10 -主系统 102,103 + monitoringSensorModel.current10 = Convert.ToInt16(byteList[103].ToString("X2") + byteList[102].ToString("X2")); + + _message ="日期:"+ monitoringSensorModel._datetime_Sensor + "\r\n" + " 温度:" + monitoringSensorModel._Tem + "℃ 湿度:" + monitoringSensorModel._Hum + "% 气压:" + monitoringSensorModel._pressure + "KPa " + "\r\n" + " 俯仰角:" + monitoringSensorModel._acceleration_X + "° 横滚角:" + monitoringSensorModel._acceleration_Y + "° 偏航角:" + monitoringSensorModel._acceleration_Z + "°" + "\r\n" + " 角速度X:" + monitoringSensorModel._angularVelocity_X + "m/s² 角速度Y:" + monitoringSensorModel._angularVelocity_Y + "m/s² 角速度Z:" + monitoringSensorModel._angularVelocity_Z + "m/s² " + "\r\n" + " 角度X:" + monitoringSensorModel.degrees_x + "rad/s 角度Y:" + monitoringSensorModel.degrees_y + "rad/s 角度Z:" + monitoringSensorModel.degrees_z + "rad/s " + "\r\n" + " 温度-主系统:" + monitoringSensorModel.tem +"℃ 湿度-主系统:" + monitoringSensorModel.hum + "% 气压 -主系统 :" + monitoringSensorModel.preeure+ "KPa" + "\r\n" + " 电压1 -主系统:" + monitoringSensorModel.voltage1 + "V 电压2 -主系统:" + monitoringSensorModel.voltage2 + "V 电压3 -主系统:" + monitoringSensorModel.voltage3 + "\r\n" + " 电压4 -主系统:" + monitoringSensorModel.voltage4 + "V 电压5 -主系统:" + monitoringSensorModel.voltage5 + "V 电压6 -主系统:" + monitoringSensorModel.voltage6 + "\r\n" + " 电压7 -主系统:" + monitoringSensorModel.voltage7 + "V 电压8 -主系统:" + monitoringSensorModel.voltage8 + "V 电压9 -主系统:" + monitoringSensorModel.voltage9 + "\r\n" + " 电压10 -主系统:" + monitoringSensorModel.voltage10 + "\r\n" + " 电流1 -主系统:" + monitoringSensorModel.current1 + "A 电流2 -主系统:" + monitoringSensorModel.current2 + "A 电流3 -主系统:" + monitoringSensorModel.current3 + "\r\n"+ " 电流4 -主系统:" + monitoringSensorModel.current4 + "A 电流5 -主系统:" + monitoringSensorModel.current5 + "A 电流6 -主系统:" + monitoringSensorModel.current6 + "\r\n" + " 电流7 -主系统:" + monitoringSensorModel.current7 + "A 电流8 -主系统:" + monitoringSensorModel.current8 + "A 电流9 -主系统:" + monitoringSensorModel.current9 + "\r\n" + " 电流10 -主系统:" + monitoringSensorModel.current10; + + //以txt文档的形式存储接收到的数据 + tools.AddLgoToTXT(FileModel.File_Name + FileModel.File_Time.ToString("yyyy-MM-dd") +" 历史数据查询记录" + ".txt", FileModel.File_Path + FileModel.File_Time.ToString("yyyy-MM-dd") + @"\", _localtime + ": " + _message + "\r\n"); break; default: break; diff --git a/MonitoringTechnology/Models/MonitoringSensorModel.cs b/MonitoringTechnology/Models/MonitoringSensorModel.cs index 753b223..e01cd82 100644 --- a/MonitoringTechnology/Models/MonitoringSensorModel.cs +++ b/MonitoringTechnology/Models/MonitoringSensorModel.cs @@ -225,7 +225,7 @@ namespace MonitoringTechnology.Models /// /// 温度--主系统 /// - private int tem; + public int tem; public int Tem { @@ -236,7 +236,7 @@ namespace MonitoringTechnology.Models /// /// 湿度 --主系统 /// - private int hum; + public int hum; public int Hum { @@ -247,7 +247,7 @@ namespace MonitoringTechnology.Models /// /// 气压 --主系统 /// - private int preeure; + public int preeure; public int Pressure { @@ -258,7 +258,7 @@ namespace MonitoringTechnology.Models /// /// 电压1 --主系统 /// - private int voltage1; + public int voltage1; public int Voltage1 { @@ -269,7 +269,7 @@ namespace MonitoringTechnology.Models /// /// 电压2 --主系统 /// - private int voltage2; + public int voltage2; public int Voltage2 { @@ -280,7 +280,7 @@ namespace MonitoringTechnology.Models /// /// 电压3 --主系统 /// - private int voltage3; + public int voltage3; public int Voltage3 { @@ -291,7 +291,7 @@ namespace MonitoringTechnology.Models /// /// 电压4 --主系统 /// - private int voltage4; + public int voltage4; public int Voltage4 { @@ -302,7 +302,7 @@ namespace MonitoringTechnology.Models /// /// 电压5 --主系统 /// - private int voltage5; + public int voltage5; public int Voltage5 { @@ -313,7 +313,7 @@ namespace MonitoringTechnology.Models /// /// 电压6 --主系统 /// - private int voltage6; + public int voltage6; public int Voltage6 { @@ -324,7 +324,7 @@ namespace MonitoringTechnology.Models /// /// 电压7 --主系统 /// - private int voltage7; + public int voltage7; public int Voltage7 { @@ -335,7 +335,7 @@ namespace MonitoringTechnology.Models /// /// 电压8 --主系统 /// - private int voltage8; + public int voltage8; public int Voltage8 { @@ -346,7 +346,7 @@ namespace MonitoringTechnology.Models /// /// 电压9 --主系统 /// - private int voltage9; + public int voltage9; public int Voltage9 { @@ -357,7 +357,7 @@ namespace MonitoringTechnology.Models /// /// 电压10 --主系统 /// - private int voltage10; + public int voltage10; public int Voltage10 { @@ -368,7 +368,7 @@ namespace MonitoringTechnology.Models /// /// 电流1 --主系统 /// - private int current1; + public int current1; public int Current1 { @@ -379,7 +379,7 @@ namespace MonitoringTechnology.Models /// /// 电流2 --主系统 /// - private int current2; + public int current2; public int Current2 { @@ -390,7 +390,7 @@ namespace MonitoringTechnology.Models /// /// 电流3 --主系统 /// - private int current3; + public int current3; public int Current3 { @@ -401,7 +401,7 @@ namespace MonitoringTechnology.Models /// /// 电流4 --主系统 /// - private int current4; + public int current4; public int Current4 { @@ -412,7 +412,7 @@ namespace MonitoringTechnology.Models /// /// 电流5 --主系统 /// - private int current5; + public int current5; public int Current5 { @@ -423,7 +423,7 @@ namespace MonitoringTechnology.Models /// /// 电流6 --主系统 /// - private int current6; + public int current6; public int Current6 { @@ -434,7 +434,7 @@ namespace MonitoringTechnology.Models /// /// 电流7 --主系统 /// - private int current7; + public int current7; public int Current7 { @@ -446,7 +446,7 @@ namespace MonitoringTechnology.Models /// /// 电流8 --主系统 /// - private int current8; + public int current8; public int Current8 { @@ -457,7 +457,7 @@ namespace MonitoringTechnology.Models /// /// 电流9 --主系统 /// - private int current9; + public int current9; public int Current9 { @@ -468,7 +468,7 @@ namespace MonitoringTechnology.Models /// /// 电流10 --主系统 /// - private int current10; + public int current10; public int Current10 {