Public Member Functions | |
final void | addFrequencyCounterCountListener (FrequencyCounterCountListener l) |
FrequencyCounterPhidget () throws PhidgetException | |
native boolean | getEnabled (int index) throws PhidgetException |
native int | getFilter (int index) throws PhidgetException |
native double | getFrequency (int index) throws PhidgetException |
native int | getFrequencyInputCount () throws PhidgetException |
native int | getTimeout (int index) throws PhidgetException |
native long | getTotalCount (int index) throws PhidgetException |
native long | getTotalTime (int index) throws PhidgetException |
final void | removeFrequencyCounterCountListener (FrequencyCounterCountListener l) |
native void | reset (int index) throws PhidgetException |
native void | setEnabled (int index, boolean state) throws PhidgetException |
native void | setFilter (int index, int type) throws PhidgetException |
native void | setTimeout (int index, int timeout) throws PhidgetException |
Static Public Attributes | |
static final int | PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_LOGIC_LEVEL = 2 |
static final int | PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_UNKNOWN = 3 |
static final int | PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_ZERO_CROSSING = 1 |
Private Member Functions | |
final void | enableDeviceSpecificEvents (boolean b) |
native void | enableFrequencyCounterCountEvents (boolean b) |
void | fireFrequencyCounterCount (FrequencyCounterCountEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
LinkedList | frequencyCounterCountListeners = new LinkedList () |
long | nativeFrequencyCounterCountHandler = 0 |
This class represents a Phidget Frequency Counter. All methods to read manipulate the Phidget Frequency Counter are implemented in this class. 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 20 of file FrequencyCounterPhidget.java.
com.phidgets.FrequencyCounterPhidget.FrequencyCounterPhidget | ( | ) | throws PhidgetException [inline] |
Definition at line 22 of file FrequencyCounterPhidget.java.
final void com.phidgets.FrequencyCounterPhidget.addFrequencyCounterCountListener | ( | FrequencyCounterCountListener | l | ) | [inline] |
Adds a count listener. The count handler is a method that will be called whenever some counts have been detected. This event will fire up to 31.25 times a second, depending on the pulse rate. The time is in microseconds and represents the amount of time in which the number of counts occured. This event can be used to calculate frequency independently of the phidget21 library frequency implementation. This event will fire with a count of 0 once, after the Timeout time has elapsed with no counts for a channel, to indicate 0 Hz.
There is no limit on the number of count handlers that can be registered for a particular Phidget.
l | An implemetation of the FrequencyCounterCountListener interface |
Definition at line 151 of file FrequencyCounterPhidget.java.
static native long com.phidgets.FrequencyCounterPhidget.create | ( | ) | throws PhidgetException [static, private] |
final void com.phidgets.FrequencyCounterPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 137 of file FrequencyCounterPhidget.java.
native void com.phidgets.FrequencyCounterPhidget.enableFrequencyCounterCountEvents | ( | boolean | b | ) | [private] |
void com.phidgets.FrequencyCounterPhidget.fireFrequencyCounterCount | ( | FrequencyCounterCountEvent | e | ) | [inline, private] |
Definition at line 165 of file FrequencyCounterPhidget.java.
native boolean com.phidgets.FrequencyCounterPhidget.getEnabled | ( | int | index | ) | throws PhidgetException |
Returns the enabled state on the specified channel. When the channel is disabled, it will no longer register counts. TotalTime and TotalCount properties will not be incremented until the channel is re-enabled.
index | Index of the channel |
PhidgetException | If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached. |
native int com.phidgets.FrequencyCounterPhidget.getFilter | ( | int | index | ) | throws PhidgetException |
Gets the channel filter mode. This controls the type of signal that the Frequency Counter will respond to - either a zero-centered or a logic-level signal.
The possible values for type are PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_ZERO_CROSSING, PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_LOGIC_LEVEL, PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_UNKNOWN
index | Index of the channel |
PhidgetException | If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached. |
native double com.phidgets.FrequencyCounterPhidget.getFrequency | ( | int | index | ) | throws PhidgetException |
Returns the last calcualted frequency on the specified channel, in Hz. This function will return 0 if the getTimeout value elapses without detecting a signal. Frequency is recalculated up to 31.25 times a second, depending on the pulse rate.
index | Index of the channel |
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.FrequencyCounterPhidget.getFrequencyInputCount | ( | ) | throws PhidgetException |
Returns the number of channels.
native int com.phidgets.FrequencyCounterPhidget.getTimeout | ( | int | index | ) | throws PhidgetException |
Returns the timeout value, in microseconds. This value is used to set the time to wait without detecting a signal before reporting 0 Hz. The valid range is 0.1 - 100 seconds(100,000 - 100,000,000 microseconds). 0.1 timeout represents the lowest frequency that will be measurable.
index | Index of the channel |
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 long com.phidgets.FrequencyCounterPhidget.getTotalCount | ( | int | index | ) | throws PhidgetException |
Returns the total number of pulses detected on the specified channel since the Phidget was opened, or since the last reset.
index | Index of the channel |
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 long com.phidgets.FrequencyCounterPhidget.getTotalTime | ( | int | index | ) | throws PhidgetException |
Returns the total elapsed tiem since Phidget was opened, or since the last reset, in microseconds. This time corresponds to the getTotalCount property.
index | Index of the channel |
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.FrequencyCounterPhidget.removeFrequencyCounterCountListener | ( | FrequencyCounterCountListener | l | ) | [inline] |
Definition at line 159 of file FrequencyCounterPhidget.java.
native void com.phidgets.FrequencyCounterPhidget.reset | ( | int | index | ) | throws PhidgetException |
Resets the getTotalCount and getTotalTime counters to 0 for the specified channel. For best performance, this should be called when the channel is disabled.
index | Index of the channel |
PhidgetException | If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached. |
native void com.phidgets.FrequencyCounterPhidget.setEnabled | ( | int | index, |
boolean | state | ||
) | throws PhidgetException |
Gets the enabled state on the specified channel. When the channel is disabled, it will no longer register counts. TotalTime and TotalCount properties will not be incremented until the channel is re-enabled.
index | Index of the channel |
state | new enabled state |
PhidgetException | If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached. |
native void com.phidgets.FrequencyCounterPhidget.setFilter | ( | int | index, |
int | type | ||
) | throws PhidgetException |
Sets the channel filter mode. This controls the type of signal that the Frequency Counter will respond to - either a zero-centered or a logic-level signal.
The possible values for type are PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_ZERO_CROSSING, PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_LOGIC_LEVEL, PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_UNKNOWN
index | Index of the channel |
type | new filter type |
PhidgetException | If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached. |
native void com.phidgets.FrequencyCounterPhidget.setTimeout | ( | int | index, |
int | timeout | ||
) | throws PhidgetException |
Sets the timeout value, in microseconds. This value is used to set the time to wait without detecting a signal before reporting 0 Hz. The valid range is 0.1 - 100 seconds(100,000 - 100,000,000 microseconds). 0.1 timeout represents the lowest frequency that will be measurable.
index | Index of the channel |
timeout | new timeout value |
PhidgetException | If this Phidget is not opened and attached, the index is out of range or the the timeout value is out of range. See open for information on determining if a device is attached. |
LinkedList com.phidgets.FrequencyCounterPhidget.frequencyCounterCountListeners = new LinkedList () [private] |
Definition at line 157 of file FrequencyCounterPhidget.java.
long com.phidgets.FrequencyCounterPhidget.nativeFrequencyCounterCountHandler = 0 [private] |
Definition at line 158 of file FrequencyCounterPhidget.java.
final int com.phidgets.FrequencyCounterPhidget.PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_LOGIC_LEVEL = 2 [static] |
Logic-Level Filter Type. This is used with getFilter and setFilter
Definition at line 34 of file FrequencyCounterPhidget.java.
final int com.phidgets.FrequencyCounterPhidget.PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_UNKNOWN = 3 [static] |
Unknown Filter Type. This is used with getFilter and setFilter
Definition at line 38 of file FrequencyCounterPhidget.java.
final int com.phidgets.FrequencyCounterPhidget.PHIDGET_FREQUENCYCOUNTER_FILTERTYPE_ZERO_CROSSING = 1 [static] |
Zero-Crossing Filter Type. This is used with getFilter and setFilter
Definition at line 30 of file FrequencyCounterPhidget.java.