public class GGSensor
extends java.lang.Object
SensorManager.getRotationMatrix(R, I, acceleration, 
 magneticField)SensorManager.getOrientation(R, orientation)
 where| Constructor and Description | 
|---|
GGSensor(android.app.Activity activity,
        int sensorType)
Creates a sensor instance using the sensor of given sensor type. 
 | 
GGSensor(android.app.Activity activity,
        int sensorType,
        int sensorDelay)
Creates a sensor instance using the sensor of given sensor type. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addSensorListener(GGSensorListener listener)
Registers a GGSensorListener to get notifications when
 the sensor reports new values. 
 | 
static float[] | 
deviceToWorld(float[] R,
             float[] vDevice)
Returns the result of the matrix multiplication R * vDevice. 
 | 
static float | 
getAzimuthCalc(float[] g,
              float[] B)
Returns the azimuth calculated from given gravity and earth magnetic field. 
 | 
static float | 
getPitchCalc(float[] g)
Returns the pitch calculated from given gravity and earth magnetic field. 
 | 
static float | 
getRollCalc(float[] g)
Returns the roll calculated from given gravity and earth magnetic field. 
 | 
int | 
getType()
Returns the sensor type (constants defined in android.hardware.Sensor). 
 | 
float[] | 
getValues()
Returns the last values received from the sensor. 
 | 
void | 
setHighPassFilter(float samplingFreq,
                 float cutoffFreq)
Sets the sampling frequency and the cutoff frequency of the
 high-pass filter applied to the sensor data. 
 | 
void | 
setLowPassFilter(float samplingFreq,
                float cutoffFreq)
Sets the sampling frequency and the cutoff frequency of the
 low-pass filter applied to the sensor data. 
 | 
void | 
setNoFilter()
Disables filtering of sensor data (default). 
 | 
static float[] | 
toDeviceRotation(android.app.Activity activity,
                float[] device,
                int sensorType)
Converts the values from the device fixed coordinate system to
 a device coordinate system that is adapted to the current
 application device rotation (portrait, reverse portrait,
 landscape, reverse landscape). 
 | 
static float[] | 
worldToDevice(float[] R,
             float[] vWorld)
Returns the result of the matrix multiplication R_inverse * vWorld. 
 | 
public GGSensor(android.app.Activity activity,
        int sensorType,
        int sensorDelay)
activity - the activity used to access the systemsensorType - the type of sensor (constants defined in android.hardware.Sensor)sensorDelay - one of the SENSOR_DELAY constants in class SensorManagerpublic GGSensor(android.app.Activity activity,
        int sensorType)
activity - the activity used to access the systemsensorType - the type of sensor (constants defined in android.hardware.Sensor)public void addSensorListener(GGSensorListener listener)
listener - the GGSensorListener to registerpublic int getType()
public float[] getValues()
public static float[] deviceToWorld(float[] R,
                    float[] vDevice)
R - the rotation matrix (float array of size 9):vDevice - the vector in device coordinatespublic static float[] worldToDevice(float[] R,
                    float[] vWorld)
R - the rotation matrix (float array of size 9):vWorld - the vector in world coordinatespublic static float[] toDeviceRotation(android.app.Activity activity,
                       float[] device,
                       int sensorType)
device - the values in the device fixed coordinate
 system (float array of size 3)sensorType - the type of sensor (one of the constants 
 Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD, 
 Sensor.TYPE_ORIENTATION)public static float getAzimuthCalc(float[] g,
                   float[] B)
g - the gravity acceleration vector (gx, gy, gz) in the device fixed
 coordinate systemB - the earth magnetic field (Bx, By, Bz) (in uT) in the device fixed
 coordinate systempublic static float getPitchCalc(float[] g)
g - the gravity acceleration vector (gx, gy, gz)public static float getRollCalc(float[] g)
g - the gravity acceleration vector (gx, gy, gz)public void setHighPassFilter(float samplingFreq,
                     float cutoffFreq)
samplingFreq - (in Hz)cutoffFreq - (in Hz)public void setLowPassFilter(float samplingFreq,
                    float cutoffFreq)
samplingFreq - (in Hz)cutoffFreq - (in Hz)public void setNoFilter()