public final class WriteMultipleRegistersRequest extends ModbusRequest
| Constructor and Description |
|---|
WriteMultipleRegistersRequest()
Constructs a new WriteMultipleRegistersRequest instance.
|
WriteMultipleRegistersRequest(int ref,
Register[] registers)
Constructs a new WriteMultipleRegistersRequest instance with a
given reference and values to be written.
|
| Modifier and Type | Method and Description |
|---|---|
ModbusResponse |
createResponse()
Returns the ModbusResponse that
represents the answer to this ModbusRequest.
|
int |
getByteCount()
Returns the number of bytes representing the values to be written.
|
NonWordDataHandler |
getNonWordDataHandler()
Returns the actual non word data handler.
|
int |
getReference()
Returns the reference of the register to start writing to with this
WriteMultipleRegistersRequest.
|
Register |
getRegister(int index)
Returns the Register at the given position (relative to the
reference used in the request).
|
Register[] |
getRegisters()
Returns the registers to be written with this
WriteMultipleRegistersRequest.
|
int |
getRegisterValue(int index)
Returns the value of the register at the given position (relative to the
reference used in the request) interpreted as unsigned short.
|
int |
getWordCount()
Returns the number of words to be written.
|
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance.
|
void |
setNonWordDataHandler(NonWordDataHandler dhandler)
Sets a non word data handler.
|
void |
setReference(int ref)
Sets the reference of the register to writing to with this
WriteMultipleRegistersRequest.
|
void |
setRegisters(Register[] registers)
Sets the registers to be written with this
WriteMultipleRegistersRequest.
|
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 WriteMultipleRegistersRequest()
public WriteMultipleRegistersRequest(int ref,
Register[] registers)
ref - the reference number of the register to read from.registers - the registers 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 start writing to as int.public int getReference()
public void setRegisters(Register[] registers)
registers - the registers to be written as Register[].public Register[] getRegisters()
public Register getRegister(int index) throws IndexOutOfBoundsException
index - the relative index of the Register.IndexOutOfBoundsException - if the index is out of bounds.public int getRegisterValue(int index)
throws IndexOutOfBoundsException
index - the relative index of the register for which the value should be retrieved.IndexOutOfBoundsException - if the index is out of bounds.public int getByteCount()
public int getWordCount()
public void setNonWordDataHandler(NonWordDataHandler dhandler)
dhandler - a NonWordDataHandler instance.public NonWordDataHandler getNonWordDataHandler()
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.