tbf/TBF/Rig/GenericDevices/IModbus.cs
2021-10-26 19:38:09 +02:00

32 lines
1.1 KiB
C#

///
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.GenericDevices
{
public interface IModbus : IComponent
{
/// <summary>
/// Send an arbitrary modbus message.
/// When the message length is N, however only bytes 1..N-2 have to be set.
/// The last two message bytes (CRC) may be uninitialized or zero.
/// They are calculated inside this function as required by Modbus specification.
/// </summary>
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
void SendMessage(byte[] message);
/// <summary>
/// Send a structured modbus message.
/// </summary>
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
/// <param name="function">Function (0..127)</param>
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount);
Queue<byte[]>[] ReceivedTelegrams { get; }
}
}