mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 18:51:28 +08:00
添加modbus的字符串按字反转配置
This commit is contained in:
@@ -68,6 +68,21 @@ public abstract class ProtocolBase : DisposableObject, IProtocol
|
||||
/// </summary>
|
||||
public virtual ushort ConnectTimeout { get; set; } = 3000;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="IThingsGatewayBitConverter.IsStringReverseByteWord"/>
|
||||
/// </summary>
|
||||
public bool IsStringReverseByteWord
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThingsGatewayBitConverter.IsStringReverseByteWord;
|
||||
}
|
||||
set
|
||||
{
|
||||
ThingsGatewayBitConverter.IsStringReverseByteWord = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual IChannel Channel { get; }
|
||||
|
||||
|
@@ -44,6 +44,7 @@ public class ModbusMaster : CollectBase
|
||||
_plc = new(channel)
|
||||
{
|
||||
DataFormat = _driverPropertys.DataFormat,
|
||||
IsStringReverseByteWord = _driverPropertys.IsStringReverseByteWord,
|
||||
SendDelayTime = _driverPropertys.SendDelayTime,
|
||||
CacheTimeout = _driverPropertys.CacheTimeout,
|
||||
ConnectTimeout = _driverPropertys.ConnectTimeout,
|
||||
|
@@ -24,17 +24,28 @@ public class ModbusMasterProperty : CollectPropertyBase
|
||||
{
|
||||
[DynamicProperty("Modbus协议类型", "")]
|
||||
public ModbusTypeEnum ModbusType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 心跳检测
|
||||
/// </summary>
|
||||
[DynamicProperty("心跳检测", "大写16进制字符串,符合心跳内容会自动回应")]
|
||||
public string HeartbeatHexString { get; set; } = "FFFF8080";
|
||||
|
||||
/// <summary>
|
||||
/// 默认站号
|
||||
/// </summary>
|
||||
[DynamicProperty("默认站号", "")]
|
||||
public byte Station { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 默认解析顺序
|
||||
/// </summary>
|
||||
[DynamicProperty("默认解析顺序", "")]
|
||||
public DataFormatEnum DataFormat { get; set; }
|
||||
|
||||
[DynamicProperty("字符串按字反转", "")]
|
||||
public bool IsStringReverseByteWord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 无交互2min时断开连接
|
||||
/// </summary>
|
||||
@@ -65,12 +76,6 @@ public class ModbusMasterProperty : CollectPropertyBase
|
||||
[DynamicProperty("组包缓存超时", "某些设备性能较弱,报文间需要间隔较长时间,可以设置更长的组包缓存,默认1000ms")]
|
||||
public int CacheTimeout { get; set; } = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// 默认解析顺序
|
||||
/// </summary>
|
||||
[DynamicProperty("默认解析顺序", "")]
|
||||
public DataFormatEnum DataFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大打包长度
|
||||
/// </summary>
|
||||
|
@@ -69,6 +69,7 @@ public class ModbusSlave : BusinessBase
|
||||
_plc = new(channel)
|
||||
{
|
||||
DataFormat = _driverPropertys.DataFormat,
|
||||
IsStringReverseByteWord = _driverPropertys.IsStringReverseByteWord,
|
||||
CacheTimeout = _driverPropertys.CacheTimeout,
|
||||
Station = _driverPropertys.Station,
|
||||
IsWriteMemory = _driverPropertys.IsWriteMemory,
|
||||
|
@@ -37,6 +37,9 @@ public class ModbusSlaveProperty : BusinessPropertyBase
|
||||
[DynamicProperty("默认解析顺序", "")]
|
||||
public DataFormatEnum DataFormat { get; set; }
|
||||
|
||||
[DynamicProperty("字符串按字反转", "")]
|
||||
public bool IsStringReverseByteWord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 无交互2min时断开连接
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user