Public Member Functions | |
final void | addWeightChangeListener (WeightChangeListener l) |
native double | getWeight () throws PhidgetException |
native double | getWeightChangeTrigger () throws PhidgetException |
final void | removeWeightChangeListener (WeightChangeListener l) |
native void | setWeightChangeTrigger (double newVal) throws PhidgetException |
WeightSensorPhidget () throws PhidgetException | |
Private Member Functions | |
final void | enableDeviceSpecificEvents (boolean b) |
native void | enableWeightChangeEvents (boolean b) |
void | fireWeightChange (WeightChangeEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
long | nativeWeightChangeHandler = 0 |
LinkedList | weightChangeListeners = new LinkedList () |
This class represents a Phidget Weight Sensor. All methods to read weight data from the weight sensor are implemented in this class.
The Phidget Weight Sensor is simply an electronic scale with a USB interface. It provides one weight value, in kg.
Definition at line 19 of file WeightSensorPhidget.java.
com.phidgets.WeightSensorPhidget.WeightSensorPhidget | ( | ) | throws PhidgetException [inline] |
Definition at line 21 of file WeightSensorPhidget.java.
final void com.phidgets.WeightSensorPhidget.addWeightChangeListener | ( | WeightChangeListener | l | ) | [inline] |
Adds a weight change listener. The weight change handler is a method that will be called when the weight has changed by at least the Trigger that has been set.
There is no limit on the number of weight change handlers that can be registered for a particular Phidget.
l | An implemetation of the WeightChangeListener interface |
Definition at line 66 of file WeightSensorPhidget.java.
static native long com.phidgets.WeightSensorPhidget.create | ( | ) | throws PhidgetException [static, private] |
final void com.phidgets.WeightSensorPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 54 of file WeightSensorPhidget.java.
native void com.phidgets.WeightSensorPhidget.enableWeightChangeEvents | ( | boolean | b | ) | [private] |
void com.phidgets.WeightSensorPhidget.fireWeightChange | ( | WeightChangeEvent | e | ) | [inline, private] |
Definition at line 80 of file WeightSensorPhidget.java.
native double com.phidgets.WeightSensorPhidget.getWeight | ( | ) | throws PhidgetException |
Returns the sensed weight in kg. This weight is in kg (kilograms), but can easily be converted into other units. The accuracy, sesitivity and range depends on the scale and version.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native double com.phidgets.WeightSensorPhidget.getWeightChangeTrigger | ( | ) | throws PhidgetException |
Returns the weight change trigger. This is the ammount by which the sensed weight must change between WeightChangeEvents. By default this is set to 5.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
final void com.phidgets.WeightSensorPhidget.removeWeightChangeListener | ( | WeightChangeListener | l | ) | [inline] |
Definition at line 74 of file WeightSensorPhidget.java.
native void com.phidgets.WeightSensorPhidget.setWeightChangeTrigger | ( | double | newVal | ) | throws PhidgetException |
Sets the weight change trigger. This is the ammount by which the sensed weight must change between WeightChangeEvents. By default this is set to 5.
newVal | The new trigger value |
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
long com.phidgets.WeightSensorPhidget.nativeWeightChangeHandler = 0 [private] |
Definition at line 73 of file WeightSensorPhidget.java.
LinkedList com.phidgets.WeightSensorPhidget.weightChangeListeners = new LinkedList () [private] |
Definition at line 72 of file WeightSensorPhidget.java.