diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-05-09 00:47:30 +0100 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-05-09 00:47:30 +0100 |
commit | 260123716172d33f44bdc0e4e5422554d139215c (patch) | |
tree | 840e8e6387b96bd6f9afe3ffebc19c781a112f1b /Java/com/phidgets | |
parent | 0b624384cd52be20e61284551d832b499d7b7707 (diff) | |
download | libphidget21-260123716172d33f44bdc0e4e5422554d139215c.tar.gz |
Imported Upstream version 2.1.8.20120507upstream/2.1.8.20120507
Diffstat (limited to 'Java/com/phidgets')
-rw-r--r-- | Java/com/phidgets/AdvancedServoPhidget.java | 2 | ||||
-rw-r--r-- | Java/com/phidgets/Dictionary.java | 2 | ||||
-rw-r--r-- | Java/com/phidgets/IRPhidget.java | 478 | ||||
-rw-r--r-- | Java/com/phidgets/Manager.java | 4 | ||||
-rw-r--r-- | Java/com/phidgets/Phidget.java | 2 | ||||
-rw-r--r-- | Java/com/phidgets/PhidgetException.java | 2 |
6 files changed, 245 insertions, 245 deletions
diff --git a/Java/com/phidgets/AdvancedServoPhidget.java b/Java/com/phidgets/AdvancedServoPhidget.java index 1aa485a..db33e2a 100644 --- a/Java/com/phidgets/AdvancedServoPhidget.java +++ b/Java/com/phidgets/AdvancedServoPhidget.java @@ -314,7 +314,7 @@ public final class AdvancedServoPhidget extends Phidget * Sets the speed ramping state. * <p> * Disable speed ramping to disable velocity and acceleration control. With speed ramping disabled, the servo will be sent to - * the desired position immediately upon recieving the command. This is how the regular Phidget Servo Controller works. + * the desired position immediately upon receiving the command. This is how the regular Phidget Servo Controller works. * <p> * This is turned on by default. * diff --git a/Java/com/phidgets/Dictionary.java b/Java/com/phidgets/Dictionary.java index 0afde5e..211bdfc 100644 --- a/Java/com/phidgets/Dictionary.java +++ b/Java/com/phidgets/Dictionary.java @@ -228,7 +228,7 @@ public class Dictionary } /** * Closes this Dictionary. - * This will shut down all threads dealing with this Dictionary and you won't recieve any more events. + * This will shut down all threads dealing with this Dictionary and you won't receive any more events. * * @throws PhidgetException If this Dictionary is not opened. */ diff --git a/Java/com/phidgets/IRPhidget.java b/Java/com/phidgets/IRPhidget.java index 8418d74..6a1d198 100644 --- a/Java/com/phidgets/IRPhidget.java +++ b/Java/com/phidgets/IRPhidget.java @@ -1,239 +1,239 @@ -
-/*
- * 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.
- *
- * @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 recieved 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 recieved.
- * <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);
-}
+ +/* + * 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. + * + * @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); +} diff --git a/Java/com/phidgets/Manager.java b/Java/com/phidgets/Manager.java index 7e7cafb..d0e5f85 100644 --- a/Java/com/phidgets/Manager.java +++ b/Java/com/phidgets/Manager.java @@ -64,7 +64,7 @@ public class Manager /** * The default constructor. Creating a Phidget Manager object will initialize the * attach and detach handlers internally, but {@link #open() open} still needs to be called - * to actually recieve event notifications. + * to actually receive event notifications. */ public Manager() throws PhidgetException { @@ -195,7 +195,7 @@ public class Manager /** * Shuts down the Phidget Manager. This method should be called to close down the Phidget Manager. - * Events will no longer be recieved. This method gets calledd automatically when the class is + * Events will no longer be received. This method gets called automatically when the class is * destroyed so calling it is not required. */ public final void close() throws PhidgetException { diff --git a/Java/com/phidgets/Phidget.java b/Java/com/phidgets/Phidget.java index e2d611c..444779a 100644 --- a/Java/com/phidgets/Phidget.java +++ b/Java/com/phidgets/Phidget.java @@ -675,7 +675,7 @@ public class Phidget /** * Closes this Phidget. - * This will shut down all threads dealing with this Phidget and you won't recieve any more events. + * This will shut down all threads dealing with this Phidget and you won't receive any more events. * * @throws PhidgetException If this Phidget is not opened. */ diff --git a/Java/com/phidgets/PhidgetException.java b/Java/com/phidgets/PhidgetException.java index f33d345..1ace535 100644 --- a/Java/com/phidgets/PhidgetException.java +++ b/Java/com/phidgets/PhidgetException.java @@ -52,7 +52,7 @@ public class PhidgetException extends java.lang.Exception { /** * Invalid argument exception. "Invalid argument passed to function." * <P> - * This exception is thrown whenever a function recieves an unexpected null pointer, or a value that is out of range. ie setting a motor's speed to 101 when the maximum is 100. + * This exception is thrown whenever a function receives an unexpected null pointer, or a value that is out of range. ie setting a motor's speed to 101 when the maximum is 100. * <p> * This is returned by {@link #getErrorNumber getErrorNumber} */ |