public interface ModbusMessage
| Modifier and Type | Method and Description |
|---|---|
int |
getDataLength()
Returns the length of the data appended after the protocol header.
|
int |
getFunctionCode()
Returns the function code of this ModbusMessage as int.
The function code is a 1-byte non negative integer value valid in the range of 0-127. |
String |
getHexMessage()
Returns the raw message as String containing a
hexadecimal series of bytes.
|
byte[] |
getMessage()
Returns the raw message as an array of bytes.
|
int |
getOutputLength()
Returns the number of bytes that will
be written by
writeTo(DataOutput). |
int |
getProtocolID()
Returns the protocol identifier of this ModbusMessage as
int.
|
int |
getTransactionID()
Returns the transaction identifier of this ModbusMessage as
int.
|
int |
getUnitID()
Returns the unit identifier of this ModbusMessage as
int.
|
boolean |
isHeadless()
Check the flag which indicates that this ModbusMessage is for a
headless (serial, or headless networked) connection.
|
void |
readFrom(DataInput din)
Reads this Transportable from the given
DataInput.
|
void |
setHeadless()
Sets the flag that marks this ModbusMessage as headless (for
serial transport).
|
void |
writeTo(DataOutput dout)
Writes this Transportable to the
given DataOutput.
|
boolean isHeadless()
void setHeadless()
int getTransactionID()
The identifier is a 2-byte (short) non negative integer value valid in the range of 0-65535.
int getProtocolID()
The identifier is a 2-byte (short) non negative integer value valid in the range of 0-65535.
int getDataLength()
int getUnitID()
The identifier is a 1-byte non negative integer value valid in the range of 0-255.
int getFunctionCode()
Function codes are ordered in conformance classes their values are specified in com.ghgande.j2mod.modbus.Modbus.
Modbusbyte[] getMessage()
String getHexMessage()
This method is specially for debugging purposes, allowing the user to log the communication in a manner used in the specification document.
int getOutputLength()
writeTo(DataOutput).void writeTo(DataOutput dout) throws IOException
dout - the DataOutput to write to.IOException - if an I/O error occurs.void readFrom(DataInput din) throws IOException
din - the DataInput to read from.IOException - if an I/O error occurs or the data
is invalid.Copyright © 2025. All Rights Reserved.