From 46bd2ba42d186a81d7ad7e4a55e03dd63b2d042f Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sun, 3 Mar 2013 19:30:43 +0000 Subject: Imported Upstream version 2.1.8.20121218 --- Java/com/phidgets/AccelerometerPhidget.java | 9 +- Java/com/phidgets/AdvancedServoPhidget.java | 8 +- Java/com/phidgets/EncoderPhidget.java | 7 +- Java/com/phidgets/IRPhidget.java | 477 ++++++++++++------------ Java/com/phidgets/LEDPhidget.java | 39 +- Java/com/phidgets/MotorControlPhidget.java | 7 +- Java/com/phidgets/PHSensorPhidget.java | 5 +- Java/com/phidgets/Phidget.java | 15 +- Java/com/phidgets/RFIDPhidget.java | 38 +- Java/com/phidgets/ServoPhidget.java | 5 +- Java/com/phidgets/SpatialPhidget.java | 5 +- Java/com/phidgets/StepperPhidget.java | 9 +- Java/com/phidgets/TemperatureSensorPhidget.java | 5 +- Java/com/phidgets/TextLCDPhidget.java | 5 +- Java/com/phidgets/TextLEDPhidget.java | 5 +- Java/com/phidgets/WeightSensorPhidget.java | 5 +- Java/com/phidgets/event/TagGainEvent.java | 18 +- Java/com/phidgets/event/TagLossEvent.java | 18 +- 18 files changed, 364 insertions(+), 316 deletions(-) (limited to 'Java/com') diff --git a/Java/com/phidgets/AccelerometerPhidget.java b/Java/com/phidgets/AccelerometerPhidget.java index 062ea6f..c0c82ae 100644 --- a/Java/com/phidgets/AccelerometerPhidget.java +++ b/Java/com/phidgets/AccelerometerPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -11,10 +11,9 @@ import com.phidgets.event.*; * This class represents a Phidget Accelerometer. All methods to read * acceleration data from an Accelerometer are implemented in this class.

- * The Phidget Accelerometer provides 2 or 3 axes of acceleration data, at anywhere from 2g to 10g - * sensitivity, depending on the specific revision. 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. + The Phidget Accelerometer provides 2 or 3 axes of acceleration data, at anywhere from 2g to 10g + sensitivity, depending on the specific revision. See your hardware documetation for more information. + They can measure both static (gravity) and dynamic acceleration. * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/AdvancedServoPhidget.java b/Java/com/phidgets/AdvancedServoPhidget.java index f66b924..db33e2a 100644 --- a/Java/com/phidgets/AdvancedServoPhidget.java +++ b/Java/com/phidgets/AdvancedServoPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -11,11 +11,9 @@ import com.phidgets.event.*; * This class represents a Phidget Advanced Servo Controller. All methods * to to control a motor controller and read back motor data are implemented in this class. *

