edu.berkeley.guir.ptk.input
Class PhidgetsInterfaceKitInput

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.input.InputSource
          extended byedu.berkeley.guir.ptk.input.PhidgetsInterfaceKitInput
All Implemented Interfaces:
Phidgets._IPhidgetManagerEvents, java.util.EventListener, java.lang.Runnable
Direct Known Subclasses:
PhidgetsPressureInput

public abstract class PhidgetsInterfaceKitInput
extends InputSource
implements Phidgets._IPhidgetManagerEvents

Provides functionality for using a PhidgetInterfaceKit as a PTK Input. Implements _IPhidgetManagerEvents and provides default functionality for the functions this Interface defines. A single PhidgetInterfaceKitOutput object corresponds to a single physical Phidget Interface Kit - the object is assigned the serial number of the physical hardware upon instantiation.

The serial number is assigned on the microprocessor of the connector circuit board (i.e., the interface kit itself does not have a serial number - the USB port to USB hub / device board has a serial number.

Author:
tmatthew

Field Summary
protected  Phidgets.PhidgetInterfaceKit kit
           
static java.lang.String KIT
           
protected  Phidgets.PhidgetManager manager
           
 int my_serial_num
          The serial number is assigned on the microprocessor of the connector circuit board (i.e., the interface kit itself does not have a serial number - the USB port to USB hub / device board has a serial number.
 
Fields inherited from class edu.berkeley.guir.ptk.input.InputSource
history, mds, my_id, my_ip, time_between_events
 
Fields inherited from class edu.berkeley.guir.ptk.PTK
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG
 
Fields inherited from interface Phidgets._IPhidgetManagerEvents
event_package, id_1, id_2, id_3
 
Constructor Summary
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id)
          Non-distributed input; initializes the PhidgetManager.
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id, Abstractor abs)
           
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id, Abstractor[] abs)
           
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id, java.lang.String my_ip)
          Remotely distributed input; initializes the PhidgetManager, which listens for new Phidgets to be "attached."
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id, java.lang.String my_ip, Abstractor abs)
          Initializes the PhidgetManager and indicates that this Input will have input-side abstraction.
PhidgetsInterfaceKitInput(int serial, Metadata mds, java.lang.String my_id, java.lang.String my_ip, Abstractor[] abs)
          Initializes the PhidgetManager and indicates that this Input will have input-side abstraction.
 
Method Summary
abstract  void initialize()
          This method is called after the Phidget with the correct serial number is attached; put initialization code for the Phidget here.
protected  void initManager()
           
 void OnAttach(Phidgets._IPhidgetManagerEvents_OnAttachEvent e)
          Called when a Phidget is attached (i.e., plugged in) and detected by the program.
 void OnDetach(Phidgets._IPhidgetManagerEvents_OnDetachEvent e)
          Called when a Phidget is detatched (i.e., unplugged).
 void OnError(Phidgets._IPhidgetManagerEvents_OnErrorEvent e)
          Called when a Phidget has an error.
 
Methods inherited from class edu.berkeley.guir.ptk.input.InputSource
addMetadata, addMetadataItem, addMyMetadataToEvent, dispatchEvent, finalize, getAbstractThenSendInputEvent, getMetadata, getMetadataItemsAsArray, getThenSendInputEvent, newInput, register, run, setMetadata, setTimeBetweenEvents, startInput
 
Methods inherited from class edu.berkeley.guir.ptk.PTK
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KIT

public static final java.lang.String KIT
See Also:
Constant Field Values

my_serial_num

public int my_serial_num
The serial number is assigned on the microprocessor of the connector circuit board (i.e., the interface kit itself does not have a serial number - the USB port to USB hub / device board has a serial number.


kit

protected Phidgets.PhidgetInterfaceKit kit

manager

protected Phidgets.PhidgetManager manager
Constructor Detail

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id,
                                 java.lang.String my_ip)
Remotely distributed input; initializes the PhidgetManager, which listens for new Phidgets to be "attached."

Parameters:
serial - the serial number of the Phidget.

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id,
                                 java.lang.String my_ip,
                                 Abstractor abs)
Initializes the PhidgetManager and indicates that this Input will have input-side abstraction.

Parameters:
serial - the serial number of the Phidget.

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id,
                                 java.lang.String my_ip,
                                 Abstractor[] abs)
Initializes the PhidgetManager and indicates that this Input will have input-side abstraction.

Parameters:
serial - the serial number of the Phidget.

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id)
Non-distributed input; initializes the PhidgetManager.

Parameters:
serial -

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id,
                                 Abstractor abs)

PhidgetsInterfaceKitInput

public PhidgetsInterfaceKitInput(int serial,
                                 Metadata mds,
                                 java.lang.String my_id,
                                 Abstractor[] abs)
Method Detail

initManager

protected void initManager()

initialize

public abstract void initialize()
This method is called after the Phidget with the correct serial number is attached; put initialization code for the Phidget here.


OnAttach

public void OnAttach(Phidgets._IPhidgetManagerEvents_OnAttachEvent e)
Called when a Phidget is attached (i.e., plugged in) and detected by the program. Checks to be sure the Phidget is an interface kit, that it has the correct serial number, then instantiates one, and calls initialize().

Specified by:
OnAttach in interface Phidgets._IPhidgetManagerEvents

OnDetach

public void OnDetach(Phidgets._IPhidgetManagerEvents_OnDetachEvent e)
Called when a Phidget is detatched (i.e., unplugged). Checks to be sure the Phidget is an interface kit with the right serial number and then sets the interface kit object to null.

Specified by:
OnDetach in interface Phidgets._IPhidgetManagerEvents

OnError

public void OnError(Phidgets._IPhidgetManagerEvents_OnErrorEvent e)
Called when a Phidget has an error.

Specified by:
OnError in interface Phidgets._IPhidgetManagerEvents