Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

org.nees.daq.DataThread Class Reference

For a java thread to monitor for DAQ data. More...

List of all members.

Public Member Functions

 DataThread (Socket socket) throws IOException
 Just connect input stream to socket.

void start ()
 Start the thread up.

void stop ()
 Stop the thread, by setting boolean flag.

void run ()
 Main method.

void addListener (String name, DaqListener l)
 Add listener to channel table.

void removeListener (String name)
 Remove listener from the channel list.

boolean isRunning ()


Detailed Description

For a java thread to monitor for DAQ data.

Creates a runable for a java thread to monitor and relay data. Only relays data to those listeners that have been added. This thread sorts the data by channel name and that listeners are added by channel name. So, a listener gets only the data for that channel.

See also:
DaqListener

addListener

Definition at line 26 of file DataThread.java.


Constructor & Destructor Documentation

org.nees.daq.DataThread.DataThread Socket  socket  )  throws IOException
 

Just connect input stream to socket.

Note:
assumes TCP socket already connected

Constructor - tell JVM we are discardable on exit

Definition at line 40 of file DataThread.java.


Member Function Documentation

void org.nees.daq.DataThread.addListener String  name,
DaqListener  l
 

Add listener to channel table.

Add a DaQListener, by channel name, to the list of listeners. The listener gets called back (on the postData Method), with the channel name, the time stamp, and the data.

Note:
All DAQ channel data is assumed to be floating point numbers.
Parameters:
name Channel name
l DaqListener
Bug:
this will overwrite a previous listener with the same channel name!
See also:
DaqListener

DaqListener.postData(String,double,double) "postData Method'

Definition at line 145 of file DataThread.java.

References org.nees.daq.DataThread.addListener().

Referenced by org.nees.daq.DataThread.addListener().

void org.nees.daq.DataThread.removeListener String  name  ) 
 

Remove listener from the channel list.

Remove the DaqListener for the named channel from the channel list.

Parameters:
name Channel name
l DaqListener
Note:
I need to document this better!
See also:
DaqListener

Definition at line 160 of file DataThread.java.

References org.nees.daq.DataThread.removeListener().

Referenced by org.nees.daq.DataThread.removeListener().

void org.nees.daq.DataThread.run  ) 
 

Main method.

While thre are no errors and stop has not been called, loop "forever" to get and parse data from the DAQ. Convert the timestamps to our internal format, tokenize the data into channel/value, and call those listeners with the channel name that corresponds to the channel.

Note:
Assumes implementation of postData on the DaqListerner is keeping up no double or circular buffering. Might need to be modified.

All DAQ channel data is assumed to be floating point numbers.

Rest of line is 'channel' pairs

Bug:
Initial DAQ handshake should not include driverid! Check this!

Definition at line 75 of file DataThread.java.

References org.nees.daq.ISOtoRbnbTime.getValue(), org.nees.daq.ISOtoRbnbTime.is_valid, and org.nees.daq.DaqListener.postData().


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 11:12:27 2004 for Data turbine for NEESGrid by doxygen 1.3.7