public class IllegalFunctionRequest extends ModbusRequest
Class implementing a ModbusRequest which is created for illegal or non implemented function codes.
This is just a helper class to keep the implementation patterns the same for all cases.
| Constructor and Description |
|---|
IllegalFunctionRequest(int function)
Constructs a new IllegalFunctionRequest instance for a given
function code.
|
IllegalFunctionRequest(int unit,
int function)
Constructs a new IllegalFunctionRequest instance for a given
function code.
|
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createResponse(AbstractModbusListener listener)
Returns the ModbusResponse that represents the answer to this
ModbusRequest.
|
byte[] |
getMessage()
Returns the raw message as an array of bytes.
|
ModbusResponse |
getResponse()
There is no unit number associated with this exception.
|
void |
readData(DataInput din)
Read all of the data that can be read.
|
void |
writeData(DataOutput dout)
Writes the subclass specific data to the given DataOutput.
|
createExceptionResponse, createModbusRequestgetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic IllegalFunctionRequest(int function)
Used to implement slave devices when an illegal function code has been requested.
function - the function code as int.public IllegalFunctionRequest(int unit,
int function)
Used to implement slave devices when an illegal function code has been requested.
unit - Unit IDfunction - the function code as int.public ModbusResponse getResponse()
getResponse in class ModbusRequestpublic ModbusResponse createResponse(AbstractModbusListener listener)
ModbusRequestThe 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.
createResponse in class ModbusRequestlistener - Listener that received the requestpublic void writeData(DataOutput dout) throws IOException
ModbusMessageImplwriteData in class ModbusMessageImpldout - the DataOutput to be written to.IOException - if an I/O related error occurs.public void readData(DataInput din) throws IOException
readData in class ModbusMessageImpldin - the DataInput to read from.IOException - If the data cannot be read from the socket/portpublic byte[] getMessage()
ModbusMessageCopyright © 2025. All Rights Reserved.