- * The Phidget Advanced Servo Controller is able to control 1 or more servo motors. Motor acceleration + * The Phidget Advanced Servo Controller is able to control 1 or more servo motors. Motos acceleration * and Velocity are controllable. The number of servos that can be controlled depends on the - * version of the controller. 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. + * version of the controller. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/EncoderPhidget.java b/Java/com/phidgets/EncoderPhidget.java index 7430aec..1543bd3 100644 --- a/Java/com/phidgets/EncoderPhidget.java +++ b/Java/com/phidgets/EncoderPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -12,10 +12,7 @@ import com.phidgets.event.*; * 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. - * 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. + Both high speed optical and low speed mechanical encoders are supported with this API. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/IRPhidget.java b/Java/com/phidgets/IRPhidget.java index 6647eeb..3a11f70 100644 --- a/Java/com/phidgets/IRPhidget.java +++ b/Java/com/phidgets/IRPhidget.java @@ -1,242 +1,239 @@ - -/* - * Copyright 2012 Phidgets Inc. All rights reserved. - */ - -package com.phidgets; -import java.util.Iterator; -import java.util.LinkedList; + +/* + * Copyright 2010 Phidgets Inc. All rights reserved. + */ + +package com.phidgets; +import java.util.Iterator; +import java.util.LinkedList; import com.phidgets.event.*; -/** - * This class represents a Phidget IR. All methods - * to send and receive IR data are implemented in this class. - *

- * The Phidget IR Receiver-Transmitter can send and receive Consumer-IR signals. Ability to learn and re-transmit codes, - * as well as low-level access to raw data, is provided. - * 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. - * - * @author Phidgets Inc. +/** + * This class represents a Phidget IR. All methods + * to send and receive IR data are implemented in this class. + *

+ * The Phidget IR Receiver-Transmitter can send and receive Consumer-IR signals. Ability to learn and re-transmit codes, + * as well as low-level access to raw data, is provided. + * + * @author Phidgets Inc. */ -public final class IRPhidget extends Phidget -{ - public IRPhidget () throws PhidgetException - { - super (create ()); - } - private static native long create () throws PhidgetException; - - /** - * Represents a long space (greater then 327,670 microseconds) in raw data. - * This can be considered a period of no IR activity. This is used with {@link #readRaw readRaw} - */ - public static final int RAWDATA_LONGSPACE = 0x7fffffff; - - /** - * Transmits a code. - * @param code the code to transmit - * @param codeInfo the code specification - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native void transmit (IRCode code, IRCodeInfo codeInfo) throws PhidgetException; - /** - * Transmits a repeat. This needs to be called within the gap time of a transmit to be meaningful. - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native void transmitRepeat () throws PhidgetException; - /** - * Transmits raw data. - * @param data data in microseconds, must start and end with a pulse - * @param offset offset in the data array to start transmitting - * @param count number of elements of data to transmit - * @param gap gap size in microseconds - * @param carrierFrequency carrier frequency in kHz - * @param dutyCycle duty cycle in percent - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native void transmitRaw (int[]data, int offset, int count, int gap, int carrierFrequency, int dutyCycle) throws PhidgetException; - /** - * Transmits raw data. - * @param data data in microseconds, must start and end with a pulse - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public final void transmitRaw (int[]data) throws PhidgetException - { - transmitRaw (data, 0, data.length, 0, 0, 0); - } - /** - * Transmits raw data. - * @param data data in microseconds, must start and end with a pulse - * @param gap gap size in microseconds - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public final void transmitRaw (int[]data, int gap) throws PhidgetException - { - transmitRaw (data, 0, data.length, gap, 0, 0); - } - /** - * Transmits raw data. - * @param data data in microseconds, must start and end with a pulse - * @param offset offset in the data array to start transmitting - * @param count number of elements of data to transmit - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public final void transmitRaw (int[]data, int offset, int count) throws PhidgetException - { - transmitRaw (data, offset, count, 0, 0, 0); - } - /** - * Transmits raw data. - * @param data data in microseconds, must start and end with a pulse - * @param offset offset in the data array to start transmitting - * @param count number of elements of data to transmit - * @param gap gap size in microseconds - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public final void transmitRaw (int[]data, int offset, int count, int gap) throws PhidgetException - { - transmitRaw (data, offset, count, gap, 0, 0); - } - /** - * Reads raw data. Use {@link #RAWDATA_LONGSPACE RAWDATA_LONGSPACE} to detect gaps in IR data. - * @param buffer array into which data will be read. - * @param offset offset in data to start writing - * @param count maximum ammount of data to read - * @return ammount of data read - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native int readRaw (int[]buffer, int offset, int count) throws PhidgetException; - /** - * Reads raw data. Use {@link #RAWDATA_LONGSPACE RAWDATA_LONGSPACE} to detect gaps in IR data. - * @param buffer array into which data will be read. - * @return ammount of data read - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public final int readRaw (int[]buffer) throws PhidgetException - { - return readRaw (buffer, 0, buffer.length); - } - /** - * Returns the last received code. This is updated right after the code event returns. - * @return last code - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native IRCode getLastCode () throws PhidgetException; - /** - * Returns the last learned code. This is updated right after the learn event returns. - * @return last learned code - * @throws PhidgetException If this Phidget is not opened and attached. - * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. - */ - public native IRLearnedCode getLastLearnedCode () throws PhidgetException; - - private final void enableDeviceSpecificEvents (boolean b) - { - enableCodeEvents (b && codeListeners.size () > 0); - enableLearnEvents (b && learnListeners.size () > 0); - enableRawDataEvents (b && rawDataListeners.size () > 0); - } - /** - * Adds a code listener. The code handler is a method that will be called when a new code is - seen by the reader. The event is fired on each code, including repetitions. - *

- * There is no limit on the number of code handlers that can be registered for a particular Phidget. - * - * @param l An implemetation of the {@link com.phidgets.event.CodeListener CodeListener} interface - */ - public final void addCodeListener (CodeListener l) - { - synchronized (codeListeners) - { - codeListeners.add (l); - enableCodeEvents (true); - }} private LinkedList codeListeners = new LinkedList (); - private long nativeCodeHandler = 0; - public final void removeCodeListener (CodeListener l) - { - synchronized (codeListeners) - { - codeListeners.remove (l); - enableCodeEvents (codeListeners.size () > 0); - }} private void fireCode (CodeEvent e) - { - synchronized (codeListeners) - { - for (Iterator it = codeListeners.iterator (); it.hasNext ();) - ((CodeListener) it.next ()).code (e); - } - } - private native void enableCodeEvents (boolean b); - /** - * Adds a code learn listener. The learn handler is a method that will be called when a new code is - learned by the reader. This requires that the code be repeated several times. - *

- * There is no limit on the number of learn handlers that can be registered for a particular Phidget. - * - * @param l An implemetation of the {@link com.phidgets.event.LearnListener LearnListener} interface - */ - public final void addLearnListener (LearnListener l) - { - synchronized (learnListeners) - { - learnListeners.add (l); - enableLearnEvents (true); - }} private LinkedList learnListeners = new LinkedList (); - private long nativeLearnHandler = 0; - public final void removeLearnListener (LearnListener l) - { - synchronized (learnListeners) - { - learnListeners.remove (l); - enableLearnEvents (learnListeners.size () > 0); - }} private void fireLearn (LearnEvent e) - { - synchronized (learnListeners) - { - for (Iterator it = learnListeners.iterator (); it.hasNext ();) - ((LearnListener) it.next ()).learn (e); - } - } - private native void enableLearnEvents (boolean b); - /** - * Adds a rawData listener. The rawData handler is a method that will be called when a raw IR data is received. - *

- * There is no limit on the number of rawData handlers that can be registered for a particular Phidget. - * - * @param l An implemetation of the {@link com.phidgets.event.RawDataListener RawDataListener} interface - */ - public final void addRawDataListener (RawDataListener l) - { - synchronized (rawDataListeners) - { - rawDataListeners.add (l); - enableRawDataEvents (true); - }} private LinkedList rawDataListeners = new LinkedList (); - private long nativeRawDataHandler = 0; - public final void removeRawDataListener (RawDataListener l) - { - synchronized (rawDataListeners) - { - rawDataListeners.remove (l); - enableRawDataEvents (rawDataListeners.size () > 0); - }} private void fireRawData (RawDataEvent e) - { - synchronized (rawDataListeners) - { - for (Iterator it = rawDataListeners.iterator (); it.hasNext ();) - ((RawDataListener) it.next ()).rawData (e); - } - } - private native void enableRawDataEvents (boolean b); -} +public final class IRPhidget extends Phidget +{ + public IRPhidget () throws PhidgetException + { + super (create ()); + } + private static native long create () throws PhidgetException; + + /** + * Represents a long space (greater then 327,670 microseconds) in raw data. + * This can be considered a period of no IR activity. This is used with {@link #readRaw readRaw} + */ + public static final int RAWDATA_LONGSPACE = 0x7fffffff; + + /** + * Transmits a code. + * @param code the code to transmit + * @param codeInfo the code specification + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native void transmit (IRCode code, IRCodeInfo codeInfo) throws PhidgetException; + /** + * Transmits a repeat. This needs to be called within the gap time of a transmit to be meaningful. + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native void transmitRepeat () throws PhidgetException; + /** + * Transmits raw data. + * @param data data in microseconds, must start and end with a pulse + * @param offset offset in the data array to start transmitting + * @param count number of elements of data to transmit + * @param gap gap size in microseconds + * @param carrierFrequency carrier frequency in kHz + * @param dutyCycle duty cycle in percent + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native void transmitRaw (int[]data, int offset, int count, int gap, int carrierFrequency, int dutyCycle) throws PhidgetException; + /** + * Transmits raw data. + * @param data data in microseconds, must start and end with a pulse + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public final void transmitRaw (int[]data) throws PhidgetException + { + transmitRaw (data, 0, data.length, 0, 0, 0); + } + /** + * Transmits raw data. + * @param data data in microseconds, must start and end with a pulse + * @param gap gap size in microseconds + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public final void transmitRaw (int[]data, int gap) throws PhidgetException + { + transmitRaw (data, 0, data.length, gap, 0, 0); + } + /** + * Transmits raw data. + * @param data data in microseconds, must start and end with a pulse + * @param offset offset in the data array to start transmitting + * @param count number of elements of data to transmit + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public final void transmitRaw (int[]data, int offset, int count) throws PhidgetException + { + transmitRaw (data, offset, count, 0, 0, 0); + } + /** + * Transmits raw data. + * @param data data in microseconds, must start and end with a pulse + * @param offset offset in the data array to start transmitting + * @param count number of elements of data to transmit + * @param gap gap size in microseconds + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public final void transmitRaw (int[]data, int offset, int count, int gap) throws PhidgetException + { + transmitRaw (data, offset, count, gap, 0, 0); + } + /** + * Reads raw data. Use {@link #RAWDATA_LONGSPACE RAWDATA_LONGSPACE} to detect gaps in IR data. + * @param buffer array into which data will be read. + * @param offset offset in data to start writing + * @param count maximum ammount of data to read + * @return ammount of data read + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native int readRaw (int[]buffer, int offset, int count) throws PhidgetException; + /** + * Reads raw data. Use {@link #RAWDATA_LONGSPACE RAWDATA_LONGSPACE} to detect gaps in IR data. + * @param buffer array into which data will be read. + * @return ammount of data read + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public final int readRaw (int[]buffer) throws PhidgetException + { + return readRaw (buffer, 0, buffer.length); + } + /** + * Returns the last received code. This is updated right after the code event returns. + * @return last code + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native IRCode getLastCode () throws PhidgetException; + /** + * Returns the last learned code. This is updated right after the learn event returns. + * @return last learned code + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native IRLearnedCode getLastLearnedCode () throws PhidgetException; + + private final void enableDeviceSpecificEvents (boolean b) + { + enableCodeEvents (b && codeListeners.size () > 0); + enableLearnEvents (b && learnListeners.size () > 0); + enableRawDataEvents (b && rawDataListeners.size () > 0); + } + /** + * Adds a code listener. The code handler is a method that will be called when a new code is + seen by the reader. The event is fired on each code, including repetitions. + *

+ * There is no limit on the number of code handlers that can be registered for a particular Phidget. + * + * @param l An implemetation of the {@link com.phidgets.event.CodeListener CodeListener} interface + */ + public final void addCodeListener (CodeListener l) + { + synchronized (codeListeners) + { + codeListeners.add (l); + enableCodeEvents (true); + }} private LinkedList codeListeners = new LinkedList (); + private long nativeCodeHandler = 0; + public final void removeCodeListener (CodeListener l) + { + synchronized (codeListeners) + { + codeListeners.remove (l); + enableCodeEvents (codeListeners.size () > 0); + }} private void fireCode (CodeEvent e) + { + synchronized (codeListeners) + { + for (Iterator it = codeListeners.iterator (); it.hasNext ();) + ((CodeListener) it.next ()).code (e); + } + } + private native void enableCodeEvents (boolean b); + /** + * Adds a code learn listener. The learn handler is a method that will be called when a new code is + learned by the reader. This requires that the code be repeated several times. + *

+ * There is no limit on the number of learn handlers that can be registered for a particular Phidget. + * + * @param l An implemetation of the {@link com.phidgets.event.LearnListener LearnListener} interface + */ + public final void addLearnListener (LearnListener l) + { + synchronized (learnListeners) + { + learnListeners.add (l); + enableLearnEvents (true); + }} private LinkedList learnListeners = new LinkedList (); + private long nativeLearnHandler = 0; + public final void removeLearnListener (LearnListener l) + { + synchronized (learnListeners) + { + learnListeners.remove (l); + enableLearnEvents (learnListeners.size () > 0); + }} private void fireLearn (LearnEvent e) + { + synchronized (learnListeners) + { + for (Iterator it = learnListeners.iterator (); it.hasNext ();) + ((LearnListener) it.next ()).learn (e); + } + } + private native void enableLearnEvents (boolean b); + /** + * Adds a rawData listener. The rawData handler is a method that will be called when a raw IR data is received. + *

+ * There is no limit on the number of rawData handlers that can be registered for a particular Phidget. + * + * @param l An implemetation of the {@link com.phidgets.event.RawDataListener RawDataListener} interface + */ + public final void addRawDataListener (RawDataListener l) + { + synchronized (rawDataListeners) + { + rawDataListeners.add (l); + enableRawDataEvents (true); + }} private LinkedList rawDataListeners = new LinkedList (); + private long nativeRawDataHandler = 0; + public final void removeRawDataListener (RawDataListener l) + { + synchronized (rawDataListeners) + { + rawDataListeners.remove (l); + enableRawDataEvents (rawDataListeners.size () > 0); + }} private void fireRawData (RawDataEvent e) + { + synchronized (rawDataListeners) + { + for (Iterator it = rawDataListeners.iterator (); it.hasNext ();) + ((RawDataListener) it.next ()).rawData (e); + } + } + private native void enableRawDataEvents (boolean b); +} diff --git a/Java/com/phidgets/LEDPhidget.java b/Java/com/phidgets/LEDPhidget.java index a1530f3..d26ce90 100644 --- a/Java/com/phidgets/LEDPhidget.java +++ b/Java/com/phidgets/LEDPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -16,9 +16,6 @@ import com.phidgets.event.*; so this number is not absolute.

