SpatialPhidget.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.*;
00017 public final class SpatialPhidget extends Phidget
00018 {
00019         public SpatialPhidget () throws PhidgetException
00020         {
00021                 super (create ());
00022         }
00023         private static native long create () throws PhidgetException;
00024 
00029         public native int getAccelerationAxisCount () throws PhidgetException;
00038         public native double getAcceleration (int index) throws PhidgetException;
00043         public native double getAccelerationMax (int index) throws PhidgetException;
00048         public native double getAccelerationMin (int index) throws PhidgetException;
00049 
00054         public native int getGyroAxisCount () throws PhidgetException;
00063         public native double getAngularRate (int index) throws PhidgetException;
00068         public native double getAngularRateMax (int index) throws PhidgetException;
00073         public native double getAngularRateMin (int index) throws PhidgetException;
00074 
00079         public native int getCompassAxisCount () throws PhidgetException;
00088         public native double getMagneticField (int index) throws PhidgetException;
00093         public native double getMagneticFieldMax (int index) throws PhidgetException;
00098         public native double getMagneticFieldMin (int index) throws PhidgetException;
00099 
00107         public native int getDataRate () throws PhidgetException;
00115         public native void setDataRate (int rate) throws PhidgetException;
00123         public native int getDataRateMin () throws PhidgetException;
00131         public native int getDataRateMax () throws PhidgetException;
00132 
00140         public native void zeroGyro () throws PhidgetException;
00160         public native void setCompassCorrectionParameters (double magField, double offset0, double offset1, double offset2, double gain0, double gain1, double gain2, double T0, double T1, double T2,
00161                                                            double T3, double T4, double T5) throws PhidgetException;
00168         public native void resetCompassCorrectionParameters () throws PhidgetException;
00169 
00170         private final void enableDeviceSpecificEvents (boolean b)
00171         {
00172                 enableSpatialDataEvents (b && spatialDataListeners.size () > 0);
00173         }
00182         public final void addSpatialDataListener (SpatialDataListener l)
00183         {
00184                 synchronized (spatialDataListeners)
00185                 {
00186                         spatialDataListeners.add (l);
00187                         enableSpatialDataEvents (true);
00188         }} private LinkedList spatialDataListeners = new LinkedList ();
00189         private long nativeSpatialDataHandler = 0;
00190         public final void removeSpatialDataListener (SpatialDataListener l)
00191         {
00192                 synchronized (spatialDataListeners)
00193                 {
00194                         spatialDataListeners.remove (l);
00195                         enableSpatialDataEvents (spatialDataListeners.size () > 0);
00196         }} private void fireSpatialData (SpatialDataEvent e)
00197         {
00198                 synchronized (spatialDataListeners)
00199                 {
00200                         for (Iterator it = spatialDataListeners.iterator (); it.hasNext ();)
00201                                 ((SpatialDataListener) it.next ()).data (e);
00202                 }
00203         }
00204         private native void enableSpatialDataEvents (boolean b);
00205 }


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