org.openintents.hardware
Class SensorsPlus

java.lang.Object
  extended by org.openintents.hardware.Sensors
      extended by org.openintents.hardware.SensorsPlus

public class SensorsPlus
extends Sensors

SensorsPlus extends the Sensors class by useful functions.


Field Summary
 
Fields inherited from class org.openintents.hardware.Sensors
mClient, SENSOR_ACCELEROMETER, SENSOR_COMPASS, SENSOR_ORIENTATION
 
Constructor Summary
SensorsPlus()
           
 
Method Summary
static float getDefaultSensorUpdateRate(java.lang.String sensor)
          Get the default sensor update rate.
static boolean isConnectedSimulator()
          Is the Sensor Simulator connected?
static boolean isEnabledSensor(java.lang.String sensor)
          Check whether a specific sensor is enabled.
static boolean isSupportedSensor(java.lang.String sensor)
          Check whether a specific sensor is supported.
 
Methods inherited from class org.openintents.hardware.Sensors
connectSimulator, disableSensor, disconnectSimulator, enableSensor, getNumSensorValues, getSensorUpdateRate, getSensorUpdateRates, getSupportedSensors, readSensor, setSensorUpdateRate, unsetSensorUpdateRate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SensorsPlus

public SensorsPlus()
Method Detail

isSupportedSensor

public static boolean isSupportedSensor(java.lang.String sensor)
Check whether a specific sensor is supported.

Parameters:
sensor - Sensor to be probed.
Returns:
Whether that sensor is supported.

isEnabledSensor

public static boolean isEnabledSensor(java.lang.String sensor)
Check whether a specific sensor is enabled. This is done by trying to read out a value and catch the exception if the sensor is not enabled. WARNING: If the sensor readout influences the subsequent readout result (e.g. for a pedometer that returns the number of steps since the last readout), this function shall not be used.

Parameters:
sensor - Sensor to be probed.
Returns:
Whether that sensor is enabled.

getDefaultSensorUpdateRate

public static float getDefaultSensorUpdateRate(java.lang.String sensor)
Get the default sensor update rate. This convenience routine will remember the current sensor update rate, then unset the sensor update rate, read out the sensor update rate (which will be the default rate returned by this method), and sets the sensor update rate again to the initial value. If no default update rate is available, 0 is returned. Exceptions connected with no update rate available are properly caught. Exceptions connected to sensor not supported or not enabled are not caught.

Parameters:
sensor - The sensor to be probed.
Returns:
The sensor update rate after unsetting the rate.

isConnectedSimulator

public static boolean isConnectedSimulator()
Is the Sensor Simulator connected?