|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.InterfaceKitPhidget
public final class InterfaceKitPhidget
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 sensors. Inputs can be read and outputs can be set, and event handlers can be set for each of these.
See your hardware documentation for more information on the I/O specific to your Phidget.
Constructor Summary | |
---|---|
InterfaceKitPhidget()
Class Constructor. |
Method Summary | |
---|---|
void |
addInputChangeListener(InputChangeListener l)
Adds an input change listener. |
void |
addOutputChangeListener(OutputChangeListener l)
Adds an output change listener. |
void |
addSensorChangeListener(SensorChangeListener l)
Adds a sensor change listener. |
int |
getInputCount()
Returns the number of ditigal inputs on this Interface Kit. |
boolean |
getInputState(int index)
Returns the state of a digital input. |
int |
getOutputCount()
Returns the number of digital outputs on this Interface Kit. |
boolean |
getOutputState(int index)
Returns the state of a digital output. |
int |
getSensorChangeTrigger(int index)
Returns the change trigger for an analog input. |
int |
getSensorCount()
Returns the number of analog inputs on the Interface Kit. |
int |
getSensorRawValue(int index)
Returns the raw value of a analog input. |
int |
getSensorValue(int index)
Returns the value of a analog input. |
void |
removeInputChangeListener(InputChangeListener l)
Removes an input change listener. |
void |
removeOutputChangeListener(OutputChangeListener l)
Removes an output change listener. |
void |
removeSensorChangeListener(SensorChangeListener l)
Removes a sensor change listener. |
void |
setOutputState(int index,
boolean newVal)
Sets the state of a digital output. |
void |
setSensorChangeTrigger(int index,
int newVal)
Sets the change trigger for an analog input. |
Methods inherited from class com.phidgets.Phidget |
---|
addAttachListener, addDetachListener, addErrorListener, close, equals, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getTag, isAttached, open, openAny, removeAttachListener, removeDetachListener, removeErrorListener, setTag, toString, waitForAttachment |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InterfaceKitPhidget() throws PhidgetException
PhidgetException
- If there was a problem connecting to phidget21 or creating
the internal handle.Method Detail |
---|
public int getOutputCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public int getInputCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public int getSensorCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public boolean getInputState(int index) throws PhidgetException
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.public boolean getOutputState(int index) throws PhidgetException
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.public int getSensorValue(int index) throws PhidgetException
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.public int getSensorRawValue(int index) throws PhidgetException
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.public int getSensorChangeTrigger(int index) throws PhidgetException
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.public void setOutputState(int index, boolean newVal) throws PhidgetException
index
- Index of the outputnewVal
- 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.public void setSensorChangeTrigger(int index, int newVal) throws PhidgetException
index
- InputnewVal
- 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.public final void addInputChangeListener(InputChangeListener l)
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
interfacepublic final void removeInputChangeListener(InputChangeListener l)
public final void addOutputChangeListener(OutputChangeListener l)
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
interfacepublic final void removeOutputChangeListener(OutputChangeListener l)
public final void addSensorChangeListener(SensorChangeListener l)
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
interfacepublic final void removeSensorChangeListener(SensorChangeListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |