using System; using Modbus.IO; namespace Modbus.Device { /// /// Modbus master device. /// public interface IModbusMaster : IDisposable { /// /// Transport for used by this master. /// ModbusTransport Transport { get; } /// /// Read from 1 to 2000 contiguous coils status. /// /// Address of device to read values from. /// Address to begin reading. /// Number of coils to read. /// Coils status bool[] ReadCoils(byte slaveAddress, ushort startAddress, ushort numberOfPoints); /// /// Read from 1 to 2000 contiguous discrete input status. /// /// Address of device to read values from. /// Address to begin reading. /// Number of discrete inputs to read. /// Discrete inputs status bool[] ReadInputs(byte slaveAddress, ushort startAddress, ushort numberOfPoints); /// /// Read contiguous block of holding registers. /// /// Address of device to read values from. /// Address to begin reading. /// Number of holding registers to read. /// Holding registers status ushort[] ReadHoldingRegisters(byte slaveAddress, ushort startAddress, ushort numberOfPoints); /// /// Read contiguous block of input registers. /// /// Address of device to read values from. /// Address to begin reading. /// Number of holding registers to read. /// Input registers status ushort[] ReadInputRegisters(byte slaveAddress, ushort startAddress, ushort numberOfPoints); /// /// Write a single coil value. /// /// Address of the device to write to. /// Address to write value to. /// Value to write. void WriteSingleCoil(byte slaveAddress, ushort coilAddress, bool value); /// /// Write a single holding register. /// /// Address of the device to write to. /// Value to write. /// Value to write. void WriteSingleRegister(byte slaveAddress, ushort registerAddress, ushort value); /// /// Write a block of 1 to 123 contiguous registers. /// /// Address of the device to write to. /// Address to begin writing values. /// Values to write. void WriteMultipleRegisters(byte slaveAddress, ushort startAddress, ushort[] data); /// /// Force each coil in a sequence of coils to a provided value. /// /// Address of the device to write to. /// Address to begin writing values. /// Values to write. void WriteMultipleCoils(byte slaveAddress, ushort startAddress, bool[] data); /// /// Performs a combination of one read operation and one write operation in a single Modbus transaction. /// The write operation is performed before the read. /// /// Address of device to read values from. /// Address to begin reading (Holding registers are addressed starting at 0). /// Number of registers to read. /// Address to begin writing (Holding registers are addressed starting at 0). /// Register values to write. ushort[] ReadWriteMultipleRegisters(byte slaveAddress, ushort startReadAddress, ushort numberOfPointsToRead, ushort startWriteAddress, ushort[] writeData); } }