FROG

FROG Recognizer of Gestures

Plugin Interface Reference

This interface should be implemented by any developer seeking to write code that will allow them to use their device with the FROG Recognizer of Gestures. More...

Inheritance diagram for Plugin:

List of all members.

Public Member Functions

void calibrate (Device device) throws IOException
 Calibrates the accelerometers of the target device.
void connect (Device device) throws IOException
 Formally connect to a specified device.
void disconnect (Device device) throws IOException
 Disconnect a connected device.
void disconnectAll () throws IOException
 Disconnect from all devices known to this Plugin.
void discover (Vector< Device > deviceList) throws IOException
 A non-blocking method for finding nearby discoverable devices.
String[] getActiveFilters (Device device) throws IOException
 Returns a list of filters currently active on the device.
String[] getAvailFilters ()
 Returns a list of available filters that this device supports.
int getSampleRate (Device device) throws IOException
 Gets the current sampling rate of this Device in hertz.
void removeFilter (Device device, int index) throws IOException
 Removes a filter from the list of active filters on the Device.
void resetFilters (Device device) throws IOException
 Removes any filters currently active on the Device.
void setSampleRate (Device device, int rate) throws IOException
 Instructs this device to sample at a given rate.

Package Functions

void addFilter (Device device, int id, String arg) throws IOException
 Instruct the device to add a new filter to its filtering pipeline.

Detailed Description

This interface should be implemented by any developer seeking to write code that will allow them to use their device with the FROG Recognizer of Gestures.



The class implementing this interface should create Device objects that have a unique ID as well as a type. Those Device objects will have a pointer back to the Plugin that created them to perform their methods. Device objects have a notifier method for when accelerations are streaming in. It would be a good idea to create an Object such as "FormalConnection" when a Device is connected and sending gesture data. This "FormalConnection" object would be able to call Device#notifyAcceleration(frog.Accel3D) method to get the acceleration data up to the FROG and GUI levels.

Author:
Team Better Recognize

Member Function Documentation

void addFilter ( Device  device,
int  id,
String  arg 
) throws IOException [package]

Instruct the device to add a new filter to its filtering pipeline.

If the device supports on-board filtering, this method should communicate both what type of filter to use as well as an argument string for that filter. The id should come from the getAvailFilters method (it is the index of the array of the desired filter).

Parameters:
device the device to send the new filter information to
id the filter desired. This should be the index from the array of filters.
arg the argument String for this filter
Exceptions:
IOException if any communication error occurs
See also:
getAvailFilters()
Device.addFilter(int, String)

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void calibrate ( Device  device  )  throws IOException

Calibrates the accelerometers of the target device.

If the device requires calibration or any adjustment before use, this method can be called to provide a custom GUI instructing the user on how to set up their device (such as setting it flat on a table or throwing it out a window).

Parameters:
device the device to be calibrated
Exceptions:
IOException if any communication error occurs
See also:
Device.calibrate()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void connect ( Device  device  )  throws IOException

Formally connect to a specified device.

After the user has been presented with a list of discovered devices, the one they pick must be connected to so that a formal connection (and probably a new Thread) can be established and they can begin using the device.

Parameters:
device the device to connect to
Exceptions:
IOException if any communication error occurs. It should be assumed that if this exception is thrown, the device is NOT connected.
See also:
Device.connect(DeviceListener)

Implemented in BluetoothPlugin.

Here is the caller graph for this function:

void disconnect ( Device  device  )  throws IOException

Disconnect a connected device.

This method should tear down any facilities that were set up to support the device. This should be called by the user when they wish to disconnect the device.

Unlike unexpected disconnects (disconnects resulting from battery or communication failure), the disconnect() method should not notify DeviceListeners of anything. A call to this method means the disconnect is deliberate and expected.

Parameters:
device the device to disconnect from
Exceptions:
IOException if the device cannot be sent a disconnect signal. Regardless, a best attempt must be made to tear down any local resources tied to this device.
See also:
Device.disconnect()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void disconnectAll (  )  throws IOException

Disconnect from all devices known to this Plugin.

Convenience method for FROG. Most likely to be called when FROG is in the process of shutting down.

Exceptions:
IOException if any of the connected devices could not be sent a disconnect message. Regardless, FROG is probably shutting down and any local resources should be freed.

Implemented in BluetoothPlugin, and SpotPlugin.

void discover ( Vector< Device deviceList  )  throws IOException

A non-blocking method for finding nearby discoverable devices.

Ideally this Plugin should broadcast a message looking for nearby devices. As devices are found, they should be placed on the deviceList. Implementing classes are encouraged to try and make the discovery of devices within 10 seconds. Devices that are found should not be connected to, but rather added to the given Vector<Device> so that the caller can view devices as they become available.

This method is expected to be non-blocking. That is, a Plugin should launch the discovery process in a separate Thread to allow other Plugins to perform their respective discoveries simultaneously.

Exceptions:
IOException any catastrophic errors occur. Should ideally be thrown if the radio or other hardware is missing. Communication errors between the plugin and a device are not a sufficient cause to throw this exception.

Implemented in BluetoothPlugin, and SpotPlugin.

String [] getActiveFilters ( Device  device  )  throws IOException

Returns a list of filters currently active on the device.

If the Device does not support on-device filtering, a null or empty array may be returned.

Returns:
the list of currently active filters on the device in the order in which they were instantiated
Exceptions:
IOException if a list of active filters could not be obtained from the Device.
See also:
Device.getActiveFilters()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

String [] getAvailFilters (  ) 

Returns a list of available filters that this device supports.

The array of strings returned by this method should be in a specific order as the index of the array will be used to communicate with the device later.

Returns:
a list of Strings containing the names of the filters supported
See also:
Device.getAvailFilters()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

int getSampleRate ( Device  device  )  throws IOException

Gets the current sampling rate of this Device in hertz.

Returns:
the sampling rate of this device in hertz
Exceptions:
IOException if the current sample rate could not be obtained from the Device
See also:
Device.getSampleRate()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void removeFilter ( Device  device,
int  index 
) throws IOException

Removes a filter from the list of active filters on the Device.

This method does nothing at all if on-device filtering is not supported.

Parameters:
device the Device to delete a filter from
index the position on the Device's active filters list to remove
Exceptions:
IOException if the filter on the Device could not be removed

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void resetFilters ( Device  device  )  throws IOException

Removes any filters currently active on the Device.

This method makes it possible for the user to edit or remove filters the Device is performing. This method does nothing if on-device filtering cannot be done by this type of Device.

Parameters:
device the Device to clear the filters on
Exceptions:
IOException if any communication error occurs
See also:
addFilter(Device, int, String)
Device.resetFilters()

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:

void setSampleRate ( Device  device,
int  rate 
) throws IOException

Instructs this device to sample at a given rate.

If this device is incompatible with setting a different sampling rate, this method does nothing.

Parameters:
rate the rate to sample at in hertz
Exceptions:
IOException if any communication error occurs

Implemented in BluetoothPlugin, and SpotPlugin.

Here is the caller graph for this function:


The documentation for this interface was generated from the following file:
  • /Users/dev/Documents/SVN brazos.cs.tcu.edu/trunk/FROG/src/frog/plugin/Plugin.java
 All Classes Namespaces Files Functions Variables