LEDs can be controlled individually, at brightness levels from 0-100. - * 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. * * @author Phidgets Inc. */ @@ -120,6 +117,14 @@ public final class LEDPhidget extends Phidget * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. */ public native int getLEDCount () throws PhidgetException; + /** + * Deprecated. Use {@link #getBrightness getBrightness} + */ + public native int getDiscreteLED (int index) throws PhidgetException; + /** + * Deprecated. Use {@link #setBrightness setBrightness} + */ + public native void setDiscreteLED (int index, int brightness) throws PhidgetException; /** * Returns the brightness value of an LED. This value ranges from 0-100. * @param index LED @@ -127,17 +132,33 @@ public final class LEDPhidget extends Phidget * @throws PhidgetException If this Phidget is not opened and attached, or if the index is out of range. * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. */ - public native int getDiscreteLED (int index) throws PhidgetException; + public native double getBrightness (int index) throws PhidgetException; /** * Sets the brightness of an LED. - * Valid values are 0-100, with 0 being off and 100 being the brightest. This 0-100 value is converted internally to a - 6-bit value (0-63) so only 64 levels of brightness are actually possible. + * Valid values are 0-100, with 0 being off and 100 being the brightest. * @param index index of the LED * @param brightness desired brightness of this LED - * @throws PhidgetException If this Phidget is not opened and attached, or if the index of brightness value are out of range. + * @throws PhidgetException If this Phidget is not opened and attached, or if the index or brightness value are out of range. * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. */ - public native void setDiscreteLED (int index, int brightness) throws PhidgetException; + public native void setBrightness (int index, double brightness) throws PhidgetException; + /** + * Returns the current limit value of an LED. This value ranges from 0-80 mA. + * @param index LED + * @return current limit + * @throws PhidgetException If this Phidget is not opened and attached, or if the index is out of range. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native double getCurrentLimit (int index) throws PhidgetException; + /** + * Sets the current limit of an LED. + * Valid values are 0-80 mA. + * @param index index of the LED + * @param limit desired current limit of this LED + * @throws PhidgetException If this Phidget is not opened and attached, or if the index or limit value are out of range. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native void setCurrentLimit (int index, double limit) throws PhidgetException; private final void enableDeviceSpecificEvents (boolean b) { } diff --git a/Java/com/phidgets/MotorControlPhidget.java b/Java/com/phidgets/MotorControlPhidget.java index 19ce88c..8539b98 100644 --- a/Java/com/phidgets/MotorControlPhidget.java +++ b/Java/com/phidgets/MotorControlPhidget.java @@ -9,16 +9,13 @@ import java.util.LinkedList; import com.phidgets.event.*; /** * This class represents a Phidget Motor Controller. All Methods - * to to control a DC motor controller and read back motor data are implemented in this class. + * to to control a motor controller and read back motor data are implemented in this class.

The Motor Control Phidget is able to control 1 or more DC motors. Both speed and acceleration are controllable. Speed is controlled via PWM. The size of the motors that can be driven depends on the motor controller. See your hardware documentation for more information.

- The motor Controller boards also have 0 or more digital inputs. - * 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. + The motor Controller boards also has 0 or more digital inputs. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/PHSensorPhidget.java b/Java/com/phidgets/PHSensorPhidget.java index fa2d7ff..dc9ecf6 100644 --- a/Java/com/phidgets/PHSensorPhidget.java +++ b/Java/com/phidgets/PHSensorPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -12,9 +12,6 @@ import com.phidgets.event.*; * to read pH data from the PH Sensor are implemented in this class. *

* The Phidget PH Sensor provides one standard pH sensor input. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/Phidget.java b/Java/com/phidgets/Phidget.java index 5faf96a..c8d0cd3 100644 --- a/Java/com/phidgets/Phidget.java +++ b/Java/com/phidgets/Phidget.java @@ -204,8 +204,8 @@ public class Phidget /* These are all current devices */ public static final int PHIDID_ACCELEROMETER_3AXIS = 0x07E; public static final int PHIDID_ADVANCEDSERVO_1MOTOR = 0x082; - public static final int PHIDID_ANALOG_4OUTPUT = 0x037; public static final int PHIDID_ADVANCEDSERVO_8MOTOR = 0x03A; + public static final int PHIDID_ANALOG_4OUTPUT = 0x037; public static final int PHIDID_BIPOLAR_STEPPER_1MOTOR = 0x07B; public static final int PHIDID_BRIDGE_4INPUT = 0x03B; public static final int PHIDID_ENCODER_1ENCODER_1INPUT = 0x04B; @@ -216,23 +216,22 @@ public class Phidget public static final int PHIDID_INTERFACEKIT_0_0_4 = 0x040; public static final int PHIDID_INTERFACEKIT_0_0_8 = 0x081; public static final int PHIDID_INTERFACEKIT_0_16_16 = 0x044; + public static final int PHIDID_INTERFACEKIT_2_2_2 = 0x036; public static final int PHIDID_INTERFACEKIT_8_8_8 = 0x045; public static final int PHIDID_INTERFACEKIT_8_8_8_w_LCD = 0x07D; public static final int PHIDID_IR = 0x04D; - public static final int PHIDID_LED_64 = 0x04A; public static final int PHIDID_LED_64_ADV = 0x04C; public static final int PHIDID_LINEAR_TOUCH = 0x076; + public static final int PHIDID_MOTORCONTROL_1MOTOR = 0x03E; public static final int PHIDID_MOTORCONTROL_HC_2MOTOR = 0x059; - public static final int PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT = 0x058; - public static final int PHIDID_MOTORCONTROL_1MOTOR = 0x03E; - public static final int PHIDID_PHSENSOR = 0x074; public static final int PHIDID_RFID_2OUTPUT = 0x031; + public static final int PHIDID_RFID_2OUTPUT_READ_WRITE = 0x034; public static final int PHIDID_ROTARY_TOUCH = 0x077; - public static final int PHIDID_SERVO_1MOTOR = 0x039; public static final int PHIDID_SPATIAL_ACCEL_3AXIS = 0x07F; public static final int PHIDID_SPATIAL_ACCEL_GYRO_COMPASS = 0x033; public static final int PHIDID_TEMPERATURESENSOR = 0x070; public static final int PHIDID_TEMPERATURESENSOR_4 = 0x032; + public static final int PHIDID_TEMPERATURESENSOR_IR = 0x03C; public static final int PHIDID_TEXTLCD_2x20_w_8_8_8 = 0x17D; public static final int PHIDID_TEXTLCD_ADAPTER = 0x03D; public static final int PHIDID_UNIPOLAR_STEPPER_4MOTOR = 0x07A; @@ -241,7 +240,11 @@ public class Phidget public static final int PHIDID_ACCELEROMETER_2AXIS = 0x071; public static final int PHIDID_INTERFACEKIT_0_8_8_w_LCD = 0x053; public static final int PHIDID_INTERFACEKIT_4_8_8 = 4; + public static final int PHIDID_LED_64 = 0x04A; + public static final int PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT = 0x058; + public static final int PHIDID_PHSENSOR = 0x074; public static final int PHIDID_RFID = 0x030; + public static final int PHIDID_SERVO_1MOTOR = 0x039; public static final int PHIDID_SERVO_1MOTOR_OLD = 2; public static final int PHIDID_SERVO_4MOTOR = 0x038; public static final int PHIDID_SERVO_4MOTOR_OLD = 3; diff --git a/Java/com/phidgets/RFIDPhidget.java b/Java/com/phidgets/RFIDPhidget.java index 20a0ee2..26f38a3 100644 --- a/Java/com/phidgets/RFIDPhidget.java +++ b/Java/com/phidgets/RFIDPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -12,10 +12,7 @@ import com.phidgets.event.*; * to read tags and set outputs on the RFID reader are implemented in this class. *

* The Phidget RFID reader can read one tag at a time. Both tag and tagloss event handlers are provided, - * as well as control over the antenna so that multiple readers can exist in close proximity without interference. - * 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. + * as well as control over the antenna so that multiple readers can exists in close proximity without interference. * * @author Phidgets Inc. */ @@ -26,6 +23,20 @@ public final class RFIDPhidget extends Phidget super (create ()); } private static native long create () throws PhidgetException; + + /** + * EM4100 (EM4102) 40-bit. This is used with {@link #getLastTagProtocol() getSgetLastTagProtocolcreenSize} and {@link #write(String, int, boolean) write} + */ + public static final int PHIDGET_RFID_PROTOCOL_EM4100 = 1; + /** + * ISO11785 FDX-B encoding (Animal ID). This is used with {@link #getLastTagProtocol() getSgetLastTagProtocolcreenSize} and {@link #write(String, int, boolean) write} + */ + public static final int PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B = 2; + /** + * PhidgetsTAG Protocol 24 character ASCII. This is used with {@link #getLastTagProtocol() getSgetLastTagProtocolcreenSize} and {@link #write(String, int, boolean) write} + */ + public static final int PHIDGET_RFID_PROTOCOL_PHIDGETS = 3; + /** * Returns the number of outputs. These are the outputs provided by the terminal block. * Older RFID readers do not have these outputs, and this method will return 0. @@ -89,6 +100,14 @@ public final class RFIDPhidget extends Phidget * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. */ public native String getLastTag () throws PhidgetException; + /** + * Returns the protocol of the last tag read. This method will only return a valid protocol after a tag has been seen. + * This method can be used even after a tag has been removed from the reader + * @return protocol + * @throws PhidgetException If this Phidget is not opened and attached. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native int getLastTagProtocol () throws PhidgetException; /** * Returns the state of whether or not a tag is being read by the reader. * True indicated that a tag is on (or near) the reader, false indicates that one is not. @@ -97,6 +116,15 @@ public final class RFIDPhidget extends Phidget * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. */ public native boolean getTagStatus () throws PhidgetException; + /** + * Writes a tag. + * @param tag tag string + * @param protocol tag protocol + * @param lock lock tag from futher writes + * @throws PhidgetException If this Phidget is not opened and attached, if the string is too malformed, or the protocol is invalid. + * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached. + */ + public native void write (String tag, int protocol, boolean lock) throws PhidgetException; private final void enableDeviceSpecificEvents (boolean b) { diff --git a/Java/com/phidgets/ServoPhidget.java b/Java/com/phidgets/ServoPhidget.java index f052b15..aa9f05f 100644 --- a/Java/com/phidgets/ServoPhidget.java +++ b/Java/com/phidgets/ServoPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -13,9 +13,6 @@ import com.phidgets.event.*; *

* The Phidget Sevo controller simply outputs varying widths of PWM, which is what * most servo motors take as an input driving signal. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/SpatialPhidget.java b/Java/com/phidgets/SpatialPhidget.java index 599f361..bec1de7 100644 --- a/Java/com/phidgets/SpatialPhidget.java +++ b/Java/com/phidgets/SpatialPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -11,9 +11,6 @@ import com.phidgets.event.*; * This class represents a Phidget Spatial. All methods for a PhidgetSpatial are implemented in this class.

The Phidget Spatial may provide up to 3 axes of acceleration data, 3 axes of angular rate data and 3 axes of magnetic field data. - * 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. * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/StepperPhidget.java b/Java/com/phidgets/StepperPhidget.java index aed6b1a..83fa772 100644 --- a/Java/com/phidgets/StepperPhidget.java +++ b/Java/com/phidgets/StepperPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -9,14 +9,11 @@ import java.util.LinkedList; import com.phidgets.event.*; /** * This class represents a Phidget Stepper Controller. All methods - * to control a stepper controller and read back stepper data are implemented in this class. + * to to control a stepper controller and read back stepper data are implemented in this class. *

* The Phidget Stepper is able to control 1 or more Stepper motors. Motor Acceleration and Velocity are - * controllable, and micro-stepping is used for bipolar motors. The type and number of motors that can be controlled + * controllable, and micro-stepping is used. The type and number of motors that can be controlled * depend on the Stepper Controller. Digital inputs are available on select Phidget Stepper Controllers. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/TemperatureSensorPhidget.java b/Java/com/phidgets/TemperatureSensorPhidget.java index 83ff326..baaa589 100644 --- a/Java/com/phidgets/TemperatureSensorPhidget.java +++ b/Java/com/phidgets/TemperatureSensorPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -16,9 +16,6 @@ import com.phidgets.event.*; * and calibrate the thermocouple sensed temperature. *

* Both the thermocouple and temperature IC temperatures can be read. Value are returned in degrees celcius. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/TextLCDPhidget.java b/Java/com/phidgets/TextLCDPhidget.java index 92c3790..ac4c500 100644 --- a/Java/com/phidgets/TextLCDPhidget.java +++ b/Java/com/phidgets/TextLCDPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2011 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -13,9 +13,6 @@ import com.phidgets.event.*; *

* The TextLCD Phidget consists of a Vacuum Fluorescent display that is capable of * displaying Standard as well as custom characters in multiple rows. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/TextLEDPhidget.java b/Java/com/phidgets/TextLEDPhidget.java index 45e2720..a2f39c8 100644 --- a/Java/com/phidgets/TextLEDPhidget.java +++ b/Java/com/phidgets/TextLEDPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -14,9 +14,6 @@ import com.phidgets.event.*; * The Text LED is a Phidget that displays text and numerals on LED * numeric display in rows. The number of rows and size of each row depends on * your configuration. - * 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. * * @author Phidgets Inc. */ diff --git a/Java/com/phidgets/WeightSensorPhidget.java b/Java/com/phidgets/WeightSensorPhidget.java index e1c5728..b2bd9e8 100644 --- a/Java/com/phidgets/WeightSensorPhidget.java +++ b/Java/com/phidgets/WeightSensorPhidget.java @@ -1,6 +1,6 @@ /* - * Copyright 2012 Phidgets Inc. All rights reserved. + * Copyright 2006 Phidgets Inc. All rights reserved. */ package com.phidgets; @@ -13,9 +13,6 @@ import com.phidgets.event.*; *

* The Phidget Weight Sensor is simply an electronic scale with a USB interface. * It provides one weight value, in kg. - * 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. * * @author Phidget Inc. */ diff --git a/Java/com/phidgets/event/TagGainEvent.java b/Java/com/phidgets/event/TagGainEvent.java index 6cb7a74..8639ae4 100644 --- a/Java/com/phidgets/event/TagGainEvent.java +++ b/Java/com/phidgets/event/TagGainEvent.java @@ -15,6 +15,7 @@ public class TagGainEvent { Phidget source; String value; + int protocol; /** * Class constructor. This is called internally by the phidget library when creating this event. @@ -26,6 +27,12 @@ public class TagGainEvent this.source = source; this.value = value; } + public TagGainEvent(Phidget source, String value, int protocol) + { + this.source = source; + this.value = value; + this.protocol = protocol; + } /** * Returns the source Phidget of this event. This is a reference to the Phidget object from which this @@ -39,7 +46,7 @@ public class TagGainEvent } /** - * Returns the gained tag. The tag is a 10 digit hex number represented as a string. + * Returns the gained tag. * * @return the gained tag */ @@ -47,6 +54,15 @@ public class TagGainEvent return value; } + /** + * Returns the protocol of the Tag that was lost. + * + * @return the lost tag protocol + */ + public int getProtocol() { + return protocol; + } + /** * Returns a string containing information about the event. * diff --git a/Java/com/phidgets/event/TagLossEvent.java b/Java/com/phidgets/event/TagLossEvent.java index ccca4fe..8dcd723 100644 --- a/Java/com/phidgets/event/TagLossEvent.java +++ b/Java/com/phidgets/event/TagLossEvent.java @@ -15,6 +15,7 @@ public class TagLossEvent { Phidget source; String value; + int protocol; /** * Class constructor. This is called internally by the phidget library when creating this event. @@ -26,6 +27,12 @@ public class TagLossEvent this.source = source; this.value = value; } + public TagLossEvent(Phidget source, String value, int protocol) + { + this.source = source; + this.value = value; + this.protocol = protocol; + } /** * Returns the source Phidget of this event. This is a reference to the Phidget object from which this @@ -39,7 +46,7 @@ public class TagLossEvent } /** - * Returns the Tag that was lost. This is a 10 digit hex number as a string. + * Returns the Tag that was lost. * * @return the lost tag */ @@ -47,6 +54,15 @@ public class TagLossEvent return value; } + /** + * Returns the protocol of the Tag that was lost. + * + * @return the lost tag protocol + */ + public int getProtocol() { + return protocol; + } + /** * Returns a string containing information about the event. * -- cgit v1.2.3