uk.org.pjt.jmaxellanotostream
Class PenStreamingConnection

java.lang.Object
  extended by uk.org.pjt.jmaxellanotostream.PenStreamingConnection
All Implemented Interfaces:
java.util.EventListener, javax.comm.SerialPortEventListener

public class PenStreamingConnection
extends java.lang.Object
implements javax.comm.SerialPortEventListener

Modified by Phil Tuddenham from parts of the R3 toolkit (Copyright Stanford University, written by Ron Yeh and available from http://hci.stanford.edu/paper/ under the BSD licence).


Field Summary
 int force
           
 int x
           
 int y
           
 
Constructor Summary
PenStreamingConnection(javax.comm.CommPortIdentifier portID, PenListener pl, boolean skipIntermediatePackets, boolean pollMode)
           
 
Method Summary
 void close()
           
static PenStreamingConnection createInstanceFromPortName(java.lang.String port, PenListener pl, boolean skipIntermediatePackets, boolean pollMode)
          If skipIntermediatePackets is true then for any number of successive samples that are in the queue when it is polled, only the most recent sample will be reported.
 void poll()
           
 void serialEvent(javax.comm.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

x

public int x

y

public int y

force

public int force
Constructor Detail

PenStreamingConnection

public PenStreamingConnection(javax.comm.CommPortIdentifier portID,
                              PenListener pl,
                              boolean skipIntermediatePackets,
                              boolean pollMode)
                       throws javax.comm.PortInUseException,
                              java.io.IOException,
                              java.util.TooManyListenersException,
                              javax.comm.UnsupportedCommOperationException
Throws:
javax.comm.PortInUseException
java.io.IOException
java.util.TooManyListenersException
javax.comm.UnsupportedCommOperationException
Method Detail

createInstanceFromPortName

public static PenStreamingConnection createInstanceFromPortName(java.lang.String port,
                                                                PenListener pl,
                                                                boolean skipIntermediatePackets,
                                                                boolean pollMode)
                                                         throws javax.comm.NoSuchPortException,
                                                                javax.comm.PortInUseException,
                                                                java.io.IOException,
                                                                java.util.TooManyListenersException,
                                                                javax.comm.UnsupportedCommOperationException
If skipIntermediatePackets is true then for any number of successive samples that are in the queue when it is polled, only the most recent sample will be reported. Samples interleaved with pen-ups are still reported. So for example, (pen is down to begin with) SSSSUSSUSS is reported as USUS. Another example, (pen is up to begin with) SSSSUSSUSS is reported as SUSUS

Parameters:
port -
pl -
skipIntermediatePackets -
pollMode -
Returns:
Throws:
javax.comm.NoSuchPortException
javax.comm.PortInUseException
java.io.IOException
java.util.TooManyListenersException
javax.comm.UnsupportedCommOperationException

close

public void close()

serialEvent

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

Specified by:
serialEvent in interface javax.comm.SerialPortEventListener
See Also:
SerialPortEventListener.serialEvent(javax.comm.SerialPortEvent)

poll

public void poll()