edu.stanford.hci.r3.pen.streaming
Class PenStreamingConnection

java.lang.Object
  extended by edu.stanford.hci.r3.pen.streaming.PenStreamingConnection

public class PenStreamingConnection
extends java.lang.Object

This class reads from a COM port (connected to a Bluetooth transceiver). It streams data from the Nokia SU-1B pen and converts it according to the Nokia Document. The idea for this class is that it reports low-level pen events. It does not do any bit of gesture recognition.

Example code is taken from: http://java.sun.com/products/javacomm/javadocs/API_users_guide.html

This software is distributed under the BSD License.


Field Summary
static COMPort DEFAULT_PORT
           
 
Method Summary
 void addPenListener(PenListener pl)
          Add a Pen Listener to the internal list.
 void exit()
          Stops reading from the COM port.
static PenStreamingConnection getInstance()
           
static PenStreamingConnection getInstance(COMPort port)
           
 void serialEvent(SerialPortEvent event)
          Whenever data is available, send bytes one in a row to the processor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final COMPort DEFAULT_PORT
Method Detail

getInstance

public static PenStreamingConnection getInstance()
Returns:
use COM5

getInstance

public static PenStreamingConnection getInstance(COMPort port)
Parameters:
port - if port is null, use the default port (COM5)

addPenListener

public void addPenListener(PenListener pl)
Add a Pen Listener to the internal list. Pen Listeners' callbacks will be called when pen events are detected.

Parameters:
pl -

exit

public void exit()
Stops reading from the COM port.


serialEvent

public void serialEvent(SerialPortEvent event)
Whenever data is available, send bytes one in a row to the processor.

See Also:
javax.comm.SerialPortEventListener#serialEvent(javax.comm.SerialPortEvent)

Copyright 2006 Stanford University