|
||||||||||
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.WriteSingleRegisterRequest
public final class WriteSingleRegisterRequest
Class implementing a WriteSingleRegisterRequest. The implementation directly correlates with the class 0 function write single register (FC 6). It encapsulates the corresponding request message.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
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, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTo |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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.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 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
ModbusMessageImpl
writeData
in class ModbusMessageImpl
dout
- the DataOutput to be written to.
IOException
- if an I/O related error occurs.public void readData(DataInput din) throws IOException
ModbusMessageImpl
readData
in class ModbusMessageImpl
din
- the DataInput to read from.
IOException
- if an I/O related error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |