| 1 | // Copyright 2014 Quoc-Viet Nguyen. All rights reserved. |
| 2 | // This software may be modified and distributed under the terms |
| 3 | // of the BSD license. See the LICENSE file for details. |
| 4 | |
| 5 | package modbus |
| 6 | |
| 7 | type Client interface { |
| 8 | // Bit access |
| 9 | |
| 10 | // ReadCoils reads from 1 to 2000 contiguous status of coils in a |
| 11 | // remote device and returns coil status. |
| 12 | ReadCoils(address, quantity uint16) (results []byte, err error) |
| 13 | // ReadDiscreteInputs reads from 1 to 2000 contiguous status of |
| 14 | // discrete inputs in a remote device and returns input status. |
| 15 | ReadDiscreteInputs(address, quantity uint16) (results []byte, err error) |
| 16 | // WriteSingleCoil write a single output to either ON or OFF in a |
| 17 | // remote device and returns output value. |
| 18 | WriteSingleCoil(address, value uint16) (results []byte, err error) |
| 19 | // WriteMultipleCoils forces each coil in a sequence of coils to either |
| 20 | // ON or OFF in a remote device and returns quantity of outputs. |
| 21 | WriteMultipleCoils(address, quantity uint16, value []byte) (results []byte, err error) |
| 22 | |
| 23 | // 16-bit access |
| 24 | |
| 25 | // ReadInputRegisters reads from 1 to 125 contiguous input registers in |
| 26 | // a remote device and returns input registers. |
| 27 | ReadInputRegisters(address, quantity uint16) (results []byte, err error) |
| 28 | // ReadHoldingRegisters reads the contents of a contiguous block of |
| 29 | // holding registers in a remote device and returns register value. |
| 30 | ReadHoldingRegisters(address, quantity uint16) (results []byte, err error) |
| 31 | // WriteSingleRegister writes a single holding register in a remote |
| 32 | // device and returns register value. |
| 33 | WriteSingleRegister(address, value uint16) (results []byte, err error) |
| 34 | // WriteMultipleRegisters writes a block of contiguous registers |
| 35 | // (1 to 123 registers) in a remote device and returns quantity of |
| 36 | // registers. |
| 37 | WriteMultipleRegisters(address, quantity uint16, value []byte) (results []byte, err error) |
| 38 | // ReadWriteMultipleRegisters performs a combination of one read |
| 39 | // operation and one write operation. It returns read registers value. |
| 40 | ReadWriteMultipleRegisters(readAddress, readQuantity, writeAddress, writeQuantity uint16, value []byte) (results []byte, err error) |
| 41 | // MaskWriteRegister modify the contents of a specified holding |
| 42 | // register using a combination of an AND mask, an OR mask, and the |
| 43 | // register's current contents. The function returns |
| 44 | // AND-mask and OR-mask. |
| 45 | MaskWriteRegister(address, andMask, orMask uint16) (results []byte, err error) |
| 46 | //ReadFIFOQueue reads the contents of a First-In-First-Out (FIFO) queue |
| 47 | // of register in a remote device and returns FIFO value register. |
| 48 | ReadFIFOQueue(address uint16) (results []byte, err error) |
| 49 | } |