namespace RobotNet10.Script.IO; /// /// Interface for ModbusTCP connection operations. /// public interface IModbusTcpConnection : IDisposable { /// /// Gets the IP address of the ModbusTCP server. /// string IpAddress { get; } /// /// Gets the port of the ModbusTCP server. /// int Port { get; } /// /// Gets the slave ID (unit identifier). /// byte SlaveId { get; } /// /// Gets whether the connection is currently connected. /// bool IsConnected { get; } /// /// Connects to the ModbusTCP server. /// Task ConnectAsync(); /// /// Disconnects from the ModbusTCP server. /// Task DisconnectAsync(); /// /// Reads holding registers. /// /// The starting address. /// The number of registers to read. /// Array of register values. Task ReadHoldingRegistersAsync(ushort startAddress, ushort numberOfPoints); /// /// Reads input registers. /// /// The starting address. /// The number of registers to read. /// Array of register values. Task ReadInputRegistersAsync(ushort startAddress, ushort numberOfPoints); /// /// Reads coils. /// /// The starting address. /// The number of coils to read. /// Array of coil values. Task ReadCoilsAsync(ushort startAddress, ushort numberOfPoints); /// /// Reads discrete inputs. /// /// The starting address. /// The number of inputs to read. /// Array of input values. Task ReadDiscreteInputsAsync(ushort startAddress, ushort numberOfPoints); /// /// Writes a single coil. /// /// The coil address. /// The value to write. Task WriteSingleCoilAsync(ushort coilAddress, bool value); /// /// Writes multiple coils. /// /// The starting address. /// The values to write. Task WriteMultipleCoilsAsync(ushort startAddress, bool[] values); /// /// Writes a single holding register. /// /// The register address. /// The value to write. Task WriteSingleRegisterAsync(ushort registerAddress, ushort value); /// /// Writes multiple holding registers. /// /// The starting address. /// The values to write. Task WriteMultipleRegistersAsync(ushort startAddress, ushort[] values); }