更改S7协议 设备属性,注意删除了DstTSAP,改为较直观的 机架号/槽位号
This commit is contained in:
@@ -123,34 +123,7 @@ namespace ThingsGateway.Foundation.Adapter.Siemens
|
||||
#region 设置
|
||||
|
||||
/// <summary>
|
||||
/// 远程TSAP,需重新连接
|
||||
/// </summary>
|
||||
public int DestTSAP
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
_currentPlc == SiemensEnum.S200 || _currentPlc == SiemensEnum.S200Smart ?
|
||||
(ISO_CR[17] * 256) + ISO_CR[18] :
|
||||
(ISO_CR[20] * 256) + ISO_CR[21];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_currentPlc == SiemensEnum.S200 || _currentPlc == SiemensEnum.S200Smart)
|
||||
{
|
||||
ISO_CR[17] = BitConverter.GetBytes(value)[1];
|
||||
ISO_CR[18] = BitConverter.GetBytes(value)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
ISO_CR[20] = BitConverter.GetBytes(value)[1];
|
||||
ISO_CR[21] = BitConverter.GetBytes(value)[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本地TSAP,需重新连接
|
||||
/// 本地TSAP
|
||||
/// </summary>
|
||||
public int LocalTSAP
|
||||
{
|
||||
|
@@ -43,9 +43,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,13 @@ namespace ThingsGateway.Plugin.Siemens
|
||||
{
|
||||
_plc.LocalTSAP = driverPropertys.LocalTSAP;
|
||||
}
|
||||
if (driverPropertys.DestTSAP != 0)
|
||||
if (driverPropertys.Rack != 0)
|
||||
{
|
||||
_plc.DestTSAP = driverPropertys.DestTSAP;
|
||||
_plc.Rack = driverPropertys.Rack;
|
||||
}
|
||||
if (driverPropertys.Slot != 0)
|
||||
{
|
||||
_plc.Slot = driverPropertys.Slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,13 +37,19 @@ public class SiemensProperty : CollectDriverPropertyBase
|
||||
/// </summary>
|
||||
[DeviceProperty("默认解析顺序", "")] public DataFormat DataFormat { get; set; }
|
||||
/// <summary>
|
||||
/// DestTSAP
|
||||
/// Rack
|
||||
/// </summary>
|
||||
[DeviceProperty("DestTSAP", "为0时不写入,通常默认0即可")] public int DestTSAP { get; set; } = 0;
|
||||
[DeviceProperty("机架号", "为0时不写入")] public byte Rack { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Slot
|
||||
/// </summary>
|
||||
[DeviceProperty("槽位号", "为0时不写入")] public byte Slot { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// LocalTSAP
|
||||
/// </summary>
|
||||
[DeviceProperty("LocalTSAP", "为0时不写入,通常默认0即可")] public int LocalTSAP { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user