BluetoothPlugin Class Reference
Public Member Functions | |
BluetoothPlugin () throws Throwable | |
Constructor can only have one instance per run. | |
void | send (Device device, String s) |
void | kill (Device arg0) |
void | killAll () |
void | addFilter (Device arg0, int arg1, String arg2) throws IOException |
Instruct the device to add a new filter to its filtering pipeline. | |
void | calibrate (Device arg0) throws IOException |
Calibrates the accelerometers of the target device. | |
void | connect (Device device) throws IOException |
Formally connect to a specified device. | |
void | disconnect (Device arg0) throws IOException |
Disconnect a connected device. | |
void | disconnectAll () throws IOException |
Disconnect from all devices known to this Plugin. | |
void | discover (Vector< Device > arg0) throws IOException |
A non-blocking method for finding nearby discoverable devices. | |
String[] | getActiveFilters (Device arg0) |
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 arg0) |
Gets the current sampling rate of this Device in hertz. | |
void | removeFilter (Device arg0, int arg1) |
Removes a filter from the list of active filters on the Device. | |
void | resetFilters (Device arg0) throws IOException |
Removes any filters currently active on the Device. | |
void | setSampleRate (Device arg0, int arg1) throws IOException |
Instructs this device to sample at a given rate. | |
Static Public Member Functions | |
static BluetoothPlugin | getInstance () |
Package Attributes | |
int | test = 0 |
Detailed Description
Constructor & Destructor Documentation
BluetoothPlugin | ( | ) | throws Throwable |
Constructor can only have one instance per run.
Member Function Documentation
void addFilter | ( | Device | device, | |
int | id, | |||
String | arg | |||
) | throws IOException |
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
Implements Plugin.
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()
Implements Plugin.
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)
Implements Plugin.
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()
Implements Plugin.
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.
Implements Plugin.
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.
Implements Plugin.
String [] getActiveFilters | ( | Device | device | ) |
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()
Implements Plugin.
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()
Implements Plugin.
static BluetoothPlugin getInstance | ( | ) | [static] |
int getSampleRate | ( | Device | device | ) |
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()
Implements Plugin.
void kill | ( | Device | arg0 | ) |
void killAll | ( | ) |
void removeFilter | ( | Device | device, | |
int | index | |||
) |
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
Implements Plugin.
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
Implements Plugin.
void send | ( | Device | device, | |
String | s | |||
) |
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
Implements Plugin.
Member Data Documentation
int test = 0 [package] |
The documentation for this class was generated from the following file:
- /Users/dev/Documents/SVN brazos.cs.tcu.edu/trunk/FROG/src/frog/plugin/bluetooth/BluetoothPlugin.java