ServoPhidget.java
Go to the documentation of this file.
00001 
00002 /*
00003  * Copyright 2006 Phidgets Inc.  All rights reserved.
00004  */
00005 
00006 package com.phidgets;
00007 import java.util.Iterator;
00008 import java.util.LinkedList;
00009 import com.phidgets.event.*;
00019 public final class ServoPhidget extends Phidget
00020 {
00021         public ServoPhidget () throws PhidgetException
00022         {
00023                 super (create ());
00024         }
00025         private static native long create () throws PhidgetException;
00026 
00030         public static final int PHIDGET_SERVO_DEFAULT = 1;
00034         public static final int PHIDGET_SERVO_RAW_us_MODE = 2;
00038         public static final int PHIDGET_SERVO_HITEC_HS322HD = 3;
00042         public static final int PHIDGET_SERVO_HITEC_HS5245MG = 4;
00046         public static final int PHIDGET_SERVO_HITEC_805BB = 5;
00050         public static final int PHIDGET_SERVO_HITEC_HS422 = 6;
00054         public static final int PHIDGET_SERVO_TOWERPRO_MG90 = 7;
00058         public static final int PHIDGET_SERVO_HITEC_HSR1425CR = 8;
00062         public static final int PHIDGET_SERVO_HITEC_HS785HB = 9;
00066         public static final int PHIDGET_SERVO_HITEC_HS485HB = 10;
00070         public static final int PHIDGET_SERVO_HITEC_HS645MG = 11;
00074         public static final int PHIDGET_SERVO_HITEC_815BB = 12;
00078         public static final int PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R = 13;
00082         public static final int PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R = 14;
00086         public static final int PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R = 15;
00090         public static final int PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R = 16;
00094         public static final int PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R = 17;
00098         public static final int PHIDGET_SERVO_SPRINGRC_SM_S2313M = 18;
00102         public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317M = 19;
00106         public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317SR = 20;
00110         public static final int PHIDGET_SERVO_SPRINGRC_SM_S4303R = 21;
00114         public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315M = 22;
00118         public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315R = 23;
00122         public static final int PHIDGET_SERVO_SPRINGRC_SM_S4505B = 24;
00126         public static final int PHIDGET_SERVO_USER_DEFINED = 25;
00127 
00133         public native int getMotorCount () throws PhidgetException;
00150         public native double getPosition (int index) throws PhidgetException;
00158         public native double getPositionMax (int index) throws PhidgetException;
00166         public native double getPositionMin (int index) throws PhidgetException;
00178         public native void setPosition (int index, double position) throws PhidgetException;
00188         public native void setEngaged (int index, boolean state) throws PhidgetException;
00193         public native void setMotorOn (int index, boolean state) throws PhidgetException;
00200         public native boolean getEngaged (int index) throws PhidgetException;
00205         public native boolean getMotorOn (int index) throws PhidgetException;
00217         public native int getServoType (int index) throws PhidgetException;
00236         public native void setServoType (int index, int type) throws PhidgetException;
00249         public native void setServoParameters (int index, double minUs, double maxUs, double degrees) throws PhidgetException;
00250 
00251         private final void enableDeviceSpecificEvents (boolean b)
00252         {
00253                 enableServoPositionChangeEvents (b && servoPositionChangeListeners.size () > 0);
00254         }
00263         public final void addServoPositionChangeListener (ServoPositionChangeListener l)
00264         {
00265                 synchronized (servoPositionChangeListeners)
00266                 {
00267                         servoPositionChangeListeners.add (l);
00268                         enableServoPositionChangeEvents (true);
00269         }} private LinkedList servoPositionChangeListeners = new LinkedList ();
00270         private long nativeServoPositionChangeHandler = 0;
00271         public final void removeServoPositionChangeListener (ServoPositionChangeListener l)
00272         {
00273                 synchronized (servoPositionChangeListeners)
00274                 {
00275                         servoPositionChangeListeners.remove (l);
00276                         enableServoPositionChangeEvents (servoPositionChangeListeners.size () > 0);
00277         }} private void fireServoPositionChange (ServoPositionChangeEvent e)
00278         {
00279                 synchronized (servoPositionChangeListeners)
00280                 {
00281                         for (Iterator it = servoPositionChangeListeners.iterator (); it.hasNext ();)
00282                                 ((ServoPositionChangeListener) it.next ()).servoPositionChanged (e);
00283                 }
00284         }
00285         private native void enableServoPositionChangeEvents (boolean b);
00286 }


pedal_monitor
Author(s): Pedro Mendes
autogenerated on Fri Jun 6 2014 18:37:21