public abstract class ModbusRequest extends ModbusMessageImpl
| Constructor and Description |
|---|
ModbusRequest() |
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createExceptionResponse(int code)
Factory method for creating exception responses with the given exception
code.
|
static ModbusRequest |
createModbusRequest(int functionCode)
Factory method creating the required specialized ModbusRequest
instance.
|
abstract ModbusResponse |
createResponse(AbstractModbusListener listener)
Returns the ModbusResponse that represents the answer to this
ModbusRequest.
|
abstract ModbusResponse |
getResponse()
Returns the ModbusResponse that correlates with this
ModbusRequest.
|
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readData, readFrom, setDataLength, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeData, writeToequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMessagepublic static ModbusRequest createModbusRequest(int functionCode)
functionCode - the function code of the request as int.public abstract ModbusResponse getResponse()
The response must include the unit number, function code, as well as any transport-specific header information.
This method is used to create an empty response which must be populated by the caller. It is commonly used to un-marshal responses from Modbus slaves.
public abstract ModbusResponse createResponse(AbstractModbusListener listener)
The implementation should take care about assembling the reply to this ModbusRequest.
This method is used to create responses from the process image associated with the listener. It is commonly used to implement Modbus slave instances.
listener - Listener that received the requestpublic ModbusResponse createExceptionResponse(int code)
code - the code of the exception.Copyright © 2025. All Rights Reserved.