DeviceListener Interface Reference
Interface for listening to a device. More...
Public Member Functions | |
void | unexpectedDisconnect (Device d) |
For handling an unexpected disconnect from a device. | |
void | accelerationPerformed (AccelEvent e) |
Run every time a single acceleration has come in. | |
void | gestureComplete (boolean good, Device d) |
Run when a single gesture has been completed. |
Detailed Description
Interface for listening to a device.
Since FROG is an event-driven program there is an obvious need to be able to react as gestures come in from the user.
It is also important for handling device operations such as abrupt disconnects or other failures.
Member Function Documentation
void accelerationPerformed | ( | AccelEvent | e | ) |
Run every time a single acceleration has come in.
It is highly recommended you keep this method simple or execute in a new Thread. There may be many listeners all wanting to execute some code when an event happens.
- Parameters:
-
e contains the acceleration data and the calling device
Implemented in Player, DeviceDialog, EvaluationPanel, PlayerPanel, RecognitionSectionPanel, TrainPanel, User, Session, and SessionListener.
void gestureComplete | ( | boolean | good, | |
Device | d | |||
) |
Run when a single gesture has been completed.
If the gesture was cut unexpectedly short either due to an error or hardware failure the boolean will be false and appropriate action should be taken to discard all acceleration data up to this point since the last known good gesture.
- Parameters:
-
good true
if this gesture is complete.false
if this gesture should be discarded.d the device that completed the gesture
Implemented in Player, DeviceDialog, EvaluationPanel, PlayerPanel, RecognitionSectionPanel, TrainPanel, User, Session, and SessionListener.
void unexpectedDisconnect | ( | Device | d | ) |
For handling an unexpected disconnect from a device.
This is not called when a user has specified that they wish to disconnect. If a Device has gone out of range or the battery dies, that is an appropriate time to use this.
Common sense would dictate this is a job for Exceptions. However, if a disconnect occurs while idle, it is impossible to throw an exception beyond the Plugin. Devices need a listener to notify when something goes wrong.
- Parameters:
-
d Device that was unexpectedly disconnected
Implemented in Player, DeviceDialog, EvaluationPanel, PlayerPanel, RecognitionSectionPanel, TrainPanel, User, Session, and SessionListener.
The documentation for this interface was generated from the following file:
- /Users/dev/Documents/SVN brazos.cs.tcu.edu/trunk/FROG/src/frog/plugin/DeviceListener.java