public final class WriteSingleRegisterRequest extends ModbusRequest
| Constructor and Description |
|---|
WriteSingleRegisterRequest()
Constructs a new WriteSingleRegisterRequest
instance.
|
WriteSingleRegisterRequest(int ref,
Register reg)
Constructs a new WriteSingleRegisterRequest
instance with a given reference and value to be written.
|
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createResponse()
Returns the ModbusResponse that
represents the answer to this ModbusRequest.
|
int |
getReference()
Returns the reference of the register to be
written to with this
WriteSingleRegisterRequest.
|
Register |
getRegister()
Returns the value that should be written to the
register with this WriteSingleRegisterRequest.
|
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance.
|
void |
setReference(int ref)
Sets the reference of the register to be written
to with this WriteSingleRegisterRequest.
|
void |
setRegister(Register reg)
Sets the value that should be written to the
register with this WriteSingleRegisterRequest.
|
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 WriteSingleRegisterRequest()
public WriteSingleRegisterRequest(int ref,
Register reg)
ref - the reference number of the register to read from.reg - the register containing the data to be written.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 register to be written to.public int getReference()
public void setRegister(Register reg)
reg - the register to be written.public Register getRegister()
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.