147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
2e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *
3e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * Redistribution and use in source and binary forms, with or without
4e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * modification, are permitted provided that the following conditions are
5e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * met:
6e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *     * Redistributions of source code must retain the above copyright
7e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       notice, this list of conditions and the following disclaimer.
8e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *     * Redistributions in binary form must reproduce the above
9e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       copyright notice, this list of conditions and the following
10e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       disclaimer in the documentation and/or other materials provided
11e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       with the distribution.
12e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *     * Neither the name of The Linux Foundation nor the names of its
13e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       contributors may be used to endorse or promote products derived
14e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *       from this software without specific prior written permission.
15e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *
16e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo */
28e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
29e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#ifndef GPS_EXTENDED_C_H
30e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_EXTENDED_C_H
31e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
32e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#ifdef __cplusplus
33e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoextern "C" {
34e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#endif /* __cplusplus */
35e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
36e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#include <ctype.h>
37e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#include <stdbool.h>
38e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#include <hardware/gps.h>
39e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
40e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Location has valid source information. */
41e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOCATION_HAS_SOURCE_INFO   0x0020
42e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid "is indoor?" flag */
43e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_IS_INDOOR   0x0040
44e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid floor number */
45e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_FLOOR_NUMBER   0x0080
46e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid map URL*/
47e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_MAP_URL   0x0100
48e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid map index */
49e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_MAP_INDEX   0x0200
50e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
51e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Sizes for indoor fields */
52e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_MAP_URL_SIZE 400
53e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_MAP_INDEX_SIZE 16
54e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
55e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Position source is ULP */
56e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define ULP_LOCATION_IS_FROM_HYBRID   0x0001
57e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Position source is GNSS only */
5847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_GNSS     0x0002
5947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Position source is ZPP only */
6047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_ZPP      0x0004
6147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Position is from a Geofence Breach Event */
6247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
6347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Positioin is from Hardware FLP */
6447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_HW_FLP   0x0010
65e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
66e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define ULP_MIN_INTERVAL_INVALID 0xffffffff
67e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
6847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/*Emergency SUPL*/
6947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_NI_TYPE_EMERGENCY_SUPL    4
70e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
711d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo#define AGPS_CERTIFICATE_MAX_LENGTH 2000
721d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo#define AGPS_CERTIFICATE_MAX_SLOTS 10
731d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo
748aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastavaenum loc_registration_mask_status {
758aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_REGISTRATION_MASK_ENABLED,
768aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_REGISTRATION_MASK_DISABLED
778aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava};
788aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava
79e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
80e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(UlpLocation) */
81e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
82e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    GpsLocation     gpsLocation;
83e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /* Provider indicator for HYBRID or GPS */
84e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint16_t        position_source;
85e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /*allows HAL to pass additional information related to the location */
86e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    int             rawDataSize;         /* in # of bytes */
87e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    void            * rawData;
88e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    bool            is_indoor;
89e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           floor_number;
90e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            map_url[GPS_LOCATION_MAP_URL_SIZE];
91e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    unsigned char   map_index[GPS_LOCATION_MAP_INDEX_SIZE];
92e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} UlpLocation;
93e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
94e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** AGPS type */
95e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef int16_t AGpsExtType;
96e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_INVALID       -1
97e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_ANY           0
98e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_SUPL          1
99e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_C2K           2
100e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_WWAN_ANY      3
101e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_WIFI          4
102e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_SUPL_ES       5
103e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
104e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** SSID length */
105e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define SSID_BUF_SIZE (32+1)
106e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
107e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef int16_t AGpsBearerType;
108e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_INVALID    -1
109e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV4        0
110e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV6        1
111e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV4V6      2
112e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
1138369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_ALMANAC_CORR     0x00001000
1148369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_FREQ_BIAS_EST    0x00002000
1158369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_EPHEMERIS_GLO    0x00004000
1168369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_ALMANAC_GLO      0x00008000
1178369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_SVDIR_GLO        0x00010000
1188369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_SVSTEER_GLO      0x00020000
1198369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_ALMANAC_CORR_GLO 0x00040000
1208369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_TIME_GPS         0x00080000
1218369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo#define GPS_DELETE_TIME_GLO         0x00100000
1228369d5b6d61ce09157c8ed368bb559b914960df6Dante Russo
123e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GPS extended callback structure. */
124e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
125e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(GpsCallbacks) */
126e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t      size;
127e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_set_capabilities set_capabilities_cb;
128e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_acquire_wakelock acquire_wakelock_cb;
129e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_release_wakelock release_wakelock_cb;
130e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
131e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_request_utc_time request_utc_time_cb;
132e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsExtCallbacks;
133e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
13447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended batch options */
13547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russotypedef struct {
13647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double max_power_allocation_mW;
13747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t sources_to_use;
13847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t flags;
13947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    int64_t period_ns;
14047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo} GpsExtBatchOptions;
14147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
142e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback to report the xtra server url to the client.
143e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  The client should use this url when downloading xtra unless overwritten
144e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  in the gps.conf file
145e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo */
146e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef void (* report_xtra_server)(const char*, const char*, const char*);
147e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
148e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback structure for the XTRA interface. */
149e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
150e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_xtra_download_request download_request_cb;
151e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
152e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    report_xtra_server report_xtra_server_cb;
153e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsXtraExtCallbacks;
154e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
155e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Represents the status of AGPS. */
156e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
157e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(AGpsExtStatus) */
158e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
159e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
160e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    AGpsExtType type;
161e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    AGpsStatusValue status;
162e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint32_t        ipv4_addr;
1630d00b9e0690547ad06eef43a5f1c77a31e8885dcDante Russo    struct sockaddr_storage addr;
164e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            ssid[SSID_BUF_SIZE];
165e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            password[SSID_BUF_SIZE];
166e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} AGpsExtStatus;
167e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
168e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback with AGPS status information.
169e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  Can only be called from a thread created by create_thread_cb.
170e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo */
171e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef void (* agps_status_extended)(AGpsExtStatus* status);
172e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
173e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback structure for the AGPS interface. */
174e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
175e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    agps_status_extended status_cb;
176e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
177e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} AGpsExtCallbacks;
178e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
179e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
180e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GPS NI callback structure. */
181e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct
182e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo{
183e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /**
184e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo     * Sends the notification request from HAL to GPSLocationProvider.
185e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo     */
186e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_ni_notify_callback notify_cb;
187e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
188e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsNiExtCallbacks;
189e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
190e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum loc_server_type {
191e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_CDMA_PDE_SERVER,
192e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_CUSTOM_PDE_SERVER,
193e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_MPC_SERVER,
194e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_SUPL_SERVER
195e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} LocServerType;
196e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
197e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum loc_position_mode_type {
19847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_POSITION_MODE_INVALID = -1,
19947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_POSITION_MODE_STANDALONE = 0,
200e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_MS_BASED,
201e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_MS_ASSISTED,
202e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_1,
203e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_2,
204e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_3,
205e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_4,
206e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_5
20747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
208e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} LocPositionMode;
209e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
210e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
211e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
21247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid latitude and longitude. */
21347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG   (1U<<0)
21447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid altitude. */
21547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE   (1U<<1)
21647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid speed. */
21747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_SPEED      (1U<<2)
21847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid bearing. */
21947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_BEARING    (1U<<4)
22047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid accuracy. */
22147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ACCURACY   (1U<<8)
22247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
22347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended supports geofencing */
22447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_EXTENDED_CAPABILITY_GEOFENCE     0x0000001
22547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended supports batching */
22647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_EXTENDED_CAPABILITY_BATCHING     0x0000002
22747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
228e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Flags to indicate which values are valid in a GpsLocationExtended. */
229e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef uint16_t GpsLocationExtendedFlags;
230e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid pdop, hdop, vdop. */
231e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001
232e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid altitude mean sea level. */
233e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002
234e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** UlpLocation has valid magnetic deviation. */
235e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004
236e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** UlpLocation has valid mode indicator. */
237e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008
238e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid vertical uncertainty */
239e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010
240e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid speed uncertainty */
241e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020
242e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
243e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Represents gps location extended. */
244e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
245e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(GpsLocationExtended) */
246e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
247e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains GpsLocationExtendedFlags bits. */
248e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint16_t        flags;
249e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains the Altitude wrt mean sea level */
250e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           altitudeMeanSeaLevel;
251e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Position Dilusion of Precision. */
252e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           pdop;
253e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Horizontal Dilusion of Precision. */
254e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           hdop;
255e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Vertical Dilusion of Precision. */
256e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           vdop;
257e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Magnetic Deviation. */
258e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           magneticDeviation;
259e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** vertical uncertainty in meters */
260e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           vert_unc;
261e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** speed uncertainty in m/s */
262e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           speed_unc;
263e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsLocationExtended;
264e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
26547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russotypedef struct GpsExtLocation_s {
26647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    size_t          size;
26747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint16_t        flags;
26847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          latitude;
26947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          longitude;
27047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          altitude;
27147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           speed;
27247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           bearing;
27347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           accuracy;
27447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    int64_t         timestamp;
27547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t        sources_used;
27647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo} GpsExtLocation;
27747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
278e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_sess_status {
279e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_SUCCESS,
280e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_INTERMEDIATE,
281e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_FAILURE
282e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
283e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
284e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef uint32_t LocPosTechMask;
285e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
286e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)
287e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002)
288e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004)
289e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008)
290e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010)
291e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020)
292e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040)
293e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080)
294e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
295e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum {
296e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
297e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
298e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
299e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
300e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MODEM,
301e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN
302e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} loc_if_req_sender_id_e_type;
303e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
304e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
305e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
306e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define MAX_APN_LEN 100
307e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
308e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo// This will be overridden by the individual adapters
309e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo// if necessary.
310e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define DEFAULT_IMPL(rtv)                                     \
311e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo{                                                             \
3120acd743ceed7a8b2b4b4d90dd3821a9ab71f80ffDante Russo    LOC_LOGD("%s: default implementation invoked", __func__); \
313e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    return rtv;                                               \
314e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo}
315e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
316e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_api_adapter_err {
317e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_SUCCESS             = 0,
318e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_GENERAL_FAILURE     = 1,
319e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_UNSUPPORTED         = 2,
320e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_INVALID_HANDLE      = 4,
321e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_INVALID_PARAMETER   = 5,
322e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_ENGINE_BUSY         = 6,
323e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_PHONE_OFFLINE       = 7,
324e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_TIMEOUT             = 8,
325e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
326e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
327e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_ENGINE_DOWN         = 100,
328e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_FAILURE,
329e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_UNKNOWN
330e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
331e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
332e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_api_adapter_event_index {
33347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_POSITION = 0,               // Position report comes in loc_parsed_position_s_type
33447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_SATELLITE,                  // Satellite in view report
33547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NMEA_1HZ,                   // NMEA report at 1HZ rate
33647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NMEA_POSITION,              // NMEA report at position report rate
33747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY,          // NI notification/verification request
33847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA,           // Assistance data, eg: time, predicted orbits request
33947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_LOCATION_SERVER,           // Request for location server
34047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_IOCTL,                      // Callback report for loc_ioctl
34147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_STATUS,                     // Misc status report: eg, engine state
34247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_WIFI,                      //
34347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_SENSOR_STATUS,                     //
34447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_TIME_SYNC,                 //
34547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_SPI,                        //
34647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NI_GEOFENCE,                //
34747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_GEOFENCE_GEN_ALERT,                //
34847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_GENFENCE_BREACH,            //
34947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_PEDOMETER_CTRL,                    //
35047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_MOTION_CTRL,                       //
35147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA,              // Wifi ap data
35247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCH_FULL,                        // Batching on full
35347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCHED_POSITION_REPORT,           // Batching on fix
35447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT,    //
3558aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_API_ADAPTER_GNSS_MEASUREMENT,                  // GNSS Measurement report
356e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
357e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_EVENT_MAX
358e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
359e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
36047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT           (1<<LOC_API_ADAPTER_REPORT_POSITION)
36147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_SATELLITE_REPORT                 (1<<LOC_API_ADAPTER_REPORT_SATELLITE)
36247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT                  (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
36347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT             (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
36447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST         (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
36547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST          (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
36647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST          (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
36747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_IOCTL_REPORT                     (1<<LOC_API_ADAPTER_REPORT_IOCTL)
36847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_STATUS_REPORT                    (1<<LOC_API_ADAPTER_REPORT_STATUS)
36947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_WIFI                     (1<<LOC_API_ADAPTER_REQUEST_WIFI)
37047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_SENSOR_STATUS                    (1<<LOC_API_ADAPTER_SENSOR_STATUS)
37147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC                (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
37247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_SPI                       (1<<LOC_API_ADAPTER_REPORT_SPI)
37347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE               (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
37447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT               (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
37547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH           (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
37647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT   (1<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT)
37747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL                   (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
37847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_MOTION_CTRL                      (1<<LOC_API_ADAPTER_MOTION_CTRL)
37947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA             (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA)
38047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCH_FULL                       (1<<LOC_API_ADAPTER_BATCH_FULL)
38147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT          (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT)
3828aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT                 (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
383e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
384e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
385e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
3868aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tangtypedef uint32_t LOC_GPS_LOCK_MASK;
3878aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockNone(lock) ((lock) == 0)
3888aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1))
3898aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2))
3908aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
391e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
392e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#ifdef __cplusplus
393e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo}
394e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#endif /* __cplusplus */
395e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
396e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#endif /* GPS_EXTENDED_C_H */
397e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
398