aboutsummaryrefslogtreecommitdiffstats
path: root/Java
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2013-03-03 19:30:43 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2013-03-03 19:30:43 +0000
commit477e8e9570cebe9152c011a76defd6e9ce21fac7 (patch)
tree257399dd5eb402a14de37452069e080662c5c1c3 /Java
parent827093b9a63335655c696d4beb3134613c4414e6 (diff)
parent46bd2ba42d186a81d7ad7e4a55e03dd63b2d042f (diff)
downloadlibphidget21-477e8e9570cebe9152c011a76defd6e9ce21fac7.tar.gz
Merge tag 'upstream/2.1.8.20121218'
Upstream version 2.1.8.20121218
Diffstat (limited to 'Java')
-rw-r--r--Java/com/phidgets/AccelerometerPhidget.java9
-rw-r--r--Java/com/phidgets/AdvancedServoPhidget.java8
-rw-r--r--Java/com/phidgets/EncoderPhidget.java7
-rw-r--r--Java/com/phidgets/IRPhidget.java477
-rw-r--r--Java/com/phidgets/LEDPhidget.java39
-rw-r--r--Java/com/phidgets/MotorControlPhidget.java7
-rw-r--r--Java/com/phidgets/PHSensorPhidget.java5
-rw-r--r--Java/com/phidgets/Phidget.java15
-rw-r--r--Java/com/phidgets/RFIDPhidget.java38
-rw-r--r--Java/com/phidgets/ServoPhidget.java5
-rw-r--r--Java/com/phidgets/SpatialPhidget.java5
-rw-r--r--Java/com/phidgets/StepperPhidget.java9
-rw-r--r--Java/com/phidgets/TemperatureSensorPhidget.java5
-rw-r--r--Java/com/phidgets/TextLCDPhidget.java5
-rw-r--r--Java/com/phidgets/TextLEDPhidget.java5
-rw-r--r--Java/com/phidgets/WeightSensorPhidget.java5
-rw-r--r--Java/com/phidgets/event/TagGainEvent.java18
-rw-r--r--Java/com/phidgets/event/TagLossEvent.java18
-rw-r--r--Java/com_phidgets_LEDPhidget.c8
-rw-r--r--Java/com_phidgets_LEDPhidget.h36
-rw-r--r--Java/com_phidgets_RFIDPhidget.c70
-rw-r--r--Java/com_phidgets_RFIDPhidget.h22
-rw-r--r--Java/phidget_jni.h1
23 files changed, 475 insertions, 342 deletions
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.
<p>
- * 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.
* <p>
- * 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.
<p>
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.
- * <p>
- * 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.
+ * <p>
+ * 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.
- * <p>
- * 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.
- * <p>
- * 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.
- * <p>
- * 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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.
<p>
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.
*/
@@ -121,23 +118,47 @@ public final class LEDPhidget extends Phidget
*/
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
* @return brightness
* @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.
<p>
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.
<p>
- 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.
* <p>
* 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.
* <p>
* 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.
@@ -90,6 +101,14 @@ public final class RFIDPhidget extends Phidget
*/
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.
* @return tag read state
@@ -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.*;
* <p>
* 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.
<p>
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.
* <p>
* 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.
* <p>
* 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.*;
* <p>
* 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.*;
* <p>
* 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
*/
@@ -48,6 +55,15 @@ public class TagGainEvent
}
/**
+ * 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.
*
* @return an informative event string
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
*/
@@ -48,6 +55,15 @@ public class TagLossEvent
}
/**
+ * 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.
*
* @return an informative event string
diff --git a/Java/com_phidgets_LEDPhidget.c b/Java/com_phidgets_LEDPhidget.c
index 20097b9..c5fb201 100644
--- a/Java/com_phidgets_LEDPhidget.c
+++ b/Java/com_phidgets_LEDPhidget.c
@@ -9,10 +9,14 @@ JNI_LOAD(accel, LED)
JNI_CREATE(LED)
JNI_INDEXED_GETFUNC(LED, DiscreteLED, DiscreteLED, jint)
JNI_INDEXED_SETFUNC(LED, DiscreteLED, DiscreteLED, jint)
+JNI_INDEXED_GETFUNC(LED, Brightness, Brightness, jdouble)
+JNI_INDEXED_SETFUNC(LED, Brightness, Brightness, jdouble)
+JNI_INDEXED_GETFUNC(LED, CurrentLimit__I, CurrentLimitIndexed, jdouble)
+JNI_INDEXED_SETFUNC(LED, CurrentLimit__ID, CurrentLimitIndexed, jdouble)
JNI_GETFUNC(LED, LEDCount, LEDCount, jint)
JNIEXPORT jint JNICALL
-Java_com_phidgets_LEDPhidget_getCurrentLimit(JNIEnv *env, jobject obj)
+Java_com_phidgets_LEDPhidget_getCurrentLimit__(JNIEnv *env, jobject obj)
{
CPhidgetLEDHandle h = (CPhidgetLEDHandle)(uintptr_t)
(*env)->GetLongField(env, obj, handle_fid);
@@ -22,7 +26,7 @@ Java_com_phidgets_LEDPhidget_getCurrentLimit(JNIEnv *env, jobject obj)
PH_THROW(error);
return (jint)v;
}
-JNI_SETFUNC(LED, CurrentLimit, CurrentLimit, jint)
+JNI_SETFUNC(LED, CurrentLimit__I, CurrentLimit, jint)
JNIEXPORT jint JNICALL
Java_com_phidgets_LEDPhidget_getVoltage(JNIEnv *env, jobject obj)
diff --git a/Java/com_phidgets_LEDPhidget.h b/Java/com_phidgets_LEDPhidget.h
index be631c8..0fe8e65 100644
--- a/Java/com_phidgets_LEDPhidget.h
+++ b/Java/com_phidgets_LEDPhidget.h
@@ -180,7 +180,7 @@ JNIEXPORT jlong JNICALL Java_com_phidgets_LEDPhidget_create
* Method: getCurrentLimit
* Signature: ()I
*/
-JNIEXPORT jint JNICALL Java_com_phidgets_LEDPhidget_getCurrentLimit
+JNIEXPORT jint JNICALL Java_com_phidgets_LEDPhidget_getCurrentLimit__
(JNIEnv *, jobject);
/*
@@ -188,7 +188,7 @@ JNIEXPORT jint JNICALL Java_com_phidgets_LEDPhidget_getCurrentLimit
* Method: setCurrentLimit
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_com_phidgets_LEDPhidget_setCurrentLimit
+JNIEXPORT void JNICALL Java_com_phidgets_LEDPhidget_setCurrentLimit__I
(JNIEnv *, jobject, jint);
/*
@@ -231,6 +231,38 @@ JNIEXPORT jint JNICALL Java_com_phidgets_LEDPhidget_getDiscreteLED
JNIEXPORT void JNICALL Java_com_phidgets_LEDPhidget_setDiscreteLED
(JNIEnv *, jobject, jint, jint);
+/*
+ * Class: com_phidgets_LEDPhidget
+ * Method: getBrightness
+ * Signature: (I)D
+ */
+JNIEXPORT jdouble JNICALL Java_com_phidgets_LEDPhidget_getBrightness
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: com_phidgets_LEDPhidget
+ * Method: setBrightness
+ * Signature: (ID)V
+ */
+JNIEXPORT void JNICALL Java_com_phidgets_LEDPhidget_setBrightness
+ (JNIEnv *, jobject, jint, jdouble);
+
+/*
+ * Class: com_phidgets_LEDPhidget
+ * Method: getCurrentLimit
+ * Signature: (I)D
+ */
+JNIEXPORT jdouble JNICALL Java_com_phidgets_LEDPhidget_getCurrentLimit__I
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: com_phidgets_LEDPhidget
+ * Method: setCurrentLimit
+ * Signature: (ID)V
+ */
+JNIEXPORT void JNICALL Java_com_phidgets_LEDPhidget_setCurrentLimit__ID
+ (JNIEnv *, jobject, jint, jdouble);
+
#ifdef __cplusplus
}
#endif
diff --git a/Java/com_phidgets_RFIDPhidget.c b/Java/com_phidgets_RFIDPhidget.c
index c20b8ad..cfd9b10 100644
--- a/Java/com_phidgets_RFIDPhidget.c
+++ b/Java/com_phidgets_RFIDPhidget.c
@@ -9,35 +9,33 @@ EVENT_VARS(tagGain, TagGain)
JNI_LOAD(rfid, RFID)
EVENT_VAR_SETUP(rfid, outputChange, OutputChange, IZ, V)
- EVENT_VAR_SETUP(rfid, tagLoss, TagLoss, Ljava/lang/String;, V)
- EVENT_VAR_SETUP(rfid, tagGain, TagGain, Ljava/lang/String;, V)
+ EVENT_VAR_SETUP(rfid, tagLoss, TagLoss, Ljava/lang/String;I, V)
+ EVENT_VAR_SETUP(rfid, tagGain, TagGain, Ljava/lang/String;I, V)
}
EVENT_HANDLER_INDEXED(RFID, outputChange, OutputChange,
CPhidgetRFID_set_OnOutputChange_Handler, int)
-static int CCONV tagLoss_handler (CPhidgetRFIDHandle h, void *arg, unsigned char *);
+static int CCONV tagLoss_handler (CPhidgetRFIDHandle h, void *arg, char *, CPhidgetRFID_Protocol);
JNIEXPORT void JNICALL Java_com_phidgets_RFIDPhidget_enableTagLossEvents (JNIEnv * env, jobject obj, jboolean b)
{
jlong gr = updateGlobalRef (env, obj, nativeTagLossHandler_fid, b);
CPhidgetRFIDHandle h = (CPhidgetRFIDHandle) (uintptr_t) (*env)->GetLongField (env, obj, handle_fid);
- CPhidgetRFID_set_OnTagLost_Handler (h, b ? tagLoss_handler : 0, (void *) (uintptr_t) gr);
+ CPhidgetRFID_set_OnTagLost2_Handler (h, b ? tagLoss_handler : 0, (void *) (uintptr_t) gr);
} static int CCONV
-tagLoss_handler (CPhidgetRFIDHandle h, void *arg, unsigned char *v)
+tagLoss_handler (CPhidgetRFIDHandle h, void *arg, char *v, CPhidgetRFID_Protocol proto)
{
JNIEnv *env;
jobject obj;
jobject tagLossEv;
- char stringbuffer[20];
jstring jb;
if ((*ph_vm)->AttachCurrentThread (ph_vm, (JNIEnvPtr) &env, ((void *) 0)))
JNI_ABORT_STDERR("Couldn't AttachCurrentThread");
obj = (jobject) arg;
- sprintf(stringbuffer, "%02x%02x%02x%02x%02x",v[0],v[1],v[2],v[3],v[4]);
- jb=(*env)->NewStringUTF(env, stringbuffer);
+ jb=(*env)->NewStringUTF(env, v);
- if (!(tagLossEv = (*env)->NewObject (env, tagLossEvent_class, tagLossEvent_cons, obj, jb)))
+ if (!(tagLossEv = (*env)->NewObject (env, tagLossEvent_class, tagLossEvent_cons, obj, jb, (int)proto)))
return -1;
(*env)->CallVoidMethod (env, obj, fireTagLoss_mid, tagLossEv);
(*env)->DeleteLocalRef (env, tagLossEv);
@@ -45,28 +43,26 @@ tagLoss_handler (CPhidgetRFIDHandle h, void *arg, unsigned char *v)
return 0;
}
-static int CCONV tagGain_handler (CPhidgetRFIDHandle h, void *arg, unsigned char *);
+static int CCONV tagGain_handler (CPhidgetRFIDHandle h, void *arg, char *, CPhidgetRFID_Protocol);
JNIEXPORT void JNICALL Java_com_phidgets_RFIDPhidget_enableTagGainEvents (JNIEnv * env, jobject obj, jboolean b)
{
jlong gr = updateGlobalRef (env, obj, nativeTagGainHandler_fid, b);
CPhidgetRFIDHandle h = (CPhidgetRFIDHandle) (uintptr_t) (*env)->GetLongField (env, obj, handle_fid);
- CPhidgetRFID_set_OnTag_Handler (h, b ? tagGain_handler : 0, (void *) (uintptr_t) gr);
+ CPhidgetRFID_set_OnTag2_Handler (h, b ? tagGain_handler : 0, (void *) (uintptr_t) gr);
} static int CCONV
-tagGain_handler (CPhidgetRFIDHandle h, void *arg, unsigned char *v)
+tagGain_handler (CPhidgetRFIDHandle h, void *arg, char *v, CPhidgetRFID_Protocol proto)
{
JNIEnv *env;
jobject obj;
jobject tagGainEv;
- char stringbuffer[20];
jstring jb;
if ((*ph_vm)->AttachCurrentThread (ph_vm, (JNIEnvPtr) &env, ((void *) 0)))
JNI_ABORT_STDERR("Couldn't AttachCurrentThread");
obj = (jobject) arg;
- sprintf(stringbuffer, "%02x%02x%02x%02x%02x",v[0],v[1],v[2],v[3],v[4]);
- jb=(*env)->NewStringUTF(env, stringbuffer);
+ jb=(*env)->NewStringUTF(env, v);
- if (!(tagGainEv = (*env)->NewObject (env, tagGainEvent_class, tagGainEvent_cons, obj, jb)))
+ if (!(tagGainEv = (*env)->NewObject (env, tagGainEvent_class, tagGainEvent_cons, obj, jb, (int)proto)))
return -1;
(*env)->CallVoidMethod (env, obj, fireTagGain_mid, tagGainEv);
(*env)->DeleteLocalRef (env, tagGainEv);
@@ -91,14 +87,44 @@ Java_com_phidgets_RFIDPhidget_getLastTag (JNIEnv *env, jobject obj)
CPhidgetRFIDHandle h = (CPhidgetRFIDHandle)(uintptr_t)
(*env)->GetLongField( env, obj, handle_fid);
int error;
- unsigned char buffer[11];
- char stringbuffer[20];
+ char *tag;
jstring jb;
- if ((error = CPhidgetRFID_getLastTag(h, (unsigned char *)&buffer)))
+ CPhidgetRFID_Protocol proto;
+ if ((error = CPhidgetRFID_getLastTag2(h, &tag, &proto)))
PH_THROW(error);
- sprintf(stringbuffer, "%02x%02x%02x%02x%02x",buffer[0],buffer[1],buffer[2],buffer[3],buffer[4]);
-
- jb=(*env)->NewStringUTF(env, stringbuffer);
+ jb=(*env)->NewStringUTF(env, tag);
return jb;
}
+
+JNIEXPORT jint JNICALL
+Java_com_phidgets_RFIDPhidget_getLastTagProtocol (JNIEnv *env, jobject obj)
+{
+ CPhidgetRFIDHandle h = (CPhidgetRFIDHandle)(uintptr_t)
+ (*env)->GetLongField( env, obj, handle_fid);
+ int error;
+ char *tag;
+ CPhidgetRFID_Protocol proto;
+ if ((error = CPhidgetRFID_getLastTag2(h, &tag, &proto)))
+ PH_THROW(error);
+
+ return (jint)proto;
+}
+
+JNIEXPORT void JNICALL Java_com_phidgets_RFIDPhidget_write
+ (JNIEnv *env, jobject obj, jstring tag, jint proto, jboolean lock)
+{
+ int error;
+
+ jboolean iscopy;
+ const char *tagString = (*env)->GetStringUTFChars(
+ env, tag, &iscopy);
+
+ CPhidgetRFIDHandle h = (CPhidgetRFIDHandle)(uintptr_t)
+ (*env)->GetLongField(env, obj, handle_fid);
+
+ if ((error = CPhidgetRFID_write(h, (char *)tagString, (CPhidgetRFID_Protocol)proto, (int)lock)))
+ PH_THROW(error);
+
+ (*env)->ReleaseStringUTFChars(env, tag, tagString);
+} \ No newline at end of file
diff --git a/Java/com_phidgets_RFIDPhidget.h b/Java/com_phidgets_RFIDPhidget.h
index d6a123e..c136a58 100644
--- a/Java/com_phidgets_RFIDPhidget.h
+++ b/Java/com_phidgets_RFIDPhidget.h
@@ -151,6 +151,12 @@ extern "C" {
#define com_phidgets_RFIDPhidget_PHIDCLASS_TEXTLED 16L
#undef com_phidgets_RFIDPhidget_PHIDCLASS_WEIGHTSENSOR
#define com_phidgets_RFIDPhidget_PHIDCLASS_WEIGHTSENSOR 17L
+#undef com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_EM4100
+#define com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_EM4100 1L
+#undef com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B
+#define com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_ISO11785_FDX_B 2L
+#undef com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_PHIDGETS
+#define com_phidgets_RFIDPhidget_PHIDGET_RFID_PROTOCOL_PHIDGETS 3L
/*
* Class: com_phidgets_RFIDPhidget
* Method: create
@@ -225,6 +231,14 @@ JNIEXPORT jstring JNICALL Java_com_phidgets_RFIDPhidget_getLastTag
/*
* Class: com_phidgets_RFIDPhidget
+ * Method: getLastTagProtocol
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_phidgets_RFIDPhidget_getLastTagProtocol
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_phidgets_RFIDPhidget
* Method: getTagStatus
* Signature: ()Z
*/
@@ -233,6 +247,14 @@ JNIEXPORT jboolean JNICALL Java_com_phidgets_RFIDPhidget_getTagStatus
/*
* Class: com_phidgets_RFIDPhidget
+ * Method: write
+ * Signature: (Ljava/lang/String;IZ)V
+ */
+JNIEXPORT void JNICALL Java_com_phidgets_RFIDPhidget_write
+ (JNIEnv *, jobject, jstring, jint, jboolean);
+
+/*
+ * Class: com_phidgets_RFIDPhidget
* Method: enableTagGainEvents
* Signature: (Z)V
*/
diff --git a/Java/phidget_jni.h b/Java/phidget_jni.h
index 2325fd0..61c675d 100644
--- a/Java/phidget_jni.h
+++ b/Java/phidget_jni.h
@@ -109,6 +109,7 @@ void com_phidgets_##Pname##Phidget_OnLoad(JNIEnv *env) \
if (!(eobj = (*env)->NewObject(env, ph_exception_class, ph_exception_cons, errno, edesc))) \
JNI_ABORT_STDERR("Couldn't get NewObject ph_exception_class"); \
(*env)->Throw(env, (jthrowable)eobj); \
+ (*env)->ExceptionClear(env); \
}
#define JNI_INDEXED_SETFUNC(pname, fname, lfname, type) \