From 42c740fa1b5d959c164c49514be633f00ad9b0e0 Mon Sep 17 00:00:00 2001
From: "2248356998 qq.com" <2248356998@qq.com>
Date: Tue, 7 Oct 2025 22:25:38 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ThingsGateway.Common/ThingsGateway.Common.csproj | 2 +-
.../ThingsGateway.Furion/ThingsGateway.Furion.csproj | 2 +-
.../ThingsGateway.Razor/ThingsGateway.Razor.csproj | 2 +-
.../ThingsGateway.SqlSugar.csproj | 2 +-
src/Directory.Build.props | 10 +++++-----
.../ThingsGateway.CSScript.csproj | 2 +-
.../DebugPages/ChannelComponent.razor | 1 +
.../ThingsGateway.Foundation.Razor/Locales/en-US.json | 2 ++
.../ThingsGateway.Foundation.Razor/Locales/zh-CN.json | 2 ++
.../Channel/ChannelOptionsBase.cs | 2 ++
.../Channel/Extension/ChannelOptionsExtensions.cs | 1 +
.../Channel/IChannelOptions.cs | 2 ++
.../ThingsGateway.Foundation/Device/DeviceBase.cs | 6 +++---
.../ThingsGateway.Foundation/Device/IDevice.cs | 2 +-
.../ThingsGateway.Foundation/Locales/en-US.json | 1 +
.../ThingsGateway.Foundation/Locales/zh-CN.json | 1 +
.../Entity/Channel.cs | 7 +++++++
.../Locales/en-US.json | 1 +
.../Locales/zh-CN.json | 1 +
.../Channel/ChannelEditComponent.razor | 1 +
.../Channel/ChannelRuntimeInfo1.razor | 1 +
.../Benchmark/ModbusBenchmark.cs | 2 +-
.../ThingsGateway.Foundation.Test.csproj | 2 +-
23 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/src/Admin/ThingsGateway.Common/ThingsGateway.Common.csproj b/src/Admin/ThingsGateway.Common/ThingsGateway.Common.csproj
index 90c3fbf44..612a60f18 100644
--- a/src/Admin/ThingsGateway.Common/ThingsGateway.Common.csproj
+++ b/src/Admin/ThingsGateway.Common/ThingsGateway.Common.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Admin/ThingsGateway.Furion/ThingsGateway.Furion.csproj b/src/Admin/ThingsGateway.Furion/ThingsGateway.Furion.csproj
index c00d7bd42..858e02455 100644
--- a/src/Admin/ThingsGateway.Furion/ThingsGateway.Furion.csproj
+++ b/src/Admin/ThingsGateway.Furion/ThingsGateway.Furion.csproj
@@ -29,7 +29,7 @@
-
+
diff --git a/src/Admin/ThingsGateway.Razor/ThingsGateway.Razor.csproj b/src/Admin/ThingsGateway.Razor/ThingsGateway.Razor.csproj
index e281234af..366545894 100644
--- a/src/Admin/ThingsGateway.Razor/ThingsGateway.Razor.csproj
+++ b/src/Admin/ThingsGateway.Razor/ThingsGateway.Razor.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/Admin/ThingsGateway.SqlSugar/ThingsGateway.SqlSugar.csproj b/src/Admin/ThingsGateway.SqlSugar/ThingsGateway.SqlSugar.csproj
index 2738988ef..56bc2ec7f 100644
--- a/src/Admin/ThingsGateway.SqlSugar/ThingsGateway.SqlSugar.csproj
+++ b/src/Admin/ThingsGateway.SqlSugar/ThingsGateway.SqlSugar.csproj
@@ -28,7 +28,7 @@
-
+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 3e5aa62a0..6d9b5319a 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,9 +1,9 @@
- 10.11.83
- 10.11.83
- 10.11.83
+ 10.11.84
+ 10.11.84
+ 10.11.84
10.11.6
10.11.6
8.0.20
@@ -12,7 +12,7 @@
false
10.11.70
10.11.70
- 4.0.0-beta.80
+ 4.0.0-beta.96
@@ -73,7 +73,7 @@
True
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Foundation/ThingsGateway.CSScript/ThingsGateway.CSScript.csproj b/src/Foundation/ThingsGateway.CSScript/ThingsGateway.CSScript.csproj
index 61eeb3281..79abe6a67 100644
--- a/src/Foundation/ThingsGateway.CSScript/ThingsGateway.CSScript.csproj
+++ b/src/Foundation/ThingsGateway.CSScript/ThingsGateway.CSScript.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/Foundation/ThingsGateway.Foundation.Razor/DebugPages/ChannelComponent.razor b/src/Foundation/ThingsGateway.Foundation.Razor/DebugPages/ChannelComponent.razor
index 817e0fc6d..f71671cae 100644
--- a/src/Foundation/ThingsGateway.Foundation.Razor/DebugPages/ChannelComponent.razor
+++ b/src/Foundation/ThingsGateway.Foundation.Razor/DebugPages/ChannelComponent.razor
@@ -36,6 +36,7 @@
+
diff --git a/src/Foundation/ThingsGateway.Foundation.Razor/Locales/en-US.json b/src/Foundation/ThingsGateway.Foundation.Razor/Locales/en-US.json
index 01ea59cde..3d044e671 100644
--- a/src/Foundation/ThingsGateway.Foundation.Razor/Locales/en-US.json
+++ b/src/Foundation/ThingsGateway.Foundation.Razor/Locales/en-US.json
@@ -42,6 +42,7 @@
"PortName": "COM Port",
"RemoteUrl": "Remote IP Address",
"RtsEnable": "Rts",
+ "StreamAsync": "StreamAsync",
"Handshake": "Handshake",
"SaveChannel": "Add/Modify Channel",
"StopBits": "Stop Bits"
@@ -102,6 +103,7 @@
"PortName": "PortName",
"RemoteUrl": "RemoteUrl",
"RtsEnable": "RtsEnable",
+ "StreamAsync": "StreamAsync",
"Handshake": "Handshake",
"StopBits": "StopBits"
}
diff --git a/src/Foundation/ThingsGateway.Foundation.Razor/Locales/zh-CN.json b/src/Foundation/ThingsGateway.Foundation.Razor/Locales/zh-CN.json
index 9d4c1cd7d..3901f2ec9 100644
--- a/src/Foundation/ThingsGateway.Foundation.Razor/Locales/zh-CN.json
+++ b/src/Foundation/ThingsGateway.Foundation.Razor/Locales/zh-CN.json
@@ -40,6 +40,7 @@
"PortName": "COM口",
"RemoteUrl": "远程url",
"RtsEnable": "Rts",
+ "StreamAsync": "流读写",
"Handshake": "Handshake",
"SaveChannel": "添加/修改通道",
"StopBits": "停止位"
@@ -100,6 +101,7 @@
"PortName": "COM口",
"RemoteUrl": "远程url",
"RtsEnable": "Rts",
+ "StreamAsync": "流读写",
"Handshake": "串口流读写",
"StopBits": "停止位"
}
diff --git a/src/Foundation/ThingsGateway.Foundation/Channel/ChannelOptionsBase.cs b/src/Foundation/ThingsGateway.Foundation/Channel/ChannelOptionsBase.cs
index 95bc15db3..c68e5ccc1 100644
--- a/src/Foundation/ThingsGateway.Foundation/Channel/ChannelOptionsBase.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Channel/ChannelOptionsBase.cs
@@ -78,6 +78,8 @@ namespace ThingsGateway.Foundation
///
public virtual bool RtsEnable { get; set; } = true;
+ public virtual bool StreamAsync { get; set; } = true;
+
///
[MinValue(1)]
public virtual int MaxConcurrentCount { get; set; } = 1;
diff --git a/src/Foundation/ThingsGateway.Foundation/Channel/Extension/ChannelOptionsExtensions.cs b/src/Foundation/ThingsGateway.Foundation/Channel/Extension/ChannelOptionsExtensions.cs
index 6d7cc3cba..a734f3690 100644
--- a/src/Foundation/ThingsGateway.Foundation/Channel/Extension/ChannelOptionsExtensions.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Channel/Extension/ChannelOptionsExtensions.cs
@@ -172,6 +172,7 @@ public static class ChannelOptionsExtensions
options.DtrEnable = channelOptions.DtrEnable;
options.RtsEnable = channelOptions.RtsEnable;
options.Handshake = channelOptions.Handshake;
+ options.StreamAsync = channelOptions.StreamAsync;
});
//载入配置
SerialPortChannel serialPortChannel = new SerialPortChannel(channelOptions);
diff --git a/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs b/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
index b02d46686..3c75b81f9 100644
--- a/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Channel/IChannelOptions.cs
@@ -72,6 +72,8 @@ public interface IChannelOptions
///
bool RtsEnable { get; set; }
+ bool StreamAsync { get; set; }
+
Handshake Handshake { get; set; }
#endregion
///
diff --git a/src/Foundation/ThingsGateway.Foundation/Device/DeviceBase.cs b/src/Foundation/ThingsGateway.Foundation/Device/DeviceBase.cs
index ef65e3a5d..a056a783a 100644
--- a/src/Foundation/ThingsGateway.Foundation/Device/DeviceBase.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Device/DeviceBase.cs
@@ -348,7 +348,7 @@ public abstract class DeviceBase : AsyncAndSyncDisposableObject, IDevice
}
- private Task BeforeSendAsync(IClientChannel channel, CancellationToken token)
+ private ValueTask BeforeSendAsync(IClientChannel channel, CancellationToken token)
{
SetDataAdapter(channel);
if (AutoConnect && Channel != null && Channel?.Online != true)
@@ -357,13 +357,13 @@ public abstract class DeviceBase : AsyncAndSyncDisposableObject, IDevice
}
else
{
- return Task.CompletedTask;
+ return EasyValueTask.CompletedTask;
}
}
private WaitLock connectWaitLock = new(nameof(DeviceBase));
- public async Task ConnectAsync(CancellationToken token)
+ public async ValueTask ConnectAsync(CancellationToken token)
{
if (AutoConnect && Channel != null && Channel?.Online != true)
{
diff --git a/src/Foundation/ThingsGateway.Foundation/Device/IDevice.cs b/src/Foundation/ThingsGateway.Foundation/Device/IDevice.cs
index 16f36a1c4..2bf989c4a 100644
--- a/src/Foundation/ThingsGateway.Foundation/Device/IDevice.cs
+++ b/src/Foundation/ThingsGateway.Foundation/Device/IDevice.cs
@@ -467,5 +467,5 @@ public interface IDevice : IDisposable, IDisposableObject, IAsyncDisposable
/// 单独设备日志
void InitChannel(IChannel channel, ILog? deviceLog = null);
ValueTask>> ReadAsync(object state, CancellationToken cancellationToken = default);
- Task ConnectAsync(CancellationToken token);
+ ValueTask ConnectAsync(CancellationToken token);
}
diff --git a/src/Foundation/ThingsGateway.Foundation/Locales/en-US.json b/src/Foundation/ThingsGateway.Foundation/Locales/en-US.json
index 36ff5b4f8..8d1fd2dd6 100644
--- a/src/Foundation/ThingsGateway.Foundation/Locales/en-US.json
+++ b/src/Foundation/ThingsGateway.Foundation/Locales/en-US.json
@@ -22,6 +22,7 @@
"PortName": "PortName",
"RemoteUrl": "RemoteUrl",
"RtsEnable": "RtsEnable",
+ "StreamAsync": "StreamAsync",
"Handshake": "Handshake",
"StopBits": "StopBits"
},
diff --git a/src/Foundation/ThingsGateway.Foundation/Locales/zh-CN.json b/src/Foundation/ThingsGateway.Foundation/Locales/zh-CN.json
index c9af2032f..edcc07e8b 100644
--- a/src/Foundation/ThingsGateway.Foundation/Locales/zh-CN.json
+++ b/src/Foundation/ThingsGateway.Foundation/Locales/zh-CN.json
@@ -22,6 +22,7 @@
"PortName": "COM口",
"RemoteUrl": "远程url",
"RtsEnable": "Rts",
+ "StreamAsync": "流读写",
"Handshake": "Handshake",
"StopBits": "停止位"
},
diff --git a/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs b/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
index 6695a4eb0..b16b1fe96 100644
--- a/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
+++ b/src/Gateway/ThingsGateway.Gateway.Application/Entity/Channel.cs
@@ -137,6 +137,13 @@ public class Channel : ChannelOptionsBase, IPrimaryIdEntity, IBaseDataEntity, IB
[AutoGenerateColumn(Visible = false, Filterable = true, Sortable = true)]
public override bool RtsEnable { get; set; }
+ ///
+ /// StreamAsync
+ ///
+ [SugarColumn(ColumnDescription = "StreamAsync", IsNullable = true)]
+ [AutoGenerateColumn(Visible = false, Filterable = true, Sortable = true)]
+ public override bool StreamAsync { get; set; }
+
///
/// Handshake
///
diff --git a/src/Gateway/ThingsGateway.Gateway.Application/Locales/en-US.json b/src/Gateway/ThingsGateway.Gateway.Application/Locales/en-US.json
index 7e0090a10..f2492a9c8 100644
--- a/src/Gateway/ThingsGateway.Gateway.Application/Locales/en-US.json
+++ b/src/Gateway/ThingsGateway.Gateway.Application/Locales/en-US.json
@@ -307,6 +307,7 @@
"PortName": "PortName",
"RemoteUrl": "RemoteUrl",
"RtsEnable": "RtsEnable",
+ "StreamAsync": "StreamAsync",
"Handshake": "Handshake",
"SaveChannel": "Add/Modify Channel",
"SortCode": "SortCode",
diff --git a/src/Gateway/ThingsGateway.Gateway.Application/Locales/zh-CN.json b/src/Gateway/ThingsGateway.Gateway.Application/Locales/zh-CN.json
index 41227bf11..97661e05d 100644
--- a/src/Gateway/ThingsGateway.Gateway.Application/Locales/zh-CN.json
+++ b/src/Gateway/ThingsGateway.Gateway.Application/Locales/zh-CN.json
@@ -306,6 +306,7 @@
"PortName": "COM口",
"RemoteUrl": "远程url",
"RtsEnable": "Rts",
+ "StreamAsync": "流读写",
"Handshake": "Handshake",
"SaveChannel": "添加/修改通道",
"SortCode": "排序",
diff --git a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelEditComponent.razor b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelEditComponent.razor
index 83b967781..24c34e906 100644
--- a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelEditComponent.razor
+++ b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelEditComponent.razor
@@ -114,6 +114,7 @@
+
diff --git a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelRuntimeInfo1.razor b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelRuntimeInfo1.razor
index d55a931ab..dd86d5363 100644
--- a/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelRuntimeInfo1.razor
+++ b/src/Gateway/ThingsGateway.Gateway.Razor/Pages/GatewayMonitorPage/Channel/ChannelRuntimeInfo1.razor
@@ -82,6 +82,7 @@
+
diff --git a/src/Plugin/ThingsGateway.Foundation.Benchmark/Benchmark/ModbusBenchmark.cs b/src/Plugin/ThingsGateway.Foundation.Benchmark/Benchmark/ModbusBenchmark.cs
index 45dd902be..569fb3fcb 100644
--- a/src/Plugin/ThingsGateway.Foundation.Benchmark/Benchmark/ModbusBenchmark.cs
+++ b/src/Plugin/ThingsGateway.Foundation.Benchmark/Benchmark/ModbusBenchmark.cs
@@ -35,7 +35,7 @@ public class ModbusBenchmark : IDisposable
{
public static int ClientCount = 1;
public static int TaskNumberOfItems = 1;
- public static int NumberOfItems = 1000;
+ public static int NumberOfItems = 10;
private readonly List _lgbModbusClients = [];
private List thingsgatewaymodbuss = new();
diff --git a/src/Plugin/ThingsGateway.Foundation.Test/ThingsGateway.Foundation.Test.csproj b/src/Plugin/ThingsGateway.Foundation.Test/ThingsGateway.Foundation.Test.csproj
index 84fcc47ba..89431b4ae 100644
--- a/src/Plugin/ThingsGateway.Foundation.Test/ThingsGateway.Foundation.Test.csproj
+++ b/src/Plugin/ThingsGateway.Foundation.Test/ThingsGateway.Foundation.Test.csproj
@@ -12,7 +12,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all