jamod at SF

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:
1.2rc1 (09/11/2004)
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(java.io.DataInput in, int reference, int count)
          Reads the non-word raw data based on an arbitrary implemented structure.
 

Method Detail

getData

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

Returns:
the raw data as byte[].

readData

public void readData(java.io.DataInput in,
                     int reference,
                     int count)
              throws java.io.IOException,
                     java.io.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:
java.io.IOException - if I/O fails.
java.io.EOFException - if the stream ends before all data is read.

getWordCount

public 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

public 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

public 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.

jamod at SF

Copyright © 2002-2004 jamod development team.