Public Member Functions | |
AccelerometerPhidget () throws PhidgetException | |
final void | addAccelerationChangeListener (AccelerationChangeListener l) |
native double | getAcceleration (int index) throws PhidgetException |
native double | getAccelerationChangeTrigger (int index) throws PhidgetException |
native double | getAccelerationMax (int index) throws PhidgetException |
native double | getAccelerationMin (int index) throws PhidgetException |
native int | getAxisCount () throws PhidgetException |
final void | removeAccelerationChangeListener (AccelerationChangeListener l) |
native void | setAccelerationChangeTrigger (int index, double newVal) throws PhidgetException |
Private Member Functions | |
native void | enableAccelerationChangeEvents (boolean b) |
final void | enableDeviceSpecificEvents (boolean b) |
void | fireAccelerationChange (AccelerationChangeEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
LinkedList | accelerationChangeListeners = new LinkedList () |
long | nativeAccelerationChangeHandler = 0 |
This class represents a Phidget Accelerometer. All methods to read acceleration data from an Accelerometer are implemented in this class.
The Phidget Accelerometer provides 2 or 3 axes of acceleration data, at anywhere from 2g to 10g sensitivity, depending on the specific revision. See your hardware documetation for more information. They can measure both static (gravity) and dynamic acceleration.
Definition at line 20 of file AccelerometerPhidget.java.
com.phidgets.AccelerometerPhidget.AccelerometerPhidget | ( | ) | throws PhidgetException [inline] |
Definition at line 22 of file AccelerometerPhidget.java.
final void com.phidgets.AccelerometerPhidget.addAccelerationChangeListener | ( | AccelerationChangeListener | l | ) | [inline] |
Adds an acceleration change listener. The acceleration change handler is a method that will be called when the acceleration of an axis has changed by at least the Trigger that has been set for that axis.
There is no limit on the number of acceleration change handlers that can be registered for a particular Phidget.
l | An implemetation of the AccelerationChangeListener interface |
Definition at line 93 of file AccelerometerPhidget.java.
static native long com.phidgets.AccelerometerPhidget.create | ( | ) | throws PhidgetException [static, private] |
native void com.phidgets.AccelerometerPhidget.enableAccelerationChangeEvents | ( | boolean | b | ) | [private] |
final void com.phidgets.AccelerometerPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 81 of file AccelerometerPhidget.java.
void com.phidgets.AccelerometerPhidget.fireAccelerationChange | ( | AccelerationChangeEvent | e | ) | [inline, private] |
Definition at line 107 of file AccelerometerPhidget.java.
native double com.phidgets.AccelerometerPhidget.getAcceleration | ( | int | index | ) | throws PhidgetException |
Returns the acceleration of a particular axis. This value is returned in g's, where one g of acceleration is equal to gravity. This means that at a standstill each axis will measure between -1.0 and 1.0 g's depending on orientation.
This value will always be between getAccelerationMin and getAccelerationMax.
Index 0 is the x-axis, 1 is the y-axis, and 2 is the z-axis (where available).
index | index of the axis |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native double com.phidgets.AccelerometerPhidget.getAccelerationChangeTrigger | ( | int | index | ) | throws PhidgetException |
Returns the change trigger for an Axis. This value is in g's and is by default set to 0.
index | index of the axis |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native double com.phidgets.AccelerometerPhidget.getAccelerationMax | ( | int | index | ) | throws PhidgetException |
Returns the maximum acceleration value that this axis will report. This will be set to just higher then the maximum acceleration that this axis can measure. If the acceleration is equal to this maximum, assume that that axis is saturated beyond what it can measure.
native double com.phidgets.AccelerometerPhidget.getAccelerationMin | ( | int | index | ) | throws PhidgetException |
Returns the minimum acceleration value that this axis will report. This will be set to just lower then the minimum acceleration that this axis can measure. If the acceleration is equal to this minimum, assume that that axis is saturated beyond what it can measure.
native int com.phidgets.AccelerometerPhidget.getAxisCount | ( | ) | throws PhidgetException |
Returns the number of accelerometer axes. Currently all accelerometers provide two or three axes of acceleration - x, y, (and z).
final void com.phidgets.AccelerometerPhidget.removeAccelerationChangeListener | ( | AccelerationChangeListener | l | ) | [inline] |
Definition at line 101 of file AccelerometerPhidget.java.
native void com.phidgets.AccelerometerPhidget.setAccelerationChangeTrigger | ( | int | index, |
double | newVal | ||
) | throws PhidgetException |
Sets the change trigger for an Axis. This value is in g's and is by default set to 0. This is the difference in acceleration that must appear between succesive calls to the OnAccelerationChange event handler.
index | index of the axis |
newVal | the new change trigger for this axis |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
LinkedList com.phidgets.AccelerometerPhidget.accelerationChangeListeners = new LinkedList () [private] |
Definition at line 99 of file AccelerometerPhidget.java.
long com.phidgets.AccelerometerPhidget.nativeAccelerationChangeHandler = 0 [private] |
Definition at line 100 of file AccelerometerPhidget.java.