|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metaio.sdk.jni.ISensorsComponent
com.metaio.sdk.SensorsComponentAndroid
public final class SensorsComponentAndroid
This class provide an easy interface to the device sensors such as GPS, Gravity etc. It implements ISensorsComponent and can be registered with metaio SDK instance.
Nested Class Summary | |
---|---|
static interface |
SensorsComponentAndroid.Callback
Callback interface, any class which requires to update based on sensor values can implement this interface and receive new sensor readings when the sensors are updated, the class which implements this interface must register itself with the SensorsComponentAndroid. |
Field Summary | |
---|---|
static boolean |
isTablet
true if running on tablet. |
static float |
LM_MINDISTANCE
Minimum distance to update location (in meters). |
static long |
LM_MINTIME
Minimum time to update location (in ms). |
Fields inherited from class com.metaio.sdk.jni.ISensorsComponent |
---|
SENSOR_ALL, SENSOR_ATTITUDE, SENSOR_DEVICE_MOVEMENT, SENSOR_GRAVITY, SENSOR_HEADING, SENSOR_LOCATION, SENSOR_NONE, SENSOR_USER_ACCELERATION |
Constructor Summary | |
---|---|
SensorsComponentAndroid(Context context)
Create sensor manager's object by passing application context and specifying if averaging (smoothing) filter is to be applied to the accelerometer and orientation sensor readings. |
Method Summary | |
---|---|
Vector3d |
getGravity()
The metaio camera-COS is defined as follows: if the device is hold in landscape mode with button to the right and the touch screen facing you, then the positive X-axis points right, the positive Y-axis points up and the positive Z-axis points to you | ________________________________ | | | | | | | ^ Y | | | | | | | | | | | | | | -|--> X | O | | | \\ | | | | \\ | | | | v Z | | | |________________________________| | |________________________________________|This means: If device is hold: => then the gravity vector is: landscape button right => 0 -1 0 landscape button left => 0 +1 0 portrait button down => +1 0 0 portrait button up => -1 0 0 lying horizontal with screen facing up => 0 0 -1 lying horizontal with screen facing down=> 0 0 +1Vector containing the last reading |
float |
getHeading()
Heading in degrees |
LLACoordinate |
getLocation()
location as LLA coordinates |
Vector3d |
getOrientationReading()
Get last orientation sensor reading |
SensorValues |
getSensorValues()
Returns the correct device orientation in degrees based on the screen rotation |
void |
onAccuracyChanged(Sensor sensor,
int accuracy)
|
void |
onLocationChanged(Location location)
|
void |
onProviderDisabled(String provider)
|
void |
onProviderEnabled(String provider)
|
void |
onSensorChanged(SensorEvent event)
|
void |
onStatusChanged(String provider,
int status,
Bundle extras)
|
void |
pause()
Pause all sensors |
void |
registerCallback(SensorsComponentAndroid.Callback callback)
Register callback to receive sensor readings. |
void |
release()
Release the sensors' component. |
void |
resetManualLocation()
Remove manual location override |
void |
resume()
Resume all sensors |
void |
setManualLocation(LLACoordinate location)
Set manual LLA location, all updates from LocationManager will be ignore after this call, until resetManualLocation()
is called |
int |
start(int sensors)
|
int |
stop()
|
int |
stop(int sensors)
|
Methods inherited from class com.metaio.sdk.jni.ISensorsComponent |
---|
delete, getCPtr, swigReleaseOwnership, swigTakeOwnership |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static long LM_MINTIME
LocationManager#requestLocationUpdates(String, long, float, LocationListener)
public static float LM_MINDISTANCE
LocationManager#requestLocationUpdates(String, long, float, LocationListener)
public static boolean isTablet
Constructor Detail |
---|
public SensorsComponentAndroid(Context context)
SensorsComponentAndroid#open(int)
to start the sensors. Register callback through registerCallback(Callback)
to receive sensor readings.
context
- Application contextfilter
- true if averaging filter is used, else falseSensorsComponentAndroid#open(int)
,
registerCallback(Callback)
Method Detail |
---|
public void registerCallback(SensorsComponentAndroid.Callback callback)
SensorsComponentAndroid.Callback
interface. However, depending on
which sensors are opened through SensorsComponentAndroid#open(int)
, the relevant
callbacks will be called at regular intervals.
callback
- a class which implements SensorsComponentAndroid.Callback
interfaceSensorsComponentAndroid.Callback
public int start(int sensors)
start
in class ISensorsComponent
sensors
- Sensors to start (see ESENSOR)
sensors that are actually started
See: ESENSOR, stoppublic void release()
public int stop(int sensors)
stop
in class ISensorsComponent
sensors
- Sensors to stop (default is all sensors, i.e. SENSOR_ALL)
sensors that are actually stopped
See: startpublic void pause()
public void resume()
public int stop()
stop
in class ISensorsComponent
public LLACoordinate getLocation()
ISensorsComponent
getLocation
in class ISensorsComponent
public Vector3d getOrientationReading()
public Vector3d getGravity()
ISensorsComponent
getGravity
in class ISensorsComponent
public float getHeading()
ISensorsComponent
getHeading
in class ISensorsComponent
public SensorValues getSensorValues()
getSensorValues
in class ISensorsComponent
rotationMatrix
-
public void onAccuracyChanged(Sensor sensor, int accuracy)
public void onSensorChanged(SensorEvent event)
public void onLocationChanged(Location location)
public void onProviderDisabled(String provider)
public void onProviderEnabled(String provider)
public void onStatusChanged(String provider, int status, Bundle extras)
public void setManualLocation(LLACoordinate location)
resetManualLocation()
is called
setManualLocation
in class ISensorsComponent
location
- Manual locationpublic void resetManualLocation()
resetManualLocation
in class ISensorsComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |