public class ReadCoilsResponse extends ModbusResponse
ModbusResponse.AuxiliaryMessageTypes| Constructor and Description |
|---|
ReadCoilsResponse()
ReadCoilsResponse -- create an empty response message to be
filled in later.
|
ReadCoilsResponse(int count)
ReadCoilsResponse -- create a response for a given number of
coils.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBitCount()
getBitCount -- return the number of coils
|
BitVector |
getCoils()
getCoils -- get the coils bit vector.
|
boolean |
getCoilStatus(int index)
Convenience method that returns the state
of the bit at the given index.
|
byte[] |
getMessage()
Returns the raw message as an array of bytes.
|
void |
readData(DataInput input)
Reads the subclass specific data from the given DataInput instance.
|
void |
setCoilStatus(int index,
boolean b)
Sets the status of the given coil.
|
void |
writeData(DataOutput output)
Writes the subclass specific data to the given DataOutput.
|
createModbusResponse, getAuxiliaryType, setAuxiliaryTypegetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic ReadCoilsResponse()
public ReadCoilsResponse(int count)
count - the number of bits to be read.public int getBitCount()
public BitVector getCoils()
public boolean getCoilStatus(int index)
throws IndexOutOfBoundsException
index - the index of the coil for which
the status should be returned.IndexOutOfBoundsException - if the
index is out of boundspublic void setCoilStatus(int index,
boolean b)
index - the index of the coil to be set.b - true if to be set, false for reset.public void writeData(DataOutput output) throws IOException
ModbusMessageImplwriteData in class ModbusMessageImploutput - the DataOutput to be written to.IOException - if an I/O related error occurs.public void readData(DataInput input) throws IOException
ModbusMessageImplreadData in class ModbusMessageImplinput - the DataInput to read from.IOException - if an I/O related error occurs.public byte[] getMessage()
ModbusMessageCopyright © 2025. All Rights Reserved.