org.openintents.samples.openglsensors
Class OpenGLSensors

java.lang.Object
  extended by Activity
      extended by org.openintents.samples.openglsensors.OpenGLSensors

public class OpenGLSensors
extends Activity

Displays a pyramid that always points up, or a compass needle that always points towards North. Directions are obtained from Android Sensors. If no real sensors are available, one can connect to the SensorSimulator. Accelerometer, compass, and orientation sensors are supported.

Author:
Peli

Field Summary
 boolean mUseAccelerometer
           
 boolean mUseCompass
           
 boolean mUseOrientation
           
 
Constructor Summary
OpenGLSensors()
           
 
Method Summary
 void disableAllSensors()
          Disable all sensors that we want to use.
 void enableAllSensors()
          Enable all sensors that we want to use.
 void findSupportedSensors()
           
 boolean onCreateOptionsMenu(Menu menu)
           
 boolean onOptionsItemSelected(MenuItem item)
           
 boolean onPrepareOptionsMenu(Menu menu)
           
 void onSensorChanged(int sensor, float[] values)
           
 void updateUseBestAvailableSensors()
          See if the currently selected sensor(s) is (are) still available.
 void useBestAvailableSensors()
          Selects the best supported sensors currently available.
 void useSensorsReset()
          Resets which sensors we want to use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mUseAccelerometer

public boolean mUseAccelerometer

mUseCompass

public boolean mUseCompass

mUseOrientation

public boolean mUseOrientation
Constructor Detail

OpenGLSensors

public OpenGLSensors()
Method Detail

onCreateOptionsMenu

public boolean onCreateOptionsMenu(Menu menu)

onPrepareOptionsMenu

public boolean onPrepareOptionsMenu(Menu menu)

onOptionsItemSelected

public boolean onOptionsItemSelected(MenuItem item)

findSupportedSensors

public void findSupportedSensors()

disableAllSensors

public void disableAllSensors()
Disable all sensors that we want to use.


enableAllSensors

public void enableAllSensors()
Enable all sensors that we want to use.


useBestAvailableSensors

public void useBestAvailableSensors()
Selects the best supported sensors currently available. This is orientation if supported. Otherwise a combination of accelerometer and compass is used (if supported).


updateUseBestAvailableSensors

public void updateUseBestAvailableSensors()
See if the currently selected sensor(s) is (are) still available. If not, useBestAvailableSensors() is called.


useSensorsReset

public void useSensorsReset()
Resets which sensors we want to use.


onSensorChanged

public void onSensorChanged(int sensor,
                            float[] values)