com.phidgets
Class Manager

java.lang.Object
  extended by com.phidgets.Manager

public class Manager
extends java.lang.Object

This class represents a Phidget Manager. The Phidget manager is a way to keep track of attached phidgets, it will send Attach and Detach events as Phidgets are added and removed fromt the system.

The Phidget manager deals in base Phidget objects. These objects are not actually connected to opened Phidgets but can be used to get serial number, name, version, etc.


Constructor Summary
Manager()
          The default constructor.
 
Method Summary
 void addAttachListener(AttachListener l)
          Adds an attach listener.
 void addDetachListener(DetachListener l)
          Adds a detach listener.
 void close()
          Shuts down the Phidget Manager.
 java.util.Vector getPhidgets()
          Returns a list of Phidgets attached to the host computer.
 void removeAttachListener(AttachListener l)
          Removes an attach listener.
 void removeDetachListener(DetachListener l)
          Removes a detach listener.
 void start()
          Starts the PhidgetManager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manager

public Manager()
The default constructor. Creating a Phidget Manager object will initialize the attach and detach handlers internally, but start still needs to be called to actually recieve event notifications.

Method Detail

start

public final void start()
                 throws PhidgetException
Starts the PhidgetManager. This method starts the phidget manager running in the base Phidget21 C library. I attach and detach listeners are to be used, they should be registered before start is called so that no events are missed. Once start is called, the Phidget Manager will be active until close is called.

Throws:
PhidgetException

close

public final void close()
                 throws PhidgetException
Shuts down the Phidget Manager. This method should be called to close down the Phidget Manager. Events will no longer be recieved. This method gets calledd automatically when the class is destroyed so calling it is not required.

Throws:
PhidgetException

addAttachListener

public final void addAttachListener(AttachListener l)
Adds an attach listener. The attach handler is a method that will be called when a Phidget is phisically attached to the system, and has gone through its initalization, and so is ready to be used.

There is no limit on the number of attach handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the AttachListener interface

removeAttachListener

public final void removeAttachListener(AttachListener l)
Removes an attach listener. This will remove a previously added attach listener.


addDetachListener

public final void addDetachListener(DetachListener l)
Adds a detach listener. The detach handler is a method that will be called when a Phidget is phisically detached from the system, and is no longer available.

There is no limit on the number of detach handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the DetachListener interface

removeDetachListener

public final void removeDetachListener(DetachListener l)
Removes a detach listener. This will remove a previously added detach listener.


getPhidgets

public java.util.Vector getPhidgets()
Returns a list of Phidgets attached to the host computer. This list is updated right before the attach and detach events, and so will be up to date within these events.

Returns:
list of attached Phidgets