|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.wimpi.modbus.msg.ModbusMessageImpl
net.wimpi.modbus.msg.ModbusResponse
net.wimpi.modbus.msg.ReadInputRegistersResponse
public final class ReadInputRegistersResponse
Class implementing a ReadInputRegistersRequest. The implementation directly correlates with the class 0 function read multiple registers (FC 4). It encapsulates the corresponding response message.
| Field Summary | |
|---|---|
private int |
m_ByteCount
|
private InputRegister[] |
m_Registers
|
| Constructor Summary | |
|---|---|
ReadInputRegistersResponse()
Constructs a new ReadInputRegistersResponse instance. |
|
ReadInputRegistersResponse(InputRegister[] registers)
Constructs a new ReadInputRegistersResponse instance. |
|
| Method Summary | |
|---|---|
int |
getByteCount()
Returns the number of bytes that have been read. |
InputRegister |
getRegister(int index)
Returns the InputRegister at the given position (relative to the reference used in the request). |
InputRegister[] |
getRegisters()
Returns a reference to the array of input registers read. |
int |
getRegisterValue(int index)
Returns the value of the register at the given position (relative to the reference used in the request) interpreted as usigned short. |
int |
getWordCount()
Returns the number of words that have been read. |
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance. |
private void |
setByteCount(int count)
Sets the number of bytes that have been returned. |
void |
writeData(DataOutput dout)
Writes the subclass specific data to the given DataOutput. |
| Methods inherited from class net.wimpi.modbus.msg.ModbusResponse |
|---|
createModbusResponse, setMessage |
| 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 |
| Field Detail |
|---|
private int m_ByteCount
private InputRegister[] m_Registers
| Constructor Detail |
|---|
public ReadInputRegistersResponse()
public ReadInputRegistersResponse(InputRegister[] registers)
registers - the InputRegister[] holding response input registers.| Method Detail |
|---|
public int getByteCount()
public int getWordCount()
private void setByteCount(int count)
count - the number of bytes as int.
public InputRegister getRegister(int index)
throws IndexOutOfBoundsException
index - the relative index of the InputRegister.
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 InputRegister[] getRegisters()
public void writeData(DataOutput dout)
throws IOException
ModbusMessageImpl
writeData in class ModbusMessageImpldout - 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 ModbusMessageImpldin - 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 | ||||||||