Public Member Functions | |
final void | addEncoderPositionChangeListener (EncoderPositionChangeListener l) |
final void | addInputChangeListener (InputChangeListener l) |
EncoderPhidget () throws PhidgetException | |
native boolean | getEnabled (int index) throws PhidgetException |
native int | getEncoderCount () throws PhidgetException |
native int | getEncoderPosition (int index) throws PhidgetException |
native int | getIndexPosition (int index) throws PhidgetException |
native int | getInputCount () throws PhidgetException |
native boolean | getInputState (int index) throws PhidgetException |
native int | getPosition (int index) throws PhidgetException |
final void | removeEncoderPositionChangeListener (EncoderPositionChangeListener l) |
final void | removeInputChangeListener (InputChangeListener l) |
native void | setEnabled (int index, boolean state) throws PhidgetException |
native void | setEncoderPosition (int index, int position) throws PhidgetException |
native void | setPosition (int index, int position) throws PhidgetException |
Private Member Functions | |
final void | enableDeviceSpecificEvents (boolean b) |
native void | enableEncoderPositionChangeEvents (boolean b) |
native void | enableInputChangeEvents (boolean b) |
void | fireEncoderPositionChange (EncoderPositionChangeEvent e) |
void | fireInputChange (InputChangeEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
LinkedList | encoderPositionChangeListeners = new LinkedList () |
LinkedList | inputChangeListeners = new LinkedList () |
long | nativeEncoderPositionChangeHandler = 0 |
long | nativeInputChangeHandler = 0 |
This class represents a Phidget Encoder. All methods to read encoder data from an encoder are implemented in this class.
Phidget Encoder boards generally support 1 or more encoders with 0 or more digital inputs. Both high speed optical and low speed mechanical encoders are supported with this API.
Definition at line 19 of file EncoderPhidget.java.
com.phidgets.EncoderPhidget.EncoderPhidget | ( | ) | throws PhidgetException [inline] |
Definition at line 21 of file EncoderPhidget.java.
final void com.phidgets.EncoderPhidget.addEncoderPositionChangeListener | ( | EncoderPositionChangeListener | l | ) | [inline] |
Adds a position change listener. The position change handler is a method that will be called when the position of an encoder changes. The position change event provides data about how many ticks have occured, and how much time has passed since the last position change event, but does not contain an absolute position. This can be obtained from getEncoderPosition.
There is no limit on the number of position change handlers that can be registered for a particular Phidget.
l | An implemetation of the EncoderPositionChangeListener interface |
Definition at line 119 of file EncoderPhidget.java.
final void com.phidgets.EncoderPhidget.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 Encoder board 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 150 of file EncoderPhidget.java.
static native long com.phidgets.EncoderPhidget.create | ( | ) | throws PhidgetException [static, private] |
final void com.phidgets.EncoderPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 104 of file EncoderPhidget.java.
native void com.phidgets.EncoderPhidget.enableEncoderPositionChangeEvents | ( | boolean | b | ) | [private] |
native void com.phidgets.EncoderPhidget.enableInputChangeEvents | ( | boolean | b | ) | [private] |
void com.phidgets.EncoderPhidget.fireEncoderPositionChange | ( | EncoderPositionChangeEvent | e | ) | [inline, private] |
Definition at line 133 of file EncoderPhidget.java.
void com.phidgets.EncoderPhidget.fireInputChange | ( | InputChangeEvent | e | ) | [inline, private] |
Definition at line 164 of file EncoderPhidget.java.
native boolean com.phidgets.EncoderPhidget.getEnabled | ( | int | index | ) | throws PhidgetException |
Returns the enabled state of an encoder. True indicated activated, False deactivated, which is the default.
index | index of the encoder |
PhidgetException | If this Phidget is not opened and attached, the index is out of range, or enable is not supported. See open for information on determining if a device is attached. |
native int com.phidgets.EncoderPhidget.getEncoderCount | ( | ) | throws PhidgetException |
Returns number of encoders. All current encoder boards support one encoder.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native int com.phidgets.EncoderPhidget.getEncoderPosition | ( | int | index | ) | throws PhidgetException |
native int com.phidgets.EncoderPhidget.getIndexPosition | ( | int | index | ) | throws PhidgetException |
Returns the last index position of an encoder. This is the position of the last index pulse. Not all encoders support index.
index | index of the encoder |
PhidgetException | If this Phidget is not opened and attached, if the index is out of range, of if index is not supported. See open for information on determining if a device is attached. |
native int com.phidgets.EncoderPhidget.getInputCount | ( | ) | throws PhidgetException |
Returns number of digital inputs. On the mechanical encoder this refers to the pushbutton. The high speed encoder does not have any digital inputs.
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native boolean com.phidgets.EncoderPhidget.getInputState | ( | int | index | ) | throws PhidgetException |
Returns the state of a digital input. On the mechanical encoder this refers to the pushbutton. The high speed encoder does not have any digital inputs. A value of true means that the input is active(the button is pushed).
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.EncoderPhidget.getPosition | ( | int | index | ) | throws PhidgetException |
Returns the position of an encoder. This is an absolute position as calcutated since the encoder was plugged in. This value can be reset to anything using setEncoderPosition.
index | index of the encoder |
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.EncoderPhidget.removeEncoderPositionChangeListener | ( | EncoderPositionChangeListener | l | ) | [inline] |
Definition at line 127 of file EncoderPhidget.java.
final void com.phidgets.EncoderPhidget.removeInputChangeListener | ( | InputChangeListener | l | ) | [inline] |
Definition at line 158 of file EncoderPhidget.java.
native void com.phidgets.EncoderPhidget.setEnabled | ( | int | index, |
boolean | state | ||
) | throws PhidgetException |
Sets the enabled state of an encoder. True indicated activated, False deactivated, which is the default.
index | index of the encoder |
state | desired state |
PhidgetException | If this Phidget is not opened and attached, the index is out of range, or enable is not supported. See open for information on determining if a device is attached. |
native void com.phidgets.EncoderPhidget.setEncoderPosition | ( | int | index, |
int | position | ||
) | throws PhidgetException |
native void com.phidgets.EncoderPhidget.setPosition | ( | int | index, |
int | position | ||
) | throws PhidgetException |
Sets the position of a specific encoder. This resets the internal position count for an encoder. This call in no way actually sends information to the device, as an absolute position is maintained only in the library. After this call, position changes from the encoder will use the new value to calculate absolute position as reported by getEncoderPosition.
index | index of the encoder |
position | new position for this encoder. |
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.EncoderPhidget.encoderPositionChangeListeners = new LinkedList () [private] |
Definition at line 125 of file EncoderPhidget.java.
LinkedList com.phidgets.EncoderPhidget.inputChangeListeners = new LinkedList () [private] |
Definition at line 156 of file EncoderPhidget.java.
long com.phidgets.EncoderPhidget.nativeEncoderPositionChangeHandler = 0 [private] |
Definition at line 126 of file EncoderPhidget.java.
long com.phidgets.EncoderPhidget.nativeInputChangeHandler = 0 [private] |
Definition at line 157 of file EncoderPhidget.java.