public final class WriteCoilRequest extends ModbusRequest
| Constructor and Description |
|---|
WriteCoilRequest()
Constructs a new WriteCoilRequest
instance.
|
WriteCoilRequest(int ref,
boolean b)
Constructs a new WriteCoilRequest
instance with a given reference and state to
be written.
|
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createResponse()
Returns the ModbusResponse that
represents the answer to this ModbusRequest.
|
boolean |
getCoil()
Returns the state that should be written
with this WriteCoilRequest.
|
int |
getReference()
Returns the reference of the register of the coil
that should be written to with this
ReadCoilsRequest.
|
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance.
|
void |
setCoil(boolean b)
Sets the state that should be written
with this WriteCoilRequest.
|
void |
setReference(int ref)
Sets the reference of the register of the coil
that should be written to with this
ReadCoilsRequest.
|
void |
writeData(DataOutput dout)
Writes the subclass specific data to the given DataOutput.
|
createExceptionResponse, createModbusRequestgetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic WriteCoilRequest()
public WriteCoilRequest(int ref,
boolean b)
ref - the reference number of the register to read from.b - true if the coil should be set of false if it should be unset.public ModbusResponse createResponse()
ModbusRequestThe implementation should take care about assembling the reply to this ModbusRequest.
createResponse in class ModbusRequestpublic void setReference(int ref)
ref - the reference of the coil's register.public int getReference()
public void setCoil(boolean b)
b - true if the coil should be set of false if it should be unset.public boolean getCoil()
public 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
ModbusMessageImplreadData in class ModbusMessageImpldin - the DataInput to read from.IOException - if an I/O related error occurs.Copyright © 2017. All rights reserved.