summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/CompassEngine.java
blob: 3691bdc0ea10bf00073b7ca7727036625c8e18f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.mapbox.mapboxsdk.location;

import android.support.annotation.NonNull;

import com.mapbox.mapboxsdk.location.modes.CameraMode;
import com.mapbox.mapboxsdk.location.modes.RenderMode;

/**
 * Interface defining the source of compass heading data that is
 * consumed by the {@link LocationComponent} when in compass related
 * {@link RenderMode} or
 * {@link CameraMode}s.
 */
public interface CompassEngine {

  /**
   * Adds a {@link CompassListener} that can be used to
   * receive heading and state changes.
   *
   * @param compassListener to be added
   */
  void addCompassListener(@NonNull CompassListener compassListener);

  /**
   * Removes a {@link CompassListener} that can be used to
   * receive heading and state changes.
   *
   * @param compassListener to be removed
   */
  void removeCompassListener(@NonNull CompassListener compassListener);

  /**
   * Returns the last heading value produced and pushed via
   * a compass listener.
   *
   * @return last heading value
   */
  float getLastHeading();

  /**
   * Provides the last know accuracy status from the sensor manager.
   * <p>
   * An integer value which is identical to the {@code SensorManager} class constants:
   * <ul>
   * <li>{@link android.hardware.SensorManager#SENSOR_STATUS_NO_CONTACT}</li>
   * <li>{@link android.hardware.SensorManager#SENSOR_STATUS_UNRELIABLE}</li>
   * <li>{@link android.hardware.SensorManager#SENSOR_STATUS_ACCURACY_LOW}</li>
   * <li>{@link android.hardware.SensorManager#SENSOR_STATUS_ACCURACY_MEDIUM}</li>
   * <li>{@link android.hardware.SensorManager#SENSOR_STATUS_ACCURACY_HIGH}</li>
   * </ul>
   *
   * @return last accuracy status
   */
  int getLastAccuracySensorStatus();

  /**
   * Lifecycle method that can be used for adding or releasing resources.
   */
  void onStart();

  /**
   * Lifecycle method that can be used for adding or releasing resources.
   */
  void onStop();
}