|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wimpi.modbus.msg.ModbusMessageImpl net.wimpi.modbus.msg.ModbusRequest net.wimpi.modbus.msg.WriteMultipleRegistersRequest
Class implementing a ReadMultipleRegistersRequest. The implementation directly correlates with the class 0 function write multiple registers (FC 16). It encapsulates the corresponding request message.
Constructor Summary | |
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. |
Method Summary | |
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(java.io.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(java.io.DataOutput dout)
Writes the subclass specific data to the given DataOutput. |
Methods inherited from class net.wimpi.modbus.msg.ModbusRequest |
createExceptionResponse, createModbusRequest |
Methods inherited from class net.wimpi.modbus.msg.ModbusMessageImpl |
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WriteMultipleRegistersRequest()
public WriteMultipleRegistersRequest(int ref, Register[] registers)
ref
- the reference number of the register
to read from.registers
- the registers to be written.Method Detail |
public ModbusResponse createResponse()
ModbusRequest
The implementation should take care about assembling the reply to this ModbusRequest.
createResponse
in class ModbusRequest
public 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 java.lang.IndexOutOfBoundsException
index
- the relative index of the Register.
java.lang.IndexOutOfBoundsException
- if
the index is out of bounds.public int getRegisterValue(int index) throws java.lang.IndexOutOfBoundsException
index
- the relative index of the register
for which the value should be retrieved.
java.lang.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(java.io.DataOutput dout) throws java.io.IOException
ModbusMessageImpl
writeData
in class ModbusMessageImpl
dout
- the DataOutput to be written to.
java.io.IOException
- if an I/O related error occurs.public void readData(java.io.DataInput din) throws java.io.IOException
ModbusMessageImpl
readData
in class ModbusMessageImpl
din
- the DataInput to read from.
java.io.IOException
- if an I/O related error occurs.
|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |