Pen Class Reference

Inheritance diagram for Pen:

PenInput List of all members.

Public Member Functions

 Pen ()
 Can't use this constructor more than once, because you can only have ONE physical pen connected to the localhost's pen server.
 Pen (String name)
 Pen (String name, String penServerHostName)
void addLivePenListener (PenListener penListener)
 Adds a low-level pen data listener to the live pen.
void removeLivePenListener (PenListener penListener)
 Removes the pen listener from the live pen.
void setLocalComPort (COMPort port)
 Customize the COM port, before going live.
void setPenServerPort (int tcpipPort)
 Customize the port with which you will connect to the PenServer.
void startLiveMode ()
 Connects to the pen connection on the local machine, with the default com port.
void startLiveMode (String hostDomainNameOrIPAddr)
 Set up connection to the pen server.
void stopLiveMode ()
 Exit live mode.

Static Public Attributes

static final COMPort DEFAULT_COM_PORT = COMPort.COM5
 PenStreamingConnection uses this to determine which COM port to connect to when looking for pen data.

Detailed Description

This class represents a single, physical digital pen. A pen has an identity, so you should be able to distinguish them. Pens can batch data for later upload. Alternatively, they can stream live data when connected in a streaming mode.

The Pen object abstracts the lower level connections with the streaming server/client, and dealing with batched ink input. It also interfaces with event handling in the system.

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 27 of file Pen.java.


Constructor & Destructor Documentation

Pen (  ) 

Can't use this constructor more than once, because you can only have ONE physical pen connected to the localhost's pen server.

However, you can have two pen objects listen to the same localhost server if you wish. They will just get the same data.

Definition at line 65 of file Pen.java.

Pen ( String  name  ) 

Parameters:
name for debugging purposes, so you can identify pens by name

Definition at line 73 of file Pen.java.

Pen ( String  name,
String  penServerHostName 
)

Parameters:
name name the pen so you can identify it later
penServerHostName 

Definition at line 82 of file Pen.java.


Member Function Documentation

void addLivePenListener ( PenListener  penListener  ) 

Adds a low-level pen data listener to the live pen.

You SHOULD call this after starting live mode.... However, we can cache the listener for you, if you really want. This is to eliminate annoying ordering constraints.

Subclasses *should* override this, and call the super, to actually make use of PenListeners.

Parameters:
penListener 
Returns:
true if we cached the pen listener on the penListenersToAdd list

Reimplemented from PenInput.

Definition at line 92 of file Pen.java.

References PenClient.addPenListener(), and PenInput.isLive().

Referenced by CaptureApplication.addCalibrationHandler(), FlashWhiteboard.addPen(), SketchToPaperUI.addPenListener(), PenCoordinateDebugger.main(), and SketchToPaperUI.SketchToPaperUI().

void removeLivePenListener ( PenListener  penListener  ) 

Removes the pen listener from the live pen.

Subclasses *should* override this, and call the super's implementation if necessary, to actually make use of PenListeners.

Parameters:
penListener 

Reimplemented from PenInput.

Definition at line 106 of file Pen.java.

References PenInput.isLive(), and PenClient.removePenListener().

Referenced by CaptureApplication.addCalibrationHandler().

void setLocalComPort ( COMPort  port  ) 

Customize the COM port, before going live.

.. This will only have an effect on the local pen, as you can't really tell the remote pen which port to connect on. For that, you should customize the PenServer or PenServerTrayApp directly.

Parameters:
port 

Definition at line 120 of file Pen.java.

void setPenServerPort ( int  tcpipPort  ) 

Customize the port with which you will connect to the PenServer.

Parameters:
tcpipPort 

Definition at line 129 of file Pen.java.

void startLiveMode ( String  hostDomainNameOrIPAddr  ) 

Set up connection to the pen server.

The pen server is mapped to a physical pen attached to a some computer somewhere in the world. Starting livemode on a pen object just "attaches" it to an external server.

Parameters:
hostDomainNameOrIPAddr 

Definition at line 149 of file Pen.java.

References PenClient.addPenListener(), PenClient.connect(), PenInput.getName(), PenInput.isLive(), PenInput.liveMode, and PenInput.penListenersToAdd.

void startLiveMode (  )  [virtual]

Connects to the pen connection on the local machine, with the default com port.

This will ensure the PenServer on the local machine is running. This will be called by the PaperToolkit when you start an application.

Implements PenInput.

Definition at line 138 of file Pen.java.

Referenced by FlashWhiteboard.addPen(), PenCoordinateDebugger.main(), and SketchToPaperUI.SketchToPaperUI().


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:43 2007 for R3 Paper Toolkit by  doxygen 1.4.7