public class ReadSerialDiagnosticsRequest extends ModbusRequest
| Constructor and Description |
|---|
ReadSerialDiagnosticsRequest()
Constructs a new Diagnostics request
instance.
|
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createResponse(AbstractModbusListener listener)
Returns the ModbusResponse that represents the answer to this
ModbusRequest.
|
int |
getData()
getData
|
int |
getData(int index)
Deprecated.
|
int |
getFunction()
getFunction -- Get the DIAGNOSTICS sub-function.
|
byte[] |
getMessage()
getMessage -- Create the DIAGNOSTICS message paylaod.
|
ModbusResponse |
getResponse()
Returns the ModbusResponse that correlates with this
ModbusRequest.
|
int |
getWordCount()
getWordCount -- get the number of words in data.
|
void |
readData(DataInput din)
readData -- Read the function code and data value
|
void |
setData(int value)
setData -- Set the optional data value
|
void |
setData(int index,
int value)
Deprecated.
|
void |
setFunction(int function)
setFunction - Set the DIAGNOSTICS sub-function.
|
void |
writeData(DataOutput dout)
writeData -- output the completed Modbus message to dout
|
createExceptionResponse, createModbusRequestgetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic ReadSerialDiagnosticsRequest()
public int getFunction()
public void setFunction(int function)
function - - DIAGNOSTICS command sub-function.public int getWordCount()
public int getData()
public void setData(int value)
value - Diagnostics value@Deprecated public int getData(int index)
index - - Unused, must be 0.@Deprecated public void setData(int index, int value)
index - - Unused, must be 0.value - - Optional data value for function.public ModbusResponse getResponse()
ModbusRequestThe 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.
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
writeData in class ModbusMessageImpldout - the DataOutput to be written to.IOException - If the data cannot be writtenpublic void readData(DataInput din) throws IOException
readData in class ModbusMessageImpldin - the DataInput to read from.IOException - If the data cannot be readpublic byte[] getMessage()
Copyright © 2025. All Rights Reserved.