aboutsummaryrefslogtreecommitdiff
path: root/chre_api/legacy/v1_4/chre/gnss.h
blob: 368f54d2adb88a7c3afa5393d8f6c2f421304164 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
/*
 * Copyright (C) 2016 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_GNSS_H_
#define _CHRE_GNSS_H_

/**
 * @file
 * Global Navigation Satellite System (GNSS) API.
 *
 * These structures and definitions are based on the Android N GPS HAL.
 * Refer to that header file (located at this path as of the time of this
 * comment: hardware/libhardware/include/hardware/gps.h) and associated
 * documentation for further details and explanations for these fields.
 * References in comments like "(ref: GnssAccumulatedDeltaRangeState)" map to
 * the relevant element in the GPS HAL where additional information can be
 * found.
 *
 * In general, the parts of this API that are taken from the GPS HAL follow the
 * naming conventions established in that interface rather than the CHRE API
 * conventions, in order to avoid confusion and enable code re-use where
 * applicable.
 */

#include <stdbool.h>
#include <stdint.h>

#include <chre/common.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The set of flags that may be returned by chreGnssGetCapabilities()
 * @defgroup CHRE_GNSS_CAPABILITIES
 * @{
 */

//! A lack of flags indicates that GNSS is not supported in this CHRE
#define CHRE_GNSS_CAPABILITIES_NONE          UINT32_C(0)

//! GNSS position fixes are supported via chreGnssLocationSessionStartAsync()
#define CHRE_GNSS_CAPABILITIES_LOCATION      UINT32_C(1 << 0)

//! GNSS raw measurements are supported via
//! chreGnssMeasurementSessionStartAsync()
#define CHRE_GNSS_CAPABILITIES_MEASUREMENTS  UINT32_C(1 << 1)

//! Location fixes supplied from chreGnssConfigurePassiveLocationListener()
//! are tapped in at the GNSS engine level, so they include additional fixes
//! such as those requested by the AP, and not just those requested by other
//! nanoapps within CHRE (which is the case when this flag is not set)
#define CHRE_GNSS_CAPABILITIES_GNSS_ENGINE_BASED_PASSIVE_LISTENER \
                                             UINT32_C(1 << 2)

/** @} */

/**
 * The current version of struct chreGnssDataEvent associated with this API
 */
#define CHRE_GNSS_DATA_EVENT_VERSION  UINT8_C(0)

/**
 * The maximum time the CHRE implementation is allowed to elapse before sending
 * an event with the result of an asynchronous request, unless specified
 * otherwise
 */
#define CHRE_GNSS_ASYNC_RESULT_TIMEOUT_NS  (5 * CHRE_NSEC_PER_SEC)

/**
 * Produce an event ID in the block of IDs reserved for GNSS
 * @param offset  Index into GNSS event ID block; valid range [0,15]
 */
#define CHRE_GNSS_EVENT_ID(offset)  (CHRE_EVENT_GNSS_FIRST_EVENT + (offset))

/**
 * nanoappHandleEvent argument: struct chreAsyncResult
 *
 * Communicates the asynchronous result of a request to the GNSS API, such as
 * starting a location session via chreGnssLocationSessionStartAsync(). The
 * requestType field in chreAsyncResult is set to a value from enum
 * chreGnssRequestType.
 */
#define CHRE_EVENT_GNSS_ASYNC_RESULT  CHRE_GNSS_EVENT_ID(0)

/**
 * nanoappHandleEvent argument: struct chreGnssLocationEvent
 *
 * Represents a location fix provided by the GNSS subsystem.
 */
#define CHRE_EVENT_GNSS_LOCATION      CHRE_GNSS_EVENT_ID(1)

/**
 * nanoappHandleEvent argument: struct chreGnssDataEvent
 *
 * Represents a set of GNSS measurements with associated clock data.
 */
#define CHRE_EVENT_GNSS_DATA          CHRE_GNSS_EVENT_ID(2)

// NOTE: Do not add new events with ID > 15; only values 0-15 are reserved
// (see chre/event.h)

// Flags indicating the Accumulated Delta Range's states
// (ref: GnssAccumulatedDeltaRangeState)
#define CHRE_GNSS_ADR_STATE_UNKNOWN     UINT16_C(0)
#define CHRE_GNSS_ADR_STATE_VALID       UINT16_C(1 << 0)
#define CHRE_GNSS_ADR_STATE_RESET       UINT16_C(1 << 1)
#define CHRE_GNSS_ADR_STATE_CYCLE_SLIP  UINT16_C(1 << 2)

// Flags to indicate what fields in chreGnssClock are valid (ref: GnssClockFlags)
#define CHRE_GNSS_CLOCK_HAS_LEAP_SECOND        UINT16_C(1 << 0)
#define CHRE_GNSS_CLOCK_HAS_TIME_UNCERTAINTY   UINT16_C(1 << 1)
#define CHRE_GNSS_CLOCK_HAS_FULL_BIAS          UINT16_C(1 << 2)
#define CHRE_GNSS_CLOCK_HAS_BIAS               UINT16_C(1 << 3)
#define CHRE_GNSS_CLOCK_HAS_BIAS_UNCERTAINTY   UINT16_C(1 << 4)
#define CHRE_GNSS_CLOCK_HAS_DRIFT              UINT16_C(1 << 5)
#define CHRE_GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY  UINT16_C(1 << 6)

// Flags to indicate which values are valid in a GpsLocation
// (ref: GpsLocationFlags)
#define CHRE_GPS_LOCATION_HAS_LAT_LONG           UINT16_C(1 << 0)
#define CHRE_GPS_LOCATION_HAS_ALTITUDE           UINT16_C(1 << 1)
#define CHRE_GPS_LOCATION_HAS_SPEED              UINT16_C(1 << 2)
#define CHRE_GPS_LOCATION_HAS_BEARING            UINT16_C(1 << 3)
#define CHRE_GPS_LOCATION_HAS_ACCURACY           UINT16_C(1 << 4)

//! @since v1.3
#define CHRE_GPS_LOCATION_HAS_ALTITUDE_ACCURACY  UINT16_C(1 << 5)
//! @since v1.3
#define CHRE_GPS_LOCATION_HAS_SPEED_ACCURACY     UINT16_C(1 << 6)
//! @since v1.3
#define CHRE_GPS_LOCATION_HAS_BEARING_ACCURACY   UINT16_C(1 << 7)

/**
 * The maximum number of instances of struct chreGnssMeasurement that may be
 * included in a single struct chreGnssDataEvent.
 */
#define CHRE_GNSS_MAX_MEASUREMENT  UINT8_C(64)

// Flags indicating the GNSS measurement state (ref: GnssMeasurementState)
#define CHRE_GNSS_MEASUREMENT_STATE_UNKNOWN                UINT16_C(0)
#define CHRE_GNSS_MEASUREMENT_STATE_CODE_LOCK              UINT16_C(1 << 0)
#define CHRE_GNSS_MEASUREMENT_STATE_BIT_SYNC               UINT16_C(1 << 1)
#define CHRE_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC          UINT16_C(1 << 2)
#define CHRE_GNSS_MEASUREMENT_STATE_TOW_DECODED            UINT16_C(1 << 3)
#define CHRE_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS         UINT16_C(1 << 4)
#define CHRE_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC            UINT16_C(1 << 5)
#define CHRE_GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC        UINT16_C(1 << 6)
#define CHRE_GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED        UINT16_C(1 << 7)
#define CHRE_GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC        UINT16_C(1 << 8)
#define CHRE_GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC   UINT16_C(1 << 9)
#define CHRE_GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK     UINT16_C(1 << 10)
#define CHRE_GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK  UINT16_C(1 << 11)
#define CHRE_GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC      UINT16_C(1 << 12)
#define CHRE_GNSS_MEASUREMENT_STATE_SBAS_SYNC              UINT16_C(1 << 13)

#define CHRE_GNSS_MEASUREMENT_CARRIER_FREQUENCY_UNKNOWN    0.f

/**
 * Indicates a type of request made in this API. Used to populate the resultType
 * field of struct chreAsyncResult sent with CHRE_EVENT_GNSS_ASYNC_RESULT.
 */
enum chreGnssRequestType {
    CHRE_GNSS_REQUEST_TYPE_LOCATION_SESSION_START    = 1,
    CHRE_GNSS_REQUEST_TYPE_LOCATION_SESSION_STOP     = 2,
    CHRE_GNSS_REQUEST_TYPE_MEASUREMENT_SESSION_START = 3,
    CHRE_GNSS_REQUEST_TYPE_MEASUREMENT_SESSION_STOP  = 4,
};

/**
 * Constellation type associated with an SV
 */
enum chreGnssConstellationType {
    CHRE_GNSS_CONSTELLATION_UNKNOWN = 0,
    CHRE_GNSS_CONSTELLATION_GPS     = 1,
    CHRE_GNSS_CONSTELLATION_SBAS    = 2,
    CHRE_GNSS_CONSTELLATION_GLONASS = 3,
    CHRE_GNSS_CONSTELLATION_QZSS    = 4,
    CHRE_GNSS_CONSTELLATION_BEIDOU  = 5,
    CHRE_GNSS_CONSTELLATION_GALILEO = 6,
};

/**
 * Enumeration of available values for the chreGnssMeasurement multipath indicator
 */
enum chreGnssMultipathIndicator {
    //! The indicator is not available or unknown
    CHRE_GNSS_MULTIPATH_INDICATOR_UNKNOWN     = 0,
    //! The measurement is indicated to be affected by multipath
    CHRE_GNSS_MULTIPATH_INDICATOR_PRESENT     = 1,
    //! The measurement is indicated to be not affected by multipath
    CHRE_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT = 2,
};

/**
 * Represents an estimate of the GNSS clock time (see the Android GPS HAL for
 * more detailed information)
 */
struct chreGnssClock {
    //! The GNSS receiver hardware clock value in nanoseconds, including
    //! uncertainty
    int64_t time_ns;

    //! The difference between hardware clock inside GNSS receiver and the
    //! estimated GNSS time in nanoseconds; contains bias uncertainty
    int64_t full_bias_ns;

    //! Sub-nanosecond bias, adds to full_bias_ns
    float bias_ns;

    //! The clock's drift in nanoseconds per second
    float drift_nsps;

    //! 1-sigma uncertainty associated with the clock's bias in nanoseconds
    float bias_uncertainty_ns;

    //! 1-sigma uncertainty associated with the clock's drift in nanoseconds
    //! per second
    float drift_uncertainty_nsps;

    //! While this number stays the same, timeNs should flow continuously
    uint32_t hw_clock_discontinuity_count;

    //! A set of flags indicating the validity of the fields in this data
    //! structure (see GNSS_CLOCK_HAS_*)
    uint16_t flags;

    //! Reserved for future use; set to 0
    uint8_t reserved[2];
};

/**
 * Represents a GNSS measurement; contains raw and computed information (see the
 * Android GPS HAL for more detailed information)
 */
struct chreGnssMeasurement {
    //! Hardware time offset from time_ns for this measurement, in nanoseconds
    int64_t time_offset_ns;

    //! Accumulated delta range since the last channel reset in micro-meters
    int64_t accumulated_delta_range_um;

    //! Received GNSS satellite time at the time of measurement, in nanoseconds
    int64_t received_sv_time_in_ns;

    //! 1-sigma uncertainty of received GNSS satellite time, in nanoseconds
    int64_t received_sv_time_uncertainty_in_ns;

    //! Pseudorange rate at the timestamp in meters per second (uncorrected)
    float pseudorange_rate_mps;

    //! 1-sigma uncertainty of pseudorange rate in meters per second
    float pseudorange_rate_uncertainty_mps;

    //! 1-sigma uncertainty of the accumulated delta range in meters
    float accumulated_delta_range_uncertainty_m;

    //! Carrier-to-noise density in dB-Hz, in the range of [0, 63]
    float c_n0_dbhz;

    //! Signal to noise ratio (dB), power above observed noise at correlators
    float snr_db;

    //! Satellite sync state flags (GNSS_MEASUREMENT_STATE_*) - sets modulus for
    //! received_sv_time_in_ns
    uint16_t state;

    //! Set of ADR state flags (GNSS_ADR_STATE_*)
    uint16_t accumulated_delta_range_state;

    //! Satellite vehicle ID number
    int16_t svid;

    //! Constellation of the given satellite vehicle
    //! @see #chreGnssConstellationType
    uint8_t constellation;

    //! @see #chreGnssMultipathIndicator
    uint8_t multipath_indicator;

    //! Carrier frequency of the signal tracked in Hz.
    //! For example, it can be the GPS central frequency for L1 = 1575.45 MHz,
    //! or L2 = 1227.60 MHz, L5 = 1176.45 MHz, various GLO channels, etc.
    //!
    //! Set to CHRE_GNSS_MEASUREMENT_CARRIER_FREQUENCY_UNKNOWN if not reported.
    //!
    //! For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
    //! time, two chreGnssMeasurement structs must be reported for this same
    //! satellite, in one of the measurement structs, all the values related to
    //! L1 must be filled, and in the other all of the values related to L5
    //! must be filled.
    //! @since v1.4
    float carrier_frequency_hz;
};

/**
 * Data structure sent with events associated with CHRE_EVENT_GNSS_DATA, enabled
 * via chreGnssMeasurementSessionStartAsync()
 */
struct chreGnssDataEvent {
    //! Indicates the version of the structure, for compatibility purposes.
    //! Clients do not normally need to worry about this field; the CHRE
    //! implementation guarantees that it only sends the client the structure
    //! version it expects.
    uint8_t version;

    //! Number of chreGnssMeasurement entries included in this event. Must be in
    //! the range [0, CHRE_GNSS_MAX_MEASUREMENT]
    uint8_t measurement_count;

    //! Reserved for future use; set to 0
    uint8_t reserved[6];

    struct chreGnssClock clock;

    //! Pointer to an array containing measurement_count measurements
    const struct chreGnssMeasurement *measurements;
};

/**
 * Data structure sent with events of type CHRE_EVENT_GNSS_LOCATION, enabled via
 * chreGnssLocationSessionStartAsync(). This is modeled after GpsLocation in the
 * GPS HAL, but does not use the double data type.
 */
struct chreGnssLocationEvent {
    //! UTC timestamp for location fix in milliseconds since January 1, 1970
    uint64_t timestamp;

    //! Fixed point latitude, degrees times 10^7 (roughly centimeter resolution)
    int32_t latitude_deg_e7;

    //! Fixed point longitude, degrees times 10^7 (roughly centimeter
    //! resolution)
    int32_t longitude_deg_e7;

    //! Altitude in meters above the WGS 84 reference ellipsoid
    float altitude;

    //! Horizontal speed in meters per second
    float speed;

    //! Clockwise angle between north and current heading, in degrees; range
    //! [0, 360)
    float bearing;

    //! Expected horizontal accuracy in meters such that a circle with a radius
    //! of length 'accuracy' from the latitude and longitude has a 68%
    //! probability of including the true location.
    float accuracy;

    //! A set of flags indicating which fields in this structure are valid.
    //! If any fields are not available, the flag must not be set and the field
    //! must be initialized to 0.
    //! @see #GpsLocationFlags
    uint16_t flags;

    //! Reserved for future use; set to 0
    //! @since v1.3
    uint8_t reserved[2];

    //! Expected vertical accuracy in meters such that a range of
    //! 2 * altitude_accuracy centered around altitude has a 68% probability of
    //! including the true altitude.
    //! @since v1.3
    float altitude_accuracy;

    //! Expected speed accuracy in meters per second such that a range of
    //! 2 * speed_accuracy centered around speed has a 68% probability of
    //! including the true speed.
    //! @since v1.3
    float speed_accuracy;

    //! Expected bearing accuracy in degrees such that a range of
    //! 2 * bearing_accuracy centered around bearing has a 68% probability of
    //! including the true bearing.
    //! @since v1.3
    float bearing_accuracy;
};


/**
 * Retrieves a set of flags indicating the GNSS features supported by the
 * current CHRE implementation. The value returned by this function must be
 * consistent for the entire duration of the Nanoapp's execution.
 *
 * The client must allow for more flags to be set in this response than it knows
 * about, for example if the implementation supports a newer version of the API
 * than the client was compiled against.
 *
 * @return A bitmask with zero or more CHRE_GNSS_CAPABILITIES_* flags set
 *
 * @since v1.1
 */
uint32_t chreGnssGetCapabilities(void);

/**
 * Initiates a GNSS positioning session, or changes the requested interval of an
 * existing session. If starting or modifying the session was successful, then
 * the GNSS engine will work on determining the device's position.
 *
 * This result of this request is delivered asynchronously via an event of type
 * CHRE_EVENT_GNSS_ASYNC_RESULT. Refer to the note in {@link #chreAsyncResult}
 * for more details. If the "Location" setting is disabled at the Android level,
 * the CHRE implementation is expected to return a result with
 * CHRE_ERROR_FUNCTION_DISABLED.
 *
 * If chreGnssGetCapabilities() returns a value that does not have the
 * CHRE_GNSS_CAPABILITIES_LOCATION flag set, then this method will return false.
 *
 * @param minIntervalMs The desired minimum interval between location fixes
 *        delivered to the client via CHRE_EVENT_GNSS_LOCATION, in milliseconds.
 *        The requesting client must allow for fixes to be delivered at shorter
 *        or longer interval than requested. For example, adverse RF conditions
 *        may result in fixes arriving at a longer interval, etc.
 * @param minTimeToNextFixMs The desired minimum time to the next location fix.
 *        If this is 0, the GNSS engine should start working on the next fix
 *        immediately. If greater than 0, the GNSS engine should not spend
 *        measurable power to produce a location fix until this amount of time
 *        has elapsed.
 * @param cookie An opaque value that will be included in the chreAsyncResult
 *        sent in relation to this request.
 *
 * @return true if the request was accepted for processing, false otherwise
 *
 * @since v1.1
 */
bool chreGnssLocationSessionStartAsync(uint32_t minIntervalMs,
                                       uint32_t minTimeToNextFixMs,
                                       const void *cookie);

/**
 * Terminates an existing GNSS positioning session. If no positioning session
 * is active at the time of this request, it is treated as if an active session
 * was successfully ended.
 *
 * This result of this request is delivered asynchronously via an event of type
 * CHRE_EVENT_GNSS_ASYNC_RESULT. Refer to the note in {@link #chreAsyncResult}
 * for more details.
 *
 * After CHRE_EVENT_GNSS_ASYNC_RESULT is delivered to the client, no more
 * CHRE_EVENT_GNSS_LOCATION events will be delievered until a new location
 * session is started.
 *
 * If chreGnssGetCapabilities() returns a value that does not have the
 * CHRE_GNSS_CAPABILITIES_LOCATION flag set, then this method will return false.
 *
 * @param cookie An opaque value that will be included in the chreAsyncResult
 *        sent in relation to this request.
 *
 * @return true if the request was accepted for processing, false otherwise
 *
 * @since v1.1
 */
bool chreGnssLocationSessionStopAsync(const void *cookie);

/**
 * Initiates a request to receive raw GNSS measurements. A GNSS measurement
 * session can exist independently of location sessions. In other words, a
 * Nanoapp is able to receive measurements at its requested interval both with
 * and without an active location session.
 *
 * This result of this request is delivered asynchronously via an event of type
 * CHRE_EVENT_GNSS_ASYNC_RESULT. Refer to the note in {@link #chreAsyncResult}
 * for more details. If the "Location" setting is disabled at the Android level,
 * the CHRE implementation is expected to return a result with
 * CHRE_ERROR_FUNCTION_DISABLED.
 *
 * If chreGnssGetCapabilities() returns a value that does not have the
 * CHRE_GNSS_CAPABILITIES_MEASUREMENTS flag set, then this method will return
 * false.
 *
 * @param minIntervalMs The desired minimum interval between measurement reports
 *        delivered via CHRE_EVENT_GNSS_DATA. When requested at 1000ms or
 *        faster, and GNSS measurements are tracked, device should report
 *        measurements as fast as requested, and shall report no slower than
 *        once every 1000ms, on average.
 * @param cookie An opaque value that will be included in the chreAsyncResult
 *        sent in relation to this request.
 *
 * @return true if the request was accepted for processing, false otherwise
 *
 * @since v1.1
 */
bool chreGnssMeasurementSessionStartAsync(uint32_t minIntervalMs,
                                          const void *cookie);

/**
 * Terminates an existing raw GNSS measurement session. If no measurement
 * session is active at the time of this request, it is treated as if an active
 * session was successfully ended.
 *
 * This result of this request is delivered asynchronously via an event of type
 * CHRE_EVENT_GNSS_ASYNC_RESULT. Refer to the note in {@link #chreAsyncResult}
 * for more details.
 *
 * If chreGnssGetCapabilities() returns a value that does not have the
 * CHRE_GNSS_CAPABILITIES_MEASUREMENTS flag set, then this method will return
 * false.
 *
 * @param cookie An opaque value that will be included in the chreAsyncResult
 *        sent in relation to this request.
 *
 * @return true if the request was accepted for processing, false otherwise
 *
 * @since v1.1
 */
bool chreGnssMeasurementSessionStopAsync(const void *cookie);

/**
 * Controls whether this nanoapp will passively receive GNSS-based location
 * fixes produced as a result of location sessions initiated by other entities.
 * This function allows a nanoapp to opportunistically receive location fixes
 * via CHRE_EVENT_GNSS_LOCATION events without imposing additional power cost,
 * though with no guarantees as to when or how often those events will arrive.
 * There will be no duplication of events if a passive location listener and
 * location session are enabled in parallel.
 *
 * Enabling passive location listening is not required to receive events for an
 * active location session started via chreGnssLocationSessionStartAsync(). This
 * setting is independent of the active location session, so modifying one does
 * not have an effect on the other.
 *
 * If chreGnssGetCapabilities() returns a value that does not have the
 * CHRE_GNSS_CAPABILITIES_LOCATION flag set or the value returned by
 * chreGetApiVersion() is less than CHRE_API_VERSION_1_2, then this method will
 * return false.
 *
 * If chreGnssGetCapabilities() includes
 * CHRE_GNSS_CAPABILITIES_GNSS_ENGINE_BASED_PASSIVE_LISTENER, the passive
 * registration is recorded at the GNSS engine level, so events include fixes
 * requested by the applications processor and potentially other non-CHRE
 * clients. If this flag is not set, then only fixes requested by other nanoapps
 * within CHRE are provided.
 *
 * @param enable true to receive opportunistic location fixes, false to disable
 *
 * @return true if the configuration was processed successfully, false on error
 *     or if this feature is not supported
 *
 * @since v1.2
 */
bool chreGnssConfigurePassiveLocationListener(bool enable);

#ifdef __cplusplus
}
#endif

#endif  /* _CHRE_GNSS_H_ */