jamod at SF

net.wimpi.modbus.msg
Class ReadMultipleRegistersRequest

java.lang.Object
  extended bynet.wimpi.modbus.msg.ModbusMessageImpl
      extended bynet.wimpi.modbus.msg.ModbusRequest
          extended bynet.wimpi.modbus.msg.ReadMultipleRegistersRequest
All Implemented Interfaces:
ModbusMessage, Transportable

public final class ReadMultipleRegistersRequest
extends ModbusRequest

Class implementing a ReadMultipleRegistersRequest. The implementation directly correlates with the class 0 function read multiple registers (FC 3). It encapsulates the corresponding request message.

Version:
1.2rc1 (09/11/2004)
Author:
Dieter Wimberger

Constructor Summary
ReadMultipleRegistersRequest()
          Constructs a new ReadMultipleRegistersRequest instance.
ReadMultipleRegistersRequest(int ref, int count)
          Constructs a new ReadMultipleRegistersRequest instance with a given reference and count of words to be read.
 
Method Summary
 ModbusResponse createResponse()
          Returns the ModbusResponse that represents the answer to this ModbusRequest.
 int getReference()
          Returns the reference of the register to to start reading from with this ReadMultipleRegistersRequest.
 int getWordCount()
          Returns the number of words to be read with this ReadMultipleRegistersRequest.
 void readData(java.io.DataInput din)
          Reads the subclass specific data from the given DataInput instance.
 void setReference(int ref)
          Sets the reference of the register to start reading from with this ReadMultipleRegistersRequest.
 void setWordCount(int count)
          Sets the number of words to be read with this ReadMultipleRegistersRequest.
 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

ReadMultipleRegistersRequest

public ReadMultipleRegistersRequest()
Constructs a new ReadMultipleRegistersRequest instance.


ReadMultipleRegistersRequest

public ReadMultipleRegistersRequest(int ref,
                                    int count)
Constructs a new ReadMultipleRegistersRequest instance with a given reference and count of words to be read.

Parameters:
ref - the reference number of the register to read from.
count - the number of words to be read.
Method Detail

createResponse

public ModbusResponse createResponse()
Description copied from class: ModbusRequest
Returns the ModbusResponse that represents the answer to this ModbusRequest.

The implementation should take care about assembling the reply to this ModbusRequest.

Specified by:
createResponse in class ModbusRequest
Returns:
the corresponding ModbusResponse.

setReference

public void setReference(int ref)
Sets the reference of the register to start reading from with this ReadMultipleRegistersRequest.

Parameters:
ref - the reference of the register to start reading from.

getReference

public int getReference()
Returns the reference of the register to to start reading from with this ReadMultipleRegistersRequest.

Returns:
the reference of the register to start reading from as int.

setWordCount

public void setWordCount(int count)
Sets the number of words to be read with this ReadMultipleRegistersRequest.

Parameters:
count - the number of words to be read.

getWordCount

public int getWordCount()
Returns the number of words to be read with this ReadMultipleRegistersRequest.

Returns:
the number of words to be read as int.

writeData

public void writeData(java.io.DataOutput dout)
               throws java.io.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:
java.io.IOException - if an I/O related error occurs.

readData

public void readData(java.io.DataInput din)
              throws java.io.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:
java.io.IOException - if an I/O related error occurs.

jamod at SF

Copyright © 2002-2004 jamod development team.