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

java.lang.Object
  extended by edu.stanford.hci.r3.pen.streaming.PenServer
All Implemented Interfaces:
PenListener

public class PenServer
extends java.lang.Object
implements PenListener

This software is distributed under the BSD License.


Field Summary
static int DEFAULT_JAVA_PORT
          The default port to which pen clients can connect...
static int DEFAULT_PLAINTEXT_PORT
           
static COMPort DEFAULT_SERIAL_PORT
           
 
Constructor Summary
PenServer(java.net.ServerSocket ss, ClientServerType type)
           
 
Method Summary
 boolean isPenUp()
           
static boolean javaServerStarted()
           
static void main(java.lang.String[] args)
           
 void penDown(PenSample s)
          Since with a PenListener...
 void penUp(PenSample s)
          Samples for penUp have x & y set to 0.
 void sample(PenSample sample)
          A sample happened.
static void startBothServers(COMPort serialPortName, int tcpipPortJava, int tcpipPortPlainText)
          Provides default implementation.
static void startJavaServer()
          Provides default implementation.
static void startJavaServer(COMPort serialPort)
          Use the default java port...
static void startJavaServer(COMPort serialPort, int tcpipPort)
          Start a Java server on this machine at the corresponding TCP/IP port.
static void startTextServer()
           
static void startTextServer(COMPort serialPort, int tcpipPort)
          NOTE, you can only start one PenStreamingConnection at a time, on the local machine.
static void stopServers()
           
static boolean textServerStarted()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JAVA_PORT

public static final int DEFAULT_JAVA_PORT
The default port to which pen clients can connect...

See Also:
Constant Field Values

DEFAULT_PLAINTEXT_PORT

public static final int DEFAULT_PLAINTEXT_PORT
See Also:
Constant Field Values

DEFAULT_SERIAL_PORT

public static final COMPort DEFAULT_SERIAL_PORT
Constructor Detail

PenServer

public PenServer(java.net.ServerSocket ss,
                 ClientServerType type)
Parameters:
ss -
type -
Method Detail

javaServerStarted

public static boolean javaServerStarted()
Returns:
whether there is a local Java server running.

main

public static void main(java.lang.String[] args)
Parameters:
args -

startBothServers

public static void startBothServers(COMPort serialPortName,
                                    int tcpipPortJava,
                                    int tcpipPortPlainText)
Provides default implementation. It's unclear we want two servers going at the same time. Won't performance be better if we only send one stream of data? Also, what about Multicast? Then, multiple clients can listen in very easily. However, we'd need a server that will dole out the multicast address... This is simpler for now.


startJavaServer

public static void startJavaServer()
Provides default implementation. Only start the Java Server.


startJavaServer

public static void startJavaServer(COMPort serialPort)
Use the default java port...

Parameters:
serialPort -

startJavaServer

public static void startJavaServer(COMPort serialPort,
                                   int tcpipPort)
Start a Java server on this machine at the corresponding TCP/IP port. Add the java server as a listener to the local pen connection (at the specified COM port).

Parameters:
tcpipPort -

startTextServer

public static void startTextServer()

startTextServer

public static void startTextServer(COMPort serialPort,
                                   int tcpipPort)
NOTE, you can only start one PenStreamingConnection at a time, on the local machine. Thus, if you have created on one COM5, you cannot create another one at COM6, until you kill the connection.

Parameters:
tcpipPort -

stopServers

public static void stopServers()

textServerStarted

public static boolean textServerStarted()
Returns:

isPenUp

public boolean isPenUp()
Returns:
is the pen currently up?

penDown

public void penDown(PenSample s)
Since with a PenListener... a penDown event NEVER overlaps with a penSample event, we now must send a sample over the wire for penDown events too!

Specified by:
penDown in interface PenListener

penUp

public void penUp(PenSample s)
Description copied from interface: PenListener
Samples for penUp have x & y set to 0.

Specified by:
penUp in interface PenListener

sample

public void sample(PenSample sample)
Description copied from interface: PenListener
A sample happened.

Specified by:
sample in interface PenListener
See Also:
PenListener.sample(edu.stanford.hci.r3.pen.PenSample)

Copyright 2006 Stanford University