net.wimpi.modbus.msg
Class WriteMultipleRegistersResponse

java.lang.Object
  extended by net.wimpi.modbus.msg.ModbusMessageImpl
      extended by net.wimpi.modbus.msg.ModbusResponse
          extended by net.wimpi.modbus.msg.WriteMultipleRegistersResponse
All Implemented Interfaces:
Transportable, ModbusMessage

public final class WriteMultipleRegistersResponse
extends ModbusResponse

Class implementing a WriteMultipleRegistersResponse. The implementation directly correlates with the class 0 function read multiple registers (FC 16). It encapsulates the corresponding response message.

Version:
@version@ (@date@)
Author:
Dieter Wimberger

Constructor Summary
WriteMultipleRegistersResponse()
          Constructs a new WriteMultipleRegistersResponse instance.
WriteMultipleRegistersResponse(int reference, int wordcount)
          Constructs a new WriteMultipleRegistersResponse instance.
 
Method Summary
 int getByteCount()
          Returns the number of bytes that have been written.
 int getReference()
          Returns the reference of the register to start writing to with this WriteMultipleRegistersResponse.
 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.
 void writeData(DataOutput dout)
          Writes the subclass specific data to the given DataOutput.
 
Methods inherited from class net.wimpi.modbus.msg.ModbusResponse
createModbusResponse
 
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

WriteMultipleRegistersResponse

public WriteMultipleRegistersResponse()
Constructs a new WriteMultipleRegistersResponse instance.


WriteMultipleRegistersResponse

public WriteMultipleRegistersResponse(int reference,
                                      int wordcount)
Constructs a new WriteMultipleRegistersResponse instance.

Parameters:
reference - the offset to start reading from.
wordcount - the number of words (registers) to be read.
Method Detail

getReference

public int getReference()
Returns the reference of the register to start writing to with this WriteMultipleRegistersResponse.

Returns:
the reference of the register to start writing to as int.

getByteCount

public int getByteCount()
Returns the number of bytes that have been written.

Returns:
the number of bytes that have been read as int.

getWordCount

public int getWordCount()
Returns the number of words that have been read. The returned value should be half of the byte count of the response.

Returns:
the number of words that have been read as int.

writeData

public void writeData(DataOutput dout)
               throws IOException
Description copied from class: ModbusMessageImpl
Writes the subclass specific data to the given DataOutput.

Specified by:
writeData in class ModbusMessageImpl
Parameters:
dout - the DataOutput to be written to.
Throws:
IOException - if an I/O related error occurs.

readData

public void readData(DataInput din)
              throws IOException
Description copied from class: ModbusMessageImpl
Reads the subclass specific data from the given DataInput instance.

Specified by:
readData in class ModbusMessageImpl
Parameters:
din - the DataInput to read from.
Throws:
IOException - if an I/O related error occurs.


Copyright © 2010. All Rights Reserved.