更改S7协议 设备属性,注意删除了DstTSAP,改为较直观的 机架号/槽位号

This commit is contained in:
Kimdiego2098
2023-10-24 23:47:35 +08:00
parent fd9c14612a
commit 88d71e271e
8 changed files with 45 additions and 42 deletions

View File

@@ -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
{

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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>