Public Member Functions | |
final void | addInputChangeListener (InputChangeListener l) |
final void | addOutputChangeListener (OutputChangeListener l) |
final void | addSensorChangeListener (SensorChangeListener l) |
native int | getDataRate (int index) throws PhidgetException |
native int | getDataRateMax (int index) throws PhidgetException |
native int | getDataRateMin (int index) throws PhidgetException |
native int | getInputCount () throws PhidgetException |
native boolean | getInputState (int index) throws PhidgetException |
native int | getOutputCount () throws PhidgetException |
native boolean | getOutputState (int index) throws PhidgetException |
native boolean | getRatiometric () throws PhidgetException |
native int | getSensorChangeTrigger (int index) throws PhidgetException |
native int | getSensorCount () throws PhidgetException |
native int | getSensorRawValue (int index) throws PhidgetException |
native int | getSensorValue (int index) throws PhidgetException |
InterfaceKitPhidget () throws PhidgetException | |
final void | removeInputChangeListener (InputChangeListener l) |
final void | removeOutputChangeListener (OutputChangeListener l) |
final void | removeSensorChangeListener (SensorChangeListener l) |
native void | setDataRate (int index, int newVal) throws PhidgetException |
native void | setOutputState (int index, boolean newVal) throws PhidgetException |
native void | setRatiometric (boolean state) throws PhidgetException |
native void | setSensorChangeTrigger (int index, int newVal) throws PhidgetException |
Private Member Functions | |
final void | enableDeviceSpecificEvents (boolean b) |
native void | enableInputChangeEvents (boolean b) |
native void | enableOutputChangeEvents (boolean b) |
native void | enableSensorChangeEvents (boolean b) |
void | fireInputChange (InputChangeEvent e) |
void | fireOutputChange (OutputChangeEvent e) |
void | fireSensorChange (SensorChangeEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
LinkedList | inputChangeListeners = new LinkedList() |
long | nativeInputChangeHandler = 0 |
long | nativeOutputChangeHandler = 0 |
long | nativeSensorChangeHandler = 0 |
LinkedList | outputChangeListeners = new LinkedList() |
LinkedList | sensorChangeListeners = new LinkedList() |
This class represents a Phidget Interface Kit. All methods to read and write data to and from an Interface Kit are implemented in this class.
There are many types of Interface Kits, but each is simply a collection of 0 or more digital inputs, digital outpus and analog sensor inputs. The inputs can be read and outputs can be set, and event handlers can be set for each of these.
See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.
Definition at line 26 of file InterfaceKitPhidget.java.
com.phidgets.InterfaceKitPhidget.InterfaceKitPhidget | ( | ) | throws PhidgetException [inline] |
Class Constructor. Calling this opens a connection to the phidget21 C library creates an internal handle for this Phidget, ready to call open on.
PhidgetException | If there was a problem connecting to phidget21 or creating the internal handle. |
Definition at line 35 of file InterfaceKitPhidget.java.
final void com.phidgets.InterfaceKitPhidget.addInputChangeListener | ( | InputChangeListener | l | ) | [inline] |
Adds an input change listener. The input change handler is a method that will be called when an input on this Interface Kit has changed.
There is no limit on the number of input change handlers that can be registered for a particular Phidget.
l | An implemetation of the InputChangeListener interface |
Definition at line 246 of file InterfaceKitPhidget.java.
final void com.phidgets.InterfaceKitPhidget.addOutputChangeListener | ( | OutputChangeListener | l | ) | [inline] |
Adds an output change listener. The output change handler is a method that will be called when an output on this Interface Kit has changed.
There is no limit on the number of output change handlers that can be registered for a particular Phidget.
l | An implemetation of the OutputChangeListener interface |
Definition at line 284 of file InterfaceKitPhidget.java.
final void com.phidgets.InterfaceKitPhidget.addSensorChangeListener | ( | SensorChangeListener | l | ) | [inline] |
Adds a sensor change listener. The sensor change handler is a method that will be called when a sensor on this Interface Kit has changed by at least the Trigger that has been set for this sensor.
There is no limit on the number of sensor change handlers that can be registered for a particular Phidget.
l | An implemetation of the SensorChangeListener interface |
Definition at line 322 of file InterfaceKitPhidget.java.
static native long com.phidgets.InterfaceKitPhidget.create | ( | ) | throws PhidgetException [static, private] |
final void com.phidgets.InterfaceKitPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 229 of file InterfaceKitPhidget.java.
native void com.phidgets.InterfaceKitPhidget.enableInputChangeEvents | ( | boolean | b | ) | [private] |
native void com.phidgets.InterfaceKitPhidget.enableOutputChangeEvents | ( | boolean | b | ) | [private] |
native void com.phidgets.InterfaceKitPhidget.enableSensorChangeEvents | ( | boolean | b | ) | [private] |
void com.phidgets.InterfaceKitPhidget.fireInputChange | ( | InputChangeEvent | e | ) | [inline, private] |
Definition at line 263 of file InterfaceKitPhidget.java.
void com.phidgets.InterfaceKitPhidget.fireOutputChange | ( | OutputChangeEvent | e | ) | [inline, private] |
Definition at line 301 of file InterfaceKitPhidget.java.
void com.phidgets.InterfaceKitPhidget.fireSensorChange | ( | SensorChangeEvent | e | ) | [inline, private] |
Definition at line 339 of file InterfaceKitPhidget.java.
native int com.phidgets.InterfaceKitPhidget.getDataRate | ( | int | index | ) | throws PhidgetException |
Returns the data rate for a sensor, in milliseconds.
index | Index of the sensor |
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 int com.phidgets.InterfaceKitPhidget.getDataRateMax | ( | int | index | ) | throws PhidgetException |
Returns the maximum data rate for a sensor, in milliseconds.
index | Index of the input |
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 int com.phidgets.InterfaceKitPhidget.getDataRateMin | ( | int | index | ) | throws PhidgetException |
Returns the minimum data rate for a sensor, in milliseconds.
index | Index of the input |
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 int com.phidgets.InterfaceKitPhidget.getInputCount | ( | ) | throws PhidgetException |
Returns the number of ditigal inputs on this Interface Kit. Not all interface kits have the same number of digital inputs, and some don't have any digital inputs at all.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native boolean com.phidgets.InterfaceKitPhidget.getInputState | ( | int | index | ) | throws PhidgetException |
Returns the state of a digital input. Digital inputs read True where they are activated and false when they are in their default state.
Be sure to check getInputCount first if you are unsure as to the number of inputs, so as not to set an Index that is out of range.
index | Index of the input |
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 int com.phidgets.InterfaceKitPhidget.getOutputCount | ( | ) | throws PhidgetException |
Returns the number of digital outputs on this Interface Kit. Not all interface kits have the same number of digital outputs, and some don't have any digital outputs at all.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native boolean com.phidgets.InterfaceKitPhidget.getOutputState | ( | int | index | ) | throws PhidgetException |
Returns the state of a digital output. Depending on the Phidget, this value may be either the value that you last wrote out to the Phidget, or the value that the Phidget last returned. This is because some Phidgets return their output state and others do not. This means that with some devices, reading the output state of a pin directly after setting it, may not return the value that you just set.
Be sure to check getOutputCount first if you are unsure as to the number of outputs, so as not to attempt to get an Index that is out of range.
index | Index of the output |
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 boolean com.phidgets.InterfaceKitPhidget.getRatiometric | ( | ) | throws PhidgetException |
Gets the ratiometric state for the analog sensors
PhidgetException | If this Phidget is not opened and attached, or if this phidget does not support ratiometric. See open for information on determining if a device is attached. |
native int com.phidgets.InterfaceKitPhidget.getSensorChangeTrigger | ( | int | index | ) | throws PhidgetException |
Returns the change trigger for an analog input. This is the ammount that an inputs must change between successive SensorChangeEvents. This is based on the 0-1000 range provided by getSensorValue. This value is by default set to 10 for most Interface Kits with analog inputs.
index | Index of the sensor |
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 int com.phidgets.InterfaceKitPhidget.getSensorCount | ( | ) | throws PhidgetException |
Returns the number of analog inputs on the Interface Kit. Not all interface kits have the same number of analog inputs, and some don't have any analog inputs at all.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native int com.phidgets.InterfaceKitPhidget.getSensorRawValue | ( | int | index | ) | throws PhidgetException |
Returns the raw value of a analog input. This is a more accurate version of getSensorValue. The valid range is 0-4095. Note however that the analog outputs on the Interface Kit 8/8/8 are only 10-bit values and this value represents an oversampling to 12-bit.
index | Index of the sensor |
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 int com.phidgets.InterfaceKitPhidget.getSensorValue | ( | int | index | ) | throws PhidgetException |
Returns the value of a analog input. The analog inputs are where analog sensors are attached on the InterfaceKit 8/8/8. On the Linear and Circular touch sensor Phidgets, analog input 0 represents position on the slider.
The valid range is 0-1000. In the case of a sensor, this value can be converted to an actual sensor value using the formulas provided here: http://www.phidgets.com/documentation/Sensors.pdf
index | Index of the sensor |
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. |
final void com.phidgets.InterfaceKitPhidget.removeInputChangeListener | ( | InputChangeListener | l | ) | [inline] |
Removes an input change listener. This will remove a previously added input change listener.
Definition at line 256 of file InterfaceKitPhidget.java.
final void com.phidgets.InterfaceKitPhidget.removeOutputChangeListener | ( | OutputChangeListener | l | ) | [inline] |
Removes an output change listener. This will remove a previously added output change listener.
Definition at line 294 of file InterfaceKitPhidget.java.
final void com.phidgets.InterfaceKitPhidget.removeSensorChangeListener | ( | SensorChangeListener | l | ) | [inline] |
Removes a sensor change listener. This will remove a previously added sensor change listener.
Definition at line 332 of file InterfaceKitPhidget.java.
native void com.phidgets.InterfaceKitPhidget.setDataRate | ( | int | index, |
int | newVal | ||
) | throws PhidgetException |
Sets the data rate of a sensor, in milliseconds.
index | Input |
newVal | data rate |
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 void com.phidgets.InterfaceKitPhidget.setOutputState | ( | int | index, |
boolean | newVal | ||
) | throws PhidgetException |
Sets the state of a digital output. Setting this to true will activate the output, False is the default state.
index | Index of the output |
newVal | State to set the output to |
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 void com.phidgets.InterfaceKitPhidget.setRatiometric | ( | boolean | state | ) | throws PhidgetException |
Sets the ratiometric state for the analog inputs. The default is for ratiometric to be set on and this is appropriate for most sensors.
state | State |
PhidgetException | If this Phidget is not opened and attached, or if this Phidget does not support ratiometric See open for information on determining if a device is attached. |
native void com.phidgets.InterfaceKitPhidget.setSensorChangeTrigger | ( | int | index, |
int | newVal | ||
) | throws PhidgetException |
Sets the change trigger for an analog input. This is the ammount that an inputs must change between successive SensorChangeEvents. This is based on the 0-1000 range provided by getSensorValue. This value is by default set to 10 for most Interface Kits with analog inputs.
index | Input |
newVal | Value |
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.InterfaceKitPhidget.inputChangeListeners = new LinkedList() [private] |
Definition at line 235 of file InterfaceKitPhidget.java.
long com.phidgets.InterfaceKitPhidget.nativeInputChangeHandler = 0 [private] |
Definition at line 236 of file InterfaceKitPhidget.java.
long com.phidgets.InterfaceKitPhidget.nativeOutputChangeHandler = 0 [private] |
Definition at line 274 of file InterfaceKitPhidget.java.
long com.phidgets.InterfaceKitPhidget.nativeSensorChangeHandler = 0 [private] |
Definition at line 312 of file InterfaceKitPhidget.java.
LinkedList com.phidgets.InterfaceKitPhidget.outputChangeListeners = new LinkedList() [private] |
Definition at line 273 of file InterfaceKitPhidget.java.
LinkedList com.phidgets.InterfaceKitPhidget.sensorChangeListeners = new LinkedList() [private] |
Definition at line 311 of file InterfaceKitPhidget.java.