diff --git a/Modbus.Net/Modbus.Net.Siemens.Core/Modbus.Net.Siemens.Core.csproj b/Modbus.Net/Modbus.Net.Siemens.Core/Modbus.Net.Siemens.Core.csproj
index 0cca534..d8d7be0 100644
--- a/Modbus.Net/Modbus.Net.Siemens.Core/Modbus.Net.Siemens.Core.csproj
+++ b/Modbus.Net/Modbus.Net.Siemens.Core/Modbus.Net.Siemens.Core.csproj
@@ -5,7 +5,7 @@
Modbus.Net.Siemens.Core
Modbus.Net.Siemens
Modbus.Net.Siemens.Core
- 1.3.10
+ 1.3.10.2
Chris L.(Luo Sheng)
Hangzhou Delian IoT Science Technology Co.,Ltd.
Modbus.Net Siemens Profinet Implementation
diff --git a/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj b/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
index 3df61f7..2d0843c 100644
--- a/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
+++ b/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
@@ -5,7 +5,7 @@
Modbus.Net.Siemens
Modbus.Net.Siemens
Modbus.Net.Siemens
- 1.3.10
+ 1.3.10.2
Chris L.(Luo Sheng)
Hangzhou Delian IoT Science Technology Co.,Ltd.
Modbus.Net Siemens Profinet Implementation
diff --git a/Modbus.Net/src/Siemens.Common/SiemensProtocal.cs b/Modbus.Net/src/Siemens.Common/SiemensProtocal.cs
index d40729f..b2f9954 100644
--- a/Modbus.Net/src/Siemens.Common/SiemensProtocal.cs
+++ b/Modbus.Net/src/Siemens.Common/SiemensProtocal.cs
@@ -860,13 +860,26 @@ namespace Modbus.Net.Siemens
{0xEF, "Layer 2 specific error"}
};
+ private static readonly Dictionary ProtocalErrorDetailDictionary = new Dictionary
+ {
+ {0x8304, "Resource not available,\r\n there are no more resources available for application associations to be established" },
+ {0x8104, "Context is not supported:\r\n -Error in PDU structure\r\n -Unknown service" },
+ {0x8404, "Fatal error detected.\r\n Service or function aborted" },
+ {0x8500, "PDU size error"}
+ };
+
///
/// 构造函数
///
/// 错误分类
/// 错误码
public SiemensProtocalErrorException(int errCls, int errCod)
- : base(ProtocalErrorDictionary[errCls] + " : " + errCod)
+ : base((ProtocalErrorDictionary.ContainsKey(errCls)
+ ? ProtocalErrorDictionary[errCls]
+ : "Unknown error") + " \r\n " +
+ (ProtocalErrorDetailDictionary.ContainsKey(errCls * 256 + errCod)
+ ? ProtocalErrorDetailDictionary[errCls * 256 + errCod]
+ : "Unknown error detail"))
{
ErrorClass = errCls;
ErrorCode = errCod;
diff --git a/Modbus.Net/src/Siemens.Common/SiemensTcpProtocalLinker.cs b/Modbus.Net/src/Siemens.Common/SiemensTcpProtocalLinker.cs
index 14be570..bab66c8 100644
--- a/Modbus.Net/src/Siemens.Common/SiemensTcpProtocalLinker.cs
+++ b/Modbus.Net/src/Siemens.Common/SiemensTcpProtocalLinker.cs
@@ -43,6 +43,8 @@ namespace Modbus.Net.Siemens
case 0xf0:
switch (content[8])
{
+ case 0x01:
+ case 0x02:
case 0x03:
if (content[17] == 0x00 && content[18] == 0x00) return true;
throw new SiemensProtocalErrorException(content[17], content[18]);