Skip to content

Update api.md #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 39 additions & 61 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Modbus Client

### `coilRead()`
### `client.coilRead()`

#### Description

Expand All @@ -23,7 +23,7 @@ int coilRead(int id, int address);
#### Returns
coil value on success, -1 on failure.

### `discreteInputRead()`
### `client.discreteInputRead()`

#### Description

Expand All @@ -44,7 +44,7 @@ int discreteInputRead(int id, int address);
#### Returns
discrete input value on success, -1 on failure.

### `holdingRegisterRead()`
### `client.holdingRegisterRead()`

#### Description

Expand All @@ -63,7 +63,7 @@ long holdingRegisterRead(int id, int address);
- address start address to use for operation
- holiding register value on success, -1 on failure.

### `inputRegisterRead()`
### `client.inputRegisterRead()`

#### Description

Expand All @@ -84,7 +84,7 @@ long inputRegisterRead(int id, int address);
#### Returns
input register value on success, -1 on failure.

### `coilWrite()`
### `client.coilWrite()`

#### Description

Expand All @@ -106,29 +106,7 @@ int coilWrite(int id, int address, uint8_t value);
#### Returns
1 on success, 0 on failure.

### `coilWrite()`

#### Description

Perform a "Write Single Coil" operation for the specified address and value.

#### Syntax

```
int coilWrite(int address, uint8_t value);
int coilWrite(int id, int address, uint8_t value);
```

#### Parameters
- id (slave) - id of target, defaults to 0x00 if not specified
- address address to use for operation
- value coi -l value to write


#### Returns
1 on success, 0 on failure.

### `holdingRegisterWrite()`
### `client.holdingRegisterWrite()`

#### Description

Expand All @@ -150,7 +128,7 @@ int holdingRegisterWrite(int id, int address, uint16_t value);
#### Returns
1 on success, 0 on failure.

### `registerMaskWrite()`
### `client.registerMaskWrite()`

#### Description

Expand All @@ -173,7 +151,7 @@ int registerMaskWrite(int id, int address, uint16_t andMask, uint16_t orMask);
#### Returns
1 on success, 0 on failure.

### `beginTransmission()`
### `client.beginTransmission()`

#### Description

Expand All @@ -197,7 +175,7 @@ int beginTransmission(int id, int type, int address, int nb);
#### Returns
1 on success, 0 on failure

### `write()`
### `client.write()`

#### Description

Expand All @@ -216,7 +194,7 @@ int write(unsigned int value);
#### Returns
1 on success, 0 on failure

### `endTransmission()`
### `client.endTransmission()`

#### Description

Expand All @@ -235,7 +213,7 @@ none
#### Returns
1 on success, 0 on failure

### `requestFrom()`
### `client.requestFrom()`

#### Description

Expand All @@ -259,7 +237,7 @@ type - type of read to perform, either COILS, DISCRETE_INPUTS, HOLD_REGISTERS, o
#### Returns
0 on failure, number of values read on success

### `available()`
### `client.available()`

#### Description

Expand All @@ -278,7 +256,7 @@ none
#### Returns
number of values available for reading use read()

### `read()`
### `client.read()`

#### Description

Expand All @@ -297,7 +275,7 @@ None
#### Returns
-1 on failure, value on success

### `lastError()`
### `client.lastError()`

#### Description

Expand All @@ -316,7 +294,7 @@ none
#### Returns
Last error reason as a C string

### `end()`
### `client.end()`

#### Description

Expand All @@ -337,7 +315,7 @@ nothing

## ModbusRTUClient Class

### `begin()`
### `modbusRTUClient.begin()`

#### Description

Expand Down Expand Up @@ -375,7 +353,7 @@ ModbusTCPClient(client);
#### Parameters
- Client - to use for the transport

### `begin()`
### `modbusTCPClient.begin()`

#### Description

Expand All @@ -395,7 +373,7 @@ modbusTCPClient.begin(ip, port);
#### Returns
1 on success, 0 on failure

### `connected()`
### `modbusTCPClient.connected()`

#### Description

Expand All @@ -414,7 +392,7 @@ None
#### Returns
Returns true if the client is connected, false if not.

### `stop()`
### `modbusTCPClient.stop()`

#### Description

Expand All @@ -435,7 +413,7 @@ Nothing

## ModbusServer Class

### `configureCoils()`
### `modbusServer.configureCoils()`

#### Description

Expand All @@ -455,7 +433,7 @@ int configureCoils(int startAddress, int nb);
#### Returns
0 on success, 1 on failure

### `configureDiscreteInputs()`
### `modbusServer.configureDiscreteInputs()`

#### Description

Expand All @@ -475,7 +453,7 @@ int configureDiscreteInputs(int startAddress, int nb);
#### Returns
0 on success, 1 on failure

### `configureHoldingRegisters()`
### `modbusServer.configureHoldingRegisters()`

#### Description

Expand All @@ -495,7 +473,7 @@ int configureHoldingRegisters(int startAddress, int nb);
#### Returns
0 on success, 1 on failure

### `configureInputRegisters()`
### `modbusServer.configureInputRegisters()`

#### Description

Expand All @@ -515,7 +493,7 @@ int configureInputRegisters(int startAddress, int nb);
#### Returns
0 on success, 1 on failure

### `coilRead()`
### `modbusServer.coilRead()`

#### Description

Expand All @@ -536,7 +514,7 @@ int coilRead(int id, int address);
#### Returns
coil value on success, -1 on failure.

### `discreteInputRead()`
### `modbusServer.discreteInputRead()`

#### Description

Expand All @@ -557,7 +535,7 @@ int discreteInputRead(int id, int address);
#### Returns
discrete input value on success, -1 on failure.

### `holdingRegisterRead()`
### `modbusServer.holdingRegisterRead()`

#### Description

Expand All @@ -575,7 +553,7 @@ long holdingRegisterRead(int id, int address);
- address start address to use for operation
- holiding register value on success, -1 on failure.

### `inputRegisterRead()`
### `modbusServer.inputRegisterRead()`

#### Description

Expand All @@ -596,7 +574,7 @@ long inputRegisterRead(int id, int address);
#### Returns
input register value on success, -1 on failure.

### `coilWrite()`
### `modbusServer.coilWrite()`

#### Description

Expand All @@ -618,7 +596,7 @@ int coilWrite(int id, int address, uint8_t value);
#### Returns
1 on success, 0 on failure.

### `holdingRegisterWrite()`
### `modbusServer.holdingRegisterWrite()`

#### Description

Expand All @@ -640,7 +618,7 @@ int holdingRegisterWrite(int id, int address, uint16_t value);
#### Returns
1 on success, 0 on failure.

### `registerMaskWrite()`
### `modbusServer.registerMaskWrite()`

#### Description

Expand All @@ -662,7 +640,7 @@ int registerMaskWrite(int id, int address, uint16_t andMask, uint16_t orMask);
#### Returns
1 on success, 0 on failure.

### `discreteInputWrite()`
### `modbusServer.discreteInputWrite()`

#### Description

Expand All @@ -682,7 +660,7 @@ int discreteInputWrite(int address, uint8_t value);
#### Returns
1 on success, 0 on failure.

### `writeDiscreteInputs()`
### `modbusServer.writeDiscreteInputs()`

#### Description

Expand All @@ -703,7 +681,7 @@ int writeDiscreteInputs(int address, uint8_t values[], int nb);
#### Returns
1 on success, 0 on failure.

### `inputRegisterWrite()`
### `modbusServer.inputRegisterWrite()`

#### Description

Expand All @@ -723,7 +701,7 @@ int inputRegisterWrite(int address, uint16_t value);
#### Returns
1 on success, 0 on failure.

### `writeInputRegisters()`
### `modbusServer.writeInputRegisters()`

#### Description

Expand All @@ -743,7 +721,7 @@ int writeInputRegisters(int address, uint16_t values[], int nb);
#### Returns
1 on success, 0 on failure.

### `poll()`
### `modbusServer.poll()`

#### Description

Expand All @@ -761,7 +739,7 @@ None
#### Returns
nothing

### `end()`
### `modbusServer.end()`

#### Description

Expand All @@ -781,7 +759,7 @@ nothing

## ModbusRTUServer Class

### `begin()`
### `modbusRTUServer.begin()`

#### Description

Expand Down Expand Up @@ -819,7 +797,7 @@ ModbusTCPServer();
#### Parameters
None

### `begin()`
### `modbusTCPServer.begin()`

#### Description

Expand All @@ -839,7 +817,7 @@ modbusTCPserver.begin(id);
#### Returns
1 on success, 0 on failure

### `accept()`
### `modbusTCPServer.accept()`

#### Description

Expand Down