fix: 转换器实例初始化方法

This commit is contained in:
Diego
2025-02-14 16:23:00 +08:00
parent 4faf41e482
commit 783f878947
8 changed files with 9 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<PluginVersion>10.0.1.4</PluginVersion>
<ProPluginVersion>10.0.1.4</ProPluginVersion>
<PluginVersion>10.0.1.5</PluginVersion>
<ProPluginVersion>10.0.1.5</ProPluginVersion>
</PropertyGroup>
<PropertyGroup>

View File

@@ -874,7 +874,7 @@ public abstract class DeviceBase : DisposableObject, IDevice
try
{
//只关闭,不释放
Channel.SafeClose();
_ = Channel.CloseAsync();
if (Channel is IClientChannel client)
{
client.WaitHandlePool.SafeDispose();

View File

@@ -118,6 +118,7 @@ public class Device : BaseDataEntity, IValidatableObject
/// </summary>
[SugarColumn(ColumnDescription = "冗余扫描间隔")]
[AutoGenerateColumn(Visible = true, Filterable = true, Sortable = true)]
[MinValue(30000)]
public virtual int RedundantScanIntervalTime { get; set; } = 30000;
/// <summary>

View File

@@ -21,10 +21,10 @@ public class Dlt645_2007Master : DeviceBase, IDtu
public override void InitChannel(IChannel channel, ILog? deviceLog = null)
{
base.InitChannel(channel, deviceLog);
ThingsGatewayBitConverter = new Dlt645_2007BitConverter(EndianType.Big);
RegisterByteLength = 2;
channel.MaxSign = ushort.MaxValue;
}
public override IThingsGatewayBitConverter ThingsGatewayBitConverter { get; protected set; } = new Dlt645_2007BitConverter(EndianType.Big) { };
/// <summary>
/// 客户端连接滑动过期时间(TCP服务通道时)

View File

@@ -18,10 +18,10 @@ public partial class ModbusMaster : DeviceBase, IDtu
{
base.InitChannel(channel, deviceLog);
ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
RegisterByteLength = 2;
channel.MaxSign = ushort.MaxValue;
}
public override IThingsGatewayBitConverter ThingsGatewayBitConverter { get; protected set; } = new ThingsGatewayBitConverter(EndianType.Big) { };
/// <summary>
/// 客户端连接滑动过期时间(TCP服务通道时)

View File

@@ -48,10 +48,10 @@ public class ModbusSlave : DeviceBase, ITcpService, IDtuClient
public override void InitChannel(IChannel channel, ILog? deviceLog = null)
{
base.InitChannel(channel, deviceLog);
ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
RegisterByteLength = 2;
channel.MaxSign = ushort.MaxValue;
}
public override IThingsGatewayBitConverter ThingsGatewayBitConverter { get; protected set; } = new ThingsGatewayBitConverter(EndianType.Big) { };
public override bool SupportMultipleDevice()
{

View File

@@ -24,9 +24,9 @@ public partial class SiemensS7Master : DeviceBase
base.InitChannel(channel, deviceLog);
RegisterByteLength = 1;
ThingsGatewayBitConverter = new S7BitConverter(EndianType.Big);
}
public override IThingsGatewayBitConverter ThingsGatewayBitConverter { get; protected set; } = new S7BitConverter(EndianType.Big) { };
/// <summary>
/// PduLength

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>10.0.1.4</Version>
<Version>10.0.1.5</Version>
</PropertyGroup>
<ItemGroup>