From 0b624384cd52be20e61284551d832b499d7b7707 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sat, 14 Apr 2012 12:56:48 +0100 Subject: Imported Upstream version 2.1.8.20120216 --- Java/com/phidgets/AnalogPhidget.java | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Java/com/phidgets/AnalogPhidget.java (limited to 'Java/com/phidgets/AnalogPhidget.java') diff --git a/Java/com/phidgets/AnalogPhidget.java b/Java/com/phidgets/AnalogPhidget.java new file mode 100644 index 0000000..b8f4c0a --- /dev/null +++ b/Java/com/phidgets/AnalogPhidget.java @@ -0,0 +1,78 @@ + +/* + * Copyright 2011 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 Analog. All methods + * to manipulate the Phidget Analog are implemented in this class. + * + * @author Phidgets Inc. + */ +public final class AnalogPhidget extends Phidget +{ + public AnalogPhidget () throws PhidgetException + { + super (create ()); + } + private static native long create () throws PhidgetException; + + /** + * Returns the number of analog outputs. + * @return Number of analog outputs + */ + public native int getOutputCount () throws PhidgetException; + /** + * Returns the current voltage output setting for an analog output, in Volts. The range is between {@link #getVoltageMin(int) getVoltageMin} and {@link #getVoltageMax(int) getVoltageMax}. + * @param index index of the analog output + * @return current voltage for an analog output, in Volts + * @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 getVoltage (int index) throws PhidgetException; + /** + * Sets the current voltage setting for an analog output, in Volts. The range is between {@link #getVoltageMin(int) getVoltageMin} and {@link #getVoltageMax(int) getVoltageMax}. + * @param index index of the analog output + * @param current new voltage for an analog output, in Volts + * @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 void setVoltage (int index, double current) throws PhidgetException; + /** + * Gets the minimum supported voltage for an output, in Volts. + * @param index index of the analog output + * @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 getVoltageMin (int index) throws PhidgetException; + /** + * Gets the maximum supported voltage for an output, in Volts. + * @param index index of the analog output + * @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 getVoltageMax (int index) throws PhidgetException; + /** + * Returns the enabled state for an analog output. When enabled, the output drives at the set Voltage, up to 20mA. When disabled, the output is tied to ground via a 4K pull-down. + * @param index index of the analog output + * @return enabled state for an output + * @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) throws PhidgetException; + /** + * Sets the enabled state for a an analog output. When enabled, the output drives at the set Voltage, up to 20mA. When disabled, the output is tied to ground via a 4K pull-down. + * @param index index of the analog output + * @param state new state of the analog output + * @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) throws PhidgetException; + private final void enableDeviceSpecificEvents (boolean b) + { + } +} -- cgit v1.2.3