2017-10-21 Update 1 Emergency Fix Siemens Error Throw Fix.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<AssemblyName>Modbus.Net.Siemens.Core</AssemblyName>
|
||||
<RootNamespace>Modbus.Net.Siemens</RootNamespace>
|
||||
<PackageId>Modbus.Net.Siemens.Core</PackageId>
|
||||
<Version>1.3.10</Version>
|
||||
<Version>1.3.10.2</Version>
|
||||
<Authors>Chris L.(Luo Sheng)</Authors>
|
||||
<Company>Hangzhou Delian IoT Science Technology Co.,Ltd.</Company>
|
||||
<Description>Modbus.Net Siemens Profinet Implementation</Description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<AssemblyName>Modbus.Net.Siemens</AssemblyName>
|
||||
<RootNamespace>Modbus.Net.Siemens</RootNamespace>
|
||||
<PackageId>Modbus.Net.Siemens</PackageId>
|
||||
<Version>1.3.10</Version>
|
||||
<Version>1.3.10.2</Version>
|
||||
<Authors>Chris L.(Luo Sheng)</Authors>
|
||||
<Company>Hangzhou Delian IoT Science Technology Co.,Ltd.</Company>
|
||||
<Description>Modbus.Net Siemens Profinet Implementation</Description>
|
||||
|
||||
@@ -860,13 +860,26 @@ namespace Modbus.Net.Siemens
|
||||
{0xEF, "Layer 2 specific error"}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<int, string> ProtocalErrorDetailDictionary = new Dictionary<int, string>
|
||||
{
|
||||
{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"}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="errCls">错误分类</param>
|
||||
/// <param name="errCod">错误码</param>
|
||||
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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user