org.avineas.modbus
public class ModbusResponse extends ModbusPacket
Constructor and Description |
---|
ModbusResponse(byte[] data)
Create a modbus response from a byte stream as received from a remote system.
|
ModbusResponse(ModbusRequest request,
int error)
Create a response from a request giving an error to reply to the sender.
|
Modifier and Type | Method and Description |
---|---|
int |
getError()
Get the error that is present in this response.
|
int |
getFunction()
Get the plain function code as present in the reply.
|
decode, encode, toBytes
public ModbusResponse(ModbusRequest request, int error)
request
- The request to create the error forerror
- The error code. Valid codes are normally 1-9. See modbus documentationpublic ModbusResponse(byte[] data)
data
- The data receivedpublic int getFunction()
getFunction
in class ModbusPacket
public int getError()