Plugins/Drivers/DriverModbusMaster/NModbus4/InvalidModbusRequestException.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Modbus
{
using System;
#if NET46
using System.Runtime.Serialization;
#endif
/// <summary>
/// An exception that provides the exception code that will be sent in response to an invalid Modbus request.
/// </summary>
#if NET46
[Serializable]
#endif
public class InvalidModbusRequestException : Exception
{
private readonly byte _exceptionCode;
/// <summary>
/// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with a specified Modbus exception code.
/// </summary>
/// <param name="exceptionCode">The Modbus exception code to provide to the slave.</param>
public InvalidModbusRequestException(byte exceptionCode)
: this(GetMessage(exceptionCode), exceptionCode)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with a specified error message and Modbus exception code.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="exceptionCode">The Modbus exception code to provide to the slave.</param>
public InvalidModbusRequestException(string message, byte exceptionCode)
: this(message, exceptionCode, null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with a specified Modbus exception code and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="exceptionCode">The Modbus exception code to provide to the slave.</param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param>
public InvalidModbusRequestException(byte exceptionCode, Exception innerException)
: this(GetMessage(exceptionCode), exceptionCode, innerException)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with a specified Modbus exception code and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="exceptionCode">The Modbus exception code to provide to the slave.</param>
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param>
public InvalidModbusRequestException(string message, byte exceptionCode, Exception innerException)
: base(message, innerException)
{
_exceptionCode = exceptionCode;
}
#if NET46
/// <summary>
/// Initializes a new instance of the <see cref="InvalidModbusRequestException" /> class with serialized data.
后面还有 35 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
