net.wimpi.modbus.io
Interface NonWordDataHandler


public interface NonWordDataHandler

Interface implementing a non word data handler for the read/write multiple register commands (class 0).

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

Method Summary
 int commitUpdate()
          Commits the data if it has been read into an intermediate repository.
 byte[] getData()
          Returns the intermediate raw non-word data.
 int getWordCount()
          Returns the word count of the data.
 void prepareData(int reference, int count)
          Prepares the raw data, putting it together from a backing data store.
 void readData(DataInput in, int reference, int count)
          Reads the non-word raw data based on an arbitrary implemented structure.
 

Method Detail

getData

byte[] getData()
Returns the intermediate raw non-word data.

Returns:
the raw data as byte[].

readData

void readData(DataInput in,
              int reference,
              int count)
              throws IOException,
                     EOFException
Reads the non-word raw data based on an arbitrary implemented structure.

Parameters:
in - the DataInput to read from.
reference - to specify the offset as int.
count - to sepcify the amount of bytes as int.
Throws:
IOException - if I/O fails.
EOFException - if the stream ends before all data is read.

getWordCount

int getWordCount()
Returns the word count of the data. Note that this should be the length of the byte array divided by two.

Returns:
the number of words the data consists of.

commitUpdate

int commitUpdate()
Commits the data if it has been read into an intermediate repository. This method is called by a WriteMultipleRegistersRequest instance when finished with reading, for creating a response.

Returns:
-1 if the commit was successful, a Modbus exception code valid for the read/write multiple registers commands otherwise.

prepareData

void prepareData(int reference,
                 int count)
Prepares the raw data, putting it together from a backing data store. This method is called by a ReadMultipleRegistersRequest instance when finshed with reading, for creating a response.

Parameters:
reference - to specify the offset as int.
count - to sepcify the amount of bytes as int.


Copyright © 2010. All Rights Reserved.