summaryrefslogtreecommitdiffstats
path: root/Java/com/phidgets/macros
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-04-14 12:56:48 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2012-04-14 12:56:48 +0100
commit0b624384cd52be20e61284551d832b499d7b7707 (patch)
tree6f95a4bbef47abc9720b96c0722e8f632aef228a /Java/com/phidgets/macros
downloadlibphidget21-0b624384cd52be20e61284551d832b499d7b7707.tar.gz
Imported Upstream version 2.1.8.20120216upstream/2.1.8.20120216
Diffstat (limited to 'Java/com/phidgets/macros')
-rw-r--r--Java/com/phidgets/macros/BridgePhidget.jm171
1 files changed, 171 insertions, 0 deletions
diff --git a/Java/com/phidgets/macros/BridgePhidget.jm b/Java/com/phidgets/macros/BridgePhidget.jm
new file mode 100644
index 0000000..d2c2cf5
--- /dev/null
+++ b/Java/com/phidgets/macros/BridgePhidget.jm
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2011 Phidgets Inc. All rights reserved.
+ */
+
+ #include "javamacros.h"
+PACKAGEIMPORTS
+/**
+ * This class represents a Phidget Bridge. All methods
+ * to manipulate the Phidget Bridge are implemented in this class.
+ * <p>
+ *
+ * @author Phidgets Inc.
+ */
+CLASSDEF(Bridge)
+ /**
+ * 1 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_1 = 1;
+ /**
+ * 8 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_8 = 2;
+ /**
+ * 16 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_16 = 3;
+ /**
+ * 32 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_32 = 4;
+ /**
+ * 64 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_64 = 5;
+ /**
+ * 128 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_128 = 6;
+ /**
+ * Unknown Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
+ */
+ public static final int PHIDGET_BRIDGE_GAIN_UNKNOWN = 7;
+ /**
+ * Returns the number of bridges.
+ * @return Number of bridges
+ */
+ PUBLIC_NATIVE(int, getInputCount,)
+ /**
+ * Returns the value of the selected input, in mV/V. If the input is not enabled, an EPHIDGET_UNKNOWNVAL exception will be thrown. If the bridge is saturated
+ *, this will be equal to BridgeMax or BridgeMin and an error event will be fired - in this case, gain should be reduced if possible.
+ * @param index Index of the bridge
+ * @return bridge value
+ * @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, getBridgeValue, int index)
+ /**
+ * Returns the minimum value that the selected bridge can measure, in mV/V. This value will depend on the selected gain. At a gain of 1, BridgeMin == -1000 mV/V.
+ * @param index Index of the bridge
+ * @return minimum value
+ * @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, getBridgeMin, int index)
+ /**
+ * Returns the maximum value that the selected bridge can measure, in mV/V. This value will depend on the selected gain. At a gain of 1, BridgeMin == 1000 mV/V.
+ * @param index Index of the bridge
+ * @return maximum value
+ * @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, getBridgeMax, int index)
+ /**
+ * Returns the enabled state of the specified bridge. This applies power between +5v and Ground, and starts measuring the differential on the +/- pins. By default, all bridges are
+ * disabled, and need to be explicitly enabled on startup.
+ * @param index Index of the bridge
+ * @return state of the specified bridge
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(boolean, getEnabled, int index)
+ /**
+ * Sets the enabled state of the specified bridge. This applies power between +5v and Ground, and starts measuring the differential on the +/- pins. By default, all bridges are
+ * disabled, and need to be explicitly enabled on startup.
+ * @param index Index of the bridge
+ * @param state new state of the specified bridge
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(void, setEnabled, int index, boolean state)
+ /**
+ * Returns the gain for the selected bridge. Note that increasing the gains will reduce the measurable
+ * voltage difference by the gain factor, with +-1000 mV/V being the maximum, with no gain.
+ * The possible values for gain are {@link #PHIDGET_BRIDGE_GAIN_1 PHIDGET_BRIDGE_GAIN_1},
+ * {@link #PHIDGET_BRIDGE_GAIN_8 PHIDGET_BRIDGE_GAIN_8}, {@link #PHIDGET_BRIDGE_GAIN_16 PHIDGET_BRIDGE_GAIN_16},
+ * {@link #PHIDGET_BRIDGE_GAIN_32 PHIDGET_BRIDGE_GAIN_32}, {@link #PHIDGET_BRIDGE_GAIN_64 PHIDGET_BRIDGE_GAIN_64},
+ * {@link #PHIDGET_BRIDGE_GAIN_128 PHIDGET_BRIDGE_GAIN_128}, {@link #PHIDGET_BRIDGE_GAIN_UNKNOWN PHIDGET_BRIDGE_GAIN_UNKNOWN}
+ * <p>
+ * @param index Index of the bridge
+ * @return gain
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(int, getGain, int index)
+ /**
+ * Sets the gain for the selected bridge. Note that increasing the gains will reduce the measurable
+ * voltage difference by the gain factor, with +-1000 mV/V being the maximum, with no gain.
+ * <p>
+ * The possible values for gain are {@link #PHIDGET_BRIDGE_GAIN_1 PHIDGET_BRIDGE_GAIN_1},
+ * {@link #PHIDGET_BRIDGE_GAIN_8 PHIDGET_BRIDGE_GAIN_8}, {@link #PHIDGET_BRIDGE_GAIN_16 PHIDGET_BRIDGE_GAIN_16},
+ * {@link #PHIDGET_BRIDGE_GAIN_32 PHIDGET_BRIDGE_GAIN_32}, {@link #PHIDGET_BRIDGE_GAIN_64 PHIDGET_BRIDGE_GAIN_64},
+ * {@link #PHIDGET_BRIDGE_GAIN_128 PHIDGET_BRIDGE_GAIN_128}, {@link #PHIDGET_BRIDGE_GAIN_UNKNOWN PHIDGET_BRIDGE_GAIN_UNKNOWN}
+ * <p>
+ * @param index Index of the bridge
+ * @param gain new gain
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(void, setGain, int index, int gain)
+ /**
+ * Returns the data rate, in ms. Data rate applies to all 4 bridges simultaneously. Setting a slower data rate will reduce
+ * noise at the cost of sample time. Also note that each bridge is being sampled only 1/4 of the time - this is okay for very stable signals,
+ * but for changing signals, it is best to set a higher sampling rate and do averaging in the software.
+ * <p>
+ * Data rate must be a multiple of 8ms. Trying to set something between multiplies of 8 will cause an EPHIDGET_INVALIDARG exception.
+ * <p>
+ * @return Data Rate
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(int, getDataRate,)
+ /**
+ * Sets the data rate, in ms. Data rate applies to all 4 bridges simultaneously. Setting a slower data rate will reduce
+ * noise at the cost of sample time. Also note that each bridge is being sampled only 1/4 of the time - this is okay for very stable signals,
+ * but for changing signals, it is best to set a higher sampling rate and do averaging in the software.
+ * <p>
+ * Data rate must be a multiple of 8ms. Trying to set something between multiplies of 8 will cause an EPHIDGET_INVALIDARG exception.
+ * <p>
+ * @param rate new data rate
+ * @throws PhidgetException If this Phidget is not opened and attached, or if the data rate is out of range
+ * See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
+ */
+ PUBLIC_NATIVE(void, setDataRate, int rate)
+ /**
+ * Gets the minimum supported data rate, in ms.
+ * @return minimum supported data rate
+ * @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, getDataRateMin,)
+ /**
+ * Gets the maximum supported data rate, in ms.
+ * @return maximum supported data rate
+ * @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, getDataRateMax,)
+
+ ENABLE_EVENTS
+ {
+ EVENT_ENABLE(bridgeData, BridgeData)
+ }
+ /**
+ * Adds a bridge data listener. The bridge data handler is a method that will be called at the specified data rate, for each enabled bridge. Value is the bridgeValue, in mV/V.
+ * <p>
+ * There is no limit on the number of bridge data handlers that can be registered for a particular Phidget.
+ *
+ * @param l An implemetation of the {@link com.phidgets.event.BridgeDataListener BridgeDataListener} interface
+ */
+ EVENT(bridgeData, BridgeData, bridgeData)
+} \ No newline at end of file
on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details.