IModbusMessage.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Diagnostics.CodeAnalysis;
  2. namespace NModbus
  3. {
  4. /// <summary>
  5. /// A message built by the master (client) that initiates a Modbus transaction.
  6. /// </summary>
  7. public interface IModbusMessage
  8. {
  9. /// <summary>
  10. /// The function code tells the server what kind of action to perform.
  11. /// </summary>
  12. byte FunctionCode { get; set; }
  13. /// <summary>
  14. /// Address of the slave (server).
  15. /// </summary>
  16. byte SlaveAddress { get; set; }
  17. /// <summary>
  18. /// Composition of the slave address and protocol data unit.
  19. /// </summary>
  20. [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
  21. byte[] MessageFrame { get; }
  22. /// <summary>
  23. /// Composition of the function code and message data.
  24. /// </summary>
  25. [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
  26. byte[] ProtocolDataUnit { get; }
  27. /// <summary>
  28. /// A unique identifier assigned to a message when using the IP protocol.
  29. /// </summary>
  30. ushort TransactionId { get; set; }
  31. /// <summary>
  32. /// Initializes a modbus message from the specified message frame.
  33. /// </summary>
  34. /// <param name="frame">Bytes of Modbus frame.</param>
  35. void Initialize(byte[] frame);
  36. }
  37. }