aboutsummaryrefslogtreecommitdiff
path: root/platform/include/chre/platform/platform_gnss.h
blob: 6f3c0638fe1790740b1184615db4ebb69412103a (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CHRE_PLATFORM_PLATFORM_GNSS_H_
#define CHRE_PLATFORM_PLATFORM_GNSS_H_

#include "chre/target_platform/platform_gnss_base.h"
#include "chre/util/time.h"

namespace chre {

class PlatformGnss : public PlatformGnssBase {
 public:
  /**
   * Performs platform-specific deinitialization of the PlatformGnss instance.
   */
  ~PlatformGnss();

  /**
   * Initializes the platform-specific GNSS implementation. This is potentially
   * called at a later stage of initialization than the constructor, so platform
   * implementations are encouraged to put any blocking initialization here.
   */
  void init();

  /**
   * Returns the set of GNSS capabilities that the platform has exposed. This
   * may return CHRE_GNSS_CAPABILITIES_NONE if GNSS is not supported.
   *
   * @return the GNSS capabilities exposed by this platform.
   */
  uint32_t getCapabilities();

  /**
   * Starts/stops/modifies the GNSS location session. This is an asynchronous
   * request and the result is delivered through an async call into the
   * GNSS manager.
   *
   * @param enable Whether to enable/disable the location session.
   * @param minInterval The minimum reporting interval.
   * @param minTimeToNextFix The minimum time to the next fix.
   *
   * @return true if the request was accepted.
   */
  bool controlLocationSession(bool enable, Milliseconds minInterval,
                              Milliseconds minTimeToNextFix);

  /**
   * Releases a location event that was previously provided to the GNSS manager.
   *
   * @param event the event to release.
   */
  void releaseLocationEvent(chreGnssLocationEvent *event);

  /**
   * Starts/stops/modifies the GNSS measurement session. This is an asynchronous
   * request and the result is delivered through an async call into the
   * GNSS manager.
   *
   * @param enable Whether to enable/disable the measurement session.
   * @param minInterval The minimum reporting interval.
   *
   * @return true if the request was accepted.
   */
  bool controlMeasurementSession(bool enable, Milliseconds minInterval);

  /**
   * Releases a measurement data event that was previously provided to the GNSS
   * manager.
   *
   * @param event the event to release.
   */
  void releaseMeasurementDataEvent(chreGnssDataEvent *event);
};

}  // namespace chre

#endif  // CHRE_PLATFORM_PLATFORM_GNSS_H_