diff --git a/Sln.Iot.Business/IotEnvBusiness.cs b/Sln.Iot.Business/IotEnvBusiness.cs
index 3d95281..7c944ec 100644
--- a/Sln.Iot.Business/IotEnvBusiness.cs
+++ b/Sln.Iot.Business/IotEnvBusiness.cs
@@ -192,6 +192,15 @@ namespace Sln.Iot.Business
iotEnvInstant.vibrationTemp = (decimal)f_vibrationTemp;
break;
+ case CommParams.Displacement: //位移
+ byteBlock.Read(out byte[] displacement, 4);
+ base._stringChange.SwapBytes(ref displacement);
+ float f_displacement = BitConverter.ToSingle(displacement, 0);
+
+ ValueIsNan(ref f_displacement);
+
+ iotEnvInstant.displacement = (decimal)f_displacement;
+ break;
case CommParams.CJSJ:
byteBlock.Read(out byte[] b_CJSJ, 6);
string strDateTime = "20" + b_CJSJ[5].ToString("x2")
diff --git a/Sln.Iot.Business/WebSocketBusiness.cs b/Sln.Iot.Business/WebSocketBusiness.cs
index 18e89d2..20a7bf4 100644
--- a/Sln.Iot.Business/WebSocketBusiness.cs
+++ b/Sln.Iot.Business/WebSocketBusiness.cs
@@ -21,7 +21,7 @@ namespace Sln.Iot.Business
public void Init()
{
- var server = new Fleck.WebSocketServer($"ws://0.0.0.0:7181");
+ var server = new Fleck.WebSocketServer($"ws://0.0.0.0:7183");
server.Start(socket =>
{
socket.OnOpen = () =>
diff --git a/Sln.Iot.Model/dao/RecordIotEnvInstant.cs b/Sln.Iot.Model/dao/RecordIotEnvInstant.cs
index 69a4239..32fea30 100644
--- a/Sln.Iot.Model/dao/RecordIotEnvInstant.cs
+++ b/Sln.Iot.Model/dao/RecordIotEnvInstant.cs
@@ -98,6 +98,12 @@ namespace Sln.Iot.Model.dao
///
[SugarColumn(ColumnName = "vibration_temp")]
public decimal vibrationTemp { get; set; }
+
+ ///
+ /// 位移
+ ///
+ [SugarColumn(ColumnName = "displacement")]
+ public decimal displacement{get;set;}
///
diff --git a/Sln.Iot.Model/dto/CommParams.cs b/Sln.Iot.Model/dto/CommParams.cs
index 5c9c4a7..8746001 100644
--- a/Sln.Iot.Model/dto/CommParams.cs
+++ b/Sln.Iot.Model/dto/CommParams.cs
@@ -62,6 +62,11 @@ namespace Sln.Iot.Model.dto
/// 振动-温度
///
public const uint VibrationTemp = 0x8E54;
+
+ ///
+ /// 位移
+ ///
+ public const uint Displacement = 0x8E58;
///
diff --git a/Sln.Iot/Program.cs b/Sln.Iot/Program.cs
index cd8b3fa..9432599 100644
--- a/Sln.Iot/Program.cs
+++ b/Sln.Iot/Program.cs
@@ -79,7 +79,7 @@ namespace Sln.Iot
}
};
- ServiceProvider.UseSerialPortExtensions();
+ //ServiceProvider.UseSerialPortExtensions();
await Task.Delay(-1);
}
diff --git a/Sln.Iot/appsettings.json b/Sln.Iot/appsettings.json
index 880627a..afffa8f 100644
--- a/Sln.Iot/appsettings.json
+++ b/Sln.Iot/appsettings.json
@@ -10,10 +10,10 @@
"SqlConfig": [
{
"configId": "tao_iot", //tao:青岛胶东机场简称
- "dbType": 0, //tidb按照 mysql 去连接
+ "dbType": 1, //tidb按照 mysql 去连接
"isFlag": true,
//"connStr": "server=127.0.0.1;Port=4000;Database=tao_iot;Uid=root;" //Pwd=haiwei@123;
- "connStr": "server=1.13.177.47;Port=3306;Database=tao_iot;Uid=root;Pwd=Haiwei123456;"
+ "connStr": "server=119.45.202.115;uid=sa;pwd=haiwei@123;database=energy-visual;Encrypt=True;TrustServerCertificate=True;"
}
],
"serialPortConfig": {
diff --git a/Sln.Iot/readme.md b/Sln.Iot/readme.md
index 823928f..25ac0fb 100644
--- a/Sln.Iot/readme.md
+++ b/Sln.Iot/readme.md
@@ -189,13 +189,13 @@
| 0x9010 | 正向有功总电能 | 0x9B0E | 仪表密度值 |
| 0x8030 | 仪表数据采集时间 | | |
-| 标识符类型 | 说明 | 标识符类型 | 说明 |
-| --- | --- | --- | --- |
+| 标识符类型 | 说明 | 标识符类型 | 说明 |
+| --- | --- |--------| |
| 0x8E50 | 温湿度.温度 | 0x8E51 | 照度.流明 |
| 0x8E52 | 温湿度.湿度 | 0x8E53 | 噪声.分贝 |
| 0x8E54 | 振动-速度 | 0x8E55 | 振动-位移 |
| 0x8E56 | 振动-加速度 | 0x8E57 | 振动-温度 |
-| 0x8030 | 仪表数据采集时间 | | |
+| 0x8030 | 仪表数据采集时间 | 0x8E58 | 位移 |
指令样例: