Added VirtualModbusClient to Common
This commit is contained in:
@@ -8,19 +8,26 @@ namespace AMWD.Protocols.Modbus.Common.Events
|
||||
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public class CoilWrittenEventArgs : EventArgs
|
||||
{
|
||||
internal CoilWrittenEventArgs(byte unitId, ushort address, bool value)
|
||||
{
|
||||
UnitId = unitId;
|
||||
Address = address;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unit id.
|
||||
/// </summary>
|
||||
public byte UnitId { get; set; }
|
||||
public byte UnitId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the coil address.
|
||||
/// </summary>
|
||||
public ushort Address { get; set; }
|
||||
public ushort Address { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the coil value.
|
||||
/// </summary>
|
||||
public bool Value { get; set; }
|
||||
public bool Value { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,29 +8,39 @@ namespace AMWD.Protocols.Modbus.Common.Events
|
||||
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public class RegisterWrittenEventArgs : EventArgs
|
||||
{
|
||||
internal RegisterWrittenEventArgs(byte unitId, ushort address, byte highByte, byte lowByte)
|
||||
{
|
||||
UnitId = unitId;
|
||||
Address = address;
|
||||
HighByte = highByte;
|
||||
LowByte = lowByte;
|
||||
|
||||
Value = new[] { highByte, lowByte }.GetBigEndianUInt16();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unit id.
|
||||
/// </summary>
|
||||
public byte UnitId { get; set; }
|
||||
public byte UnitId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the address of the register.
|
||||
/// </summary>
|
||||
public ushort Address { get; set; }
|
||||
public ushort Address { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the register.
|
||||
/// </summary>
|
||||
public ushort Value { get; set; }
|
||||
public ushort Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the high byte of the register.
|
||||
/// </summary>
|
||||
public byte HighByte { get; set; }
|
||||
public byte HighByte { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the low byte of the register.
|
||||
/// </summary>
|
||||
public byte LowByte { get; set; }
|
||||
public byte LowByte { get; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user