Parkinson Disease Database

tablet
Class Tablet

java.lang.Object
  extended by tablet.Tablet
All Implemented Interfaces:
java.lang.Runnable

public class Tablet
extends java.lang.Object
implements java.lang.Runnable

Class that communicates with tablet dll library. Accomplish all tablet specific tasks.

Copyright: Copyright (c) 2005 Miroslav Skrbek, Jan Dolezel

Company: ÈVUT FEL, Prague


Field Summary
private static boolean capturing
           
private static Tablet instance
           
private  java.util.List<TabletListener> listeners
          Array of listeners for tablet packets
private  boolean opened
          specifies whether is tablet ready for use
private static boolean start
           
private  java.lang.Thread thread
          Runs on background and listens to tablet
private static TabletInfo ti
          Information about opened tablet
private static int timeout
           
 
Constructor Summary
private Tablet(TabletInfo tabletInfo)
          Creates new tablet with provided information
 
Method Summary
 void addTabletListener(TabletListener listener)
          adds new TabletListener to list of listeners
 void close()
          stops listening to tablet
static Tablet getInstance(TabletInfo tabletInfo, int time)
           
 TabletInfo getTabletInfo()
          returns information about tablet
 boolean isOpen()
          specifies whether is tablet ready for use
protected  void notifyListeners(int[] packet)
          notify listeners about new tablet packet
protected  void notifyListenersTimeout()
           
 void open()
          tries to initialize tablet
 void removeTabletListener(TabletListener listener)
          removes TabletListener from list of listeners
 void run()
          loop for handling tablet specific events Method loops until interrupted.
 void setTabletInfo(TabletInfo tabletInfo)
          sets new tablet information
 void startCapture(boolean start)
          starts capturing packets from tablet If tablet is opened, method runs new thread for listening and exits.
 void stopCapture()
          stops capturing packets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static Tablet instance

capturing

private static boolean capturing

start

private static boolean start

timeout

private static int timeout

listeners

private java.util.List<TabletListener> listeners
Array of listeners for tablet packets


ti

private static TabletInfo ti
Information about opened tablet


thread

private java.lang.Thread thread
Runs on background and listens to tablet


opened

private boolean opened
specifies whether is tablet ready for use

Constructor Detail

Tablet

private Tablet(TabletInfo tabletInfo)
Creates new tablet with provided information

Parameters:
tabletInfo - tablet measures
Method Detail

getInstance

public static Tablet getInstance(TabletInfo tabletInfo,
                                 int time)

close

public void close()
stops listening to tablet


open

public void open()
tries to initialize tablet


run

public void run()
loop for handling tablet specific events

Method loops until interrupted. When recieve packets from tablets, it converts them to tablet points and let know listeners. First notifing is performed after the tablet pen has touched the surface.

Specified by:
run in interface java.lang.Runnable

startCapture

public void startCapture(boolean start)
starts capturing packets from tablet

If tablet is opened, method runs new thread for listening and exits.


stopCapture

public void stopCapture()
stops capturing packets


notifyListeners

protected void notifyListeners(int[] packet)
notify listeners about new tablet packet

Parameters:
packet - array for creating new TabletPoint

notifyListenersTimeout

protected void notifyListenersTimeout()

getTabletInfo

public TabletInfo getTabletInfo()
returns information about tablet


setTabletInfo

public void setTabletInfo(TabletInfo tabletInfo)
sets new tablet information

Parameters:
tabletInfo - tablet measures

addTabletListener

public void addTabletListener(TabletListener listener)
adds new TabletListener to list of listeners

Parameters:
listener - class capable process TabletPacket

removeTabletListener

public void removeTabletListener(TabletListener listener)
removes TabletListener from list of listeners


isOpen

public boolean isOpen()
specifies whether is tablet ready for use


Parkinson Disease Database