Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
com.phidgets.EncoderPhidget Class Reference
Inheritance diagram for com.phidgets.EncoderPhidget:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

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.

Author:
Phidgets Inc.

Definition at line 19 of file EncoderPhidget.java.


Constructor & Destructor Documentation

Definition at line 21 of file EncoderPhidget.java.


Member Function Documentation

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.

Parameters:
lAn 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.

Parameters:
lAn 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.

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.

Parameters:
indexindex of the encoder
Returns:
state of the encoder
Exceptions:
PhidgetExceptionIf 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.

Returns number of encoders. All current encoder boards support one encoder.

Returns:
number of encoders
Exceptions:
PhidgetExceptionIf this Phidget is not opened and attached. See open for information on determining if a device is attached.

Returns the last index position of an encoder. This is the position of the last index pulse. Not all encoders support index.

Parameters:
indexindex of the encoder
Returns:
last index position of the encoder
Exceptions:
PhidgetExceptionIf 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.

Returns number of digital inputs. On the mechanical encoder this refers to the pushbutton. The high speed encoder does not have any digital inputs.

Returns:
number of inputs
Exceptions:
PhidgetExceptionIf 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).

Parameters:
indexindex of the input
Returns:
state of the input
Exceptions:
PhidgetExceptionIf 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.

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.

Parameters:
indexindex of the encoder
Returns:
position of the encoder
Exceptions:
PhidgetExceptionIf 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.

Parameters:
indexindex of the encoder
statedesired state
Exceptions:
PhidgetExceptionIf 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.

Parameters:
indexindex of the encoder
positionnew position for this encoder.
Exceptions:
PhidgetExceptionIf 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.

Member Data Documentation

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.

Definition at line 126 of file EncoderPhidget.java.

Definition at line 157 of file EncoderPhidget.java.


The documentation for this class was generated from the following file:


pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:22