1bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/* Copyright (c) 2013-2015, 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>
38bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#include <stdlib.h>
39bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#include <string.h>
40e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#include <hardware/gps.h>
41e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
42e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Location has valid source information. */
43e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOCATION_HAS_SOURCE_INFO   0x0020
44e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid "is indoor?" flag */
45e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_IS_INDOOR   0x0040
46e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid floor number */
47e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_FLOOR_NUMBER   0x0080
48e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid map URL*/
49e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_MAP_URL   0x0100
50e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocation has valid map index */
51e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_HAS_MAP_INDEX   0x0200
52e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
53e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Sizes for indoor fields */
54e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_MAP_URL_SIZE 400
55e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_MAP_INDEX_SIZE 16
56e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
57e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Position source is ULP */
58e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define ULP_LOCATION_IS_FROM_HYBRID   0x0001
59e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Position source is GNSS only */
6047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_GNSS     0x0002
6147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Position source is ZPP only */
6247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_ZPP      0x0004
6347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Position is from a Geofence Breach Event */
6447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
6547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** Positioin is from Hardware FLP */
6647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define ULP_LOCATION_IS_FROM_HW_FLP   0x0010
67bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define ULP_LOCATION_IS_FROM_NLP   0x0020
68e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
69e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define ULP_MIN_INTERVAL_INVALID 0xffffffff
70e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
7147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/*Emergency SUPL*/
7247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_NI_TYPE_EMERGENCY_SUPL    4
73e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
741d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo#define AGPS_CERTIFICATE_MAX_LENGTH 2000
751d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo#define AGPS_CERTIFICATE_MAX_SLOTS 10
761d4940024c54e7d1e63f73edd5054a18a7a01b63Dante Russo
77bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/** Batching default ID for dummy batching session*/
78bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_BATCHING_DEFAULT_ID                 1
79bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
80bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/** This cap is used to decide the FLP session cache
81bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russosize on AP. If the BATCH_SIZE in flp.conf is less than
82bfff6343845ad9ff062c5fd97bb3b9be1053340eDante RussoGPS_AP_BATCHING_SIZE_CAP, FLP session cache size will
83bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russobe twice the BATCH_SIZE defined in flp.conf. Otherwise,
84bfff6343845ad9ff062c5fd97bb3b9be1053340eDante RussoFLP session cache size will be equal to the BATCH_SIZE.*/
85bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_AP_BATCHING_SIZE_CAP               40
86bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
87bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_BATCHING_OPERATION_SUCCEESS         1
88bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_BATCHING_OPERATION_FAILURE          0
89bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
90bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/** GPS extended batching flags*/
91bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_EXT_BATCHING_ON_FULL        0x0000001
92bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define GPS_EXT_BATCHING_ON_FIX         0x0000002
93bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
94bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/** Reasons of GPS reports batched locations*/
95bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russotypedef enum loc_batching_reported_type {
96bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_BATCHING_ON_FULL_IND_REPORT,
97bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_BATCHING_ON_FIX_IND_REPORT,
98bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_BATCHING_ON_QUERY_REPORT
99bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo}LocBatchingReportedType;
100bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
1018aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastavaenum loc_registration_mask_status {
1028aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_REGISTRATION_MASK_ENABLED,
1038aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_REGISTRATION_MASK_DISABLED
1048aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava};
1058aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava
106e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
107e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(UlpLocation) */
108e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
109e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    GpsLocation     gpsLocation;
110e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /* Provider indicator for HYBRID or GPS */
111e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint16_t        position_source;
112e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /*allows HAL to pass additional information related to the location */
113e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    int             rawDataSize;         /* in # of bytes */
114e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    void            * rawData;
115e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    bool            is_indoor;
116e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           floor_number;
117e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            map_url[GPS_LOCATION_MAP_URL_SIZE];
118e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    unsigned char   map_index[GPS_LOCATION_MAP_INDEX_SIZE];
119e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} UlpLocation;
120e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
121e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** AGPS type */
122e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef int16_t AGpsExtType;
123e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_INVALID       -1
124e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_ANY           0
125e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_SUPL          1
126e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_C2K           2
127e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_WWAN_ANY      3
128e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_WIFI          4
129e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_TYPE_SUPL_ES       5
130e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
131e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** SSID length */
132e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define SSID_BUF_SIZE (32+1)
133e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
134e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef int16_t AGpsBearerType;
135e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_INVALID    -1
136e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV4        0
137e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV6        1
138e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define AGPS_APN_BEARER_IPV4V6      2
139e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
140e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GPS extended callback structure. */
141e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
142e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(GpsCallbacks) */
143e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t      size;
144e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_set_capabilities set_capabilities_cb;
145e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_acquire_wakelock acquire_wakelock_cb;
146e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_release_wakelock release_wakelock_cb;
147e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
148e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_request_utc_time request_utc_time_cb;
149e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsExtCallbacks;
150e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
15147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended batch options */
15247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russotypedef struct {
15347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double max_power_allocation_mW;
15447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t sources_to_use;
15547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t flags;
15647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    int64_t period_ns;
15747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo} GpsExtBatchOptions;
15847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
159e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback to report the xtra server url to the client.
160e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  The client should use this url when downloading xtra unless overwritten
161e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  in the gps.conf file
162e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo */
163e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef void (* report_xtra_server)(const char*, const char*, const char*);
164e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
165e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback structure for the XTRA interface. */
166e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
167e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_xtra_download_request download_request_cb;
168e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
169e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    report_xtra_server report_xtra_server_cb;
170e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsXtraExtCallbacks;
171e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
172e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Represents the status of AGPS. */
173e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
174e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(AGpsExtStatus) */
175e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
176e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
177e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    AGpsExtType type;
178e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    AGpsStatusValue status;
179e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint32_t        ipv4_addr;
1800d00b9e0690547ad06eef43a5f1c77a31e8885dcDante Russo    struct sockaddr_storage addr;
181e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            ssid[SSID_BUF_SIZE];
182e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    char            password[SSID_BUF_SIZE];
183e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} AGpsExtStatus;
184e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
185e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback with AGPS status information.
186e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo *  Can only be called from a thread created by create_thread_cb.
187e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo */
188e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef void (* agps_status_extended)(AGpsExtStatus* status);
189e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
190e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Callback structure for the AGPS interface. */
191e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
192e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    agps_status_extended status_cb;
193e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
194e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} AGpsExtCallbacks;
195e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
196e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
197e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GPS NI callback structure. */
198e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct
199e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo{
200e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /**
201e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo     * Sends the notification request from HAL to GPSLocationProvider.
202e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo     */
203e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_ni_notify_callback notify_cb;
204e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    gps_create_thread create_thread_cb;
205e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsNiExtCallbacks;
206e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
207e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum loc_server_type {
208e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_CDMA_PDE_SERVER,
209e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_CUSTOM_PDE_SERVER,
210e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_MPC_SERVER,
211e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_AGPS_SUPL_SERVER
212e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} LocServerType;
213e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
214e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum loc_position_mode_type {
21547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_POSITION_MODE_INVALID = -1,
21647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_POSITION_MODE_STANDALONE = 0,
217e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_MS_BASED,
218e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_MS_ASSISTED,
219e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_1,
220e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_2,
221e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_3,
222e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_4,
223e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_POSITION_MODE_RESERVED_5
22447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
225e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} LocPositionMode;
226e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
227e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
228e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
22947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid latitude and longitude. */
23047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG   (1U<<0)
23147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid altitude. */
23247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE   (1U<<1)
23347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid speed. */
23447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_SPEED      (1U<<2)
23547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid bearing. */
23647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_BEARING    (1U<<4)
23747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GpsLocationExtended has valid accuracy. */
23847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ACCURACY   (1U<<8)
23947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
24047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended supports geofencing */
24147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_EXTENDED_CAPABILITY_GEOFENCE     0x0000001
24247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo/** GPS extended supports batching */
24347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define GPS_EXTENDED_CAPABILITY_BATCHING     0x0000002
24447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
245e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Flags to indicate which values are valid in a GpsLocationExtended. */
246e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef uint16_t GpsLocationExtendedFlags;
247e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid pdop, hdop, vdop. */
248e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001
249e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid altitude mean sea level. */
250e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002
251e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** UlpLocation has valid magnetic deviation. */
252e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004
253e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** UlpLocation has valid mode indicator. */
254e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008
255e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid vertical uncertainty */
256e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010
257e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** GpsLocationExtended has valid speed uncertainty */
258e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020
259e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
260e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo/** Represents gps location extended. */
261e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef struct {
262e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** set to sizeof(GpsLocationExtended) */
263e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    size_t          size;
264e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains GpsLocationExtendedFlags bits. */
265e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    uint16_t        flags;
266e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains the Altitude wrt mean sea level */
267e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           altitudeMeanSeaLevel;
268e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Position Dilusion of Precision. */
269e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           pdop;
270e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Horizontal Dilusion of Precision. */
271e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           hdop;
272e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Vertical Dilusion of Precision. */
273e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           vdop;
274e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** Contains Magnetic Deviation. */
275e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           magneticDeviation;
276e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** vertical uncertainty in meters */
277e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           vert_unc;
278e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    /** speed uncertainty in m/s */
279e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    float           speed_unc;
280e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} GpsLocationExtended;
281e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
28247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russotypedef struct GpsExtLocation_s {
28347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    size_t          size;
28447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint16_t        flags;
28547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          latitude;
28647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          longitude;
28747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    double          altitude;
28847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           speed;
28947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           bearing;
29047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    float           accuracy;
29147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    int64_t         timestamp;
29247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    uint32_t        sources_used;
29347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo} GpsExtLocation;
29447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo
295e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_sess_status {
296e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_SUCCESS,
297e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_INTERMEDIATE,
298e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_SESS_FAILURE
299e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
300e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
301e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef uint32_t LocPosTechMask;
302e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
303e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)
304e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002)
305e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004)
306e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008)
307e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010)
308e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020)
309e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040)
310e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080)
311e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
312e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef enum {
313e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
314e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
315e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
316e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
317e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_MODEM,
318e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo  LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN
319e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo} loc_if_req_sender_id_e_type;
320e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
321e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
322e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
323e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define MAX_APN_LEN 100
324e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
325e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo// This will be overridden by the individual adapters
326e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo// if necessary.
327e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#define DEFAULT_IMPL(rtv)                                     \
328e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo{                                                             \
3290acd743ceed7a8b2b4b4d90dd3821a9ab71f80ffDante Russo    LOC_LOGD("%s: default implementation invoked", __func__); \
330e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    return rtv;                                               \
331e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo}
332e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
333e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_api_adapter_err {
334e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_SUCCESS             = 0,
335e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_GENERAL_FAILURE     = 1,
336e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_UNSUPPORTED         = 2,
337e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_INVALID_HANDLE      = 4,
338e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_INVALID_PARAMETER   = 5,
339e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_ENGINE_BUSY         = 6,
340e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_PHONE_OFFLINE       = 7,
341e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_TIMEOUT             = 8,
342e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9,
343bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_ERR_INTERNAL            = 10,
344e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
345bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    /* equating engine down to phone offline, as they are the same errror */
346bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_ERR_ENGINE_DOWN         = LOC_API_ADAPTER_ERR_PHONE_OFFLINE,
347bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_ERR_FAILURE             = 101,
348e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_ERR_UNKNOWN
349e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
350e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
351e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russoenum loc_api_adapter_event_index {
35247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_POSITION = 0,               // Position report comes in loc_parsed_position_s_type
35347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_SATELLITE,                  // Satellite in view report
35447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NMEA_1HZ,                   // NMEA report at 1HZ rate
35547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NMEA_POSITION,              // NMEA report at position report rate
35647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY,          // NI notification/verification request
35747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA,           // Assistance data, eg: time, predicted orbits request
35847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_LOCATION_SERVER,           // Request for location server
35947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_IOCTL,                      // Callback report for loc_ioctl
36047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_STATUS,                     // Misc status report: eg, engine state
36147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_WIFI,                      //
36247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_SENSOR_STATUS,                     //
36347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_TIME_SYNC,                 //
36447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_SPI,                        //
36547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_NI_GEOFENCE,                //
36647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_GEOFENCE_GEN_ALERT,                //
36747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REPORT_GENFENCE_BREACH,            //
36847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_PEDOMETER_CTRL,                    //
36947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_MOTION_CTRL,                       //
37047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA,              // Wifi ap data
37147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCH_FULL,                        // Batching on full
37247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCHED_POSITION_REPORT,           // Batching on fix
37347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo    LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT,    //
374bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ,              // GDT upload start request
375bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_GDT_UPLOAD_END_REQ,                // GDT upload end request
3768aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava    LOC_API_ADAPTER_GNSS_MEASUREMENT,                  // GNSS Measurement report
377e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
378e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo    LOC_API_ADAPTER_EVENT_MAX
379e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo};
380e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
38147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT           (1<<LOC_API_ADAPTER_REPORT_POSITION)
38247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_SATELLITE_REPORT                 (1<<LOC_API_ADAPTER_REPORT_SATELLITE)
38347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT                  (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ)
38447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT             (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION)
38547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST         (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY)
38647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST          (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA)
38747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST          (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER)
38847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_IOCTL_REPORT                     (1<<LOC_API_ADAPTER_REPORT_IOCTL)
38947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_STATUS_REPORT                    (1<<LOC_API_ADAPTER_REPORT_STATUS)
39047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_WIFI                     (1<<LOC_API_ADAPTER_REQUEST_WIFI)
39147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_SENSOR_STATUS                    (1<<LOC_API_ADAPTER_SENSOR_STATUS)
39247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC                (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC)
39347ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_SPI                       (1<<LOC_API_ADAPTER_REPORT_SPI)
39447ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE               (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
39547ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT               (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
39647ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH           (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
39747ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT   (1<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT)
39847ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL                   (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
39947ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_MOTION_CTRL                      (1<<LOC_API_ADAPTER_MOTION_CTRL)
40047ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA             (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA)
40147ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCH_FULL                       (1<<LOC_API_ADAPTER_BATCH_FULL)
40247ad5e4cf2f6810db3c0e7ec79696496a94b6f0dDante Russo#define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT          (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT)
403bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ             (1<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ)
404bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ               (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ)
4058aac9d301fc5aa83071492803f4335b73f2604e3Vineeta Srivastava#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT                 (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
406e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
407e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russotypedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
408e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
409bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russotypedef enum loc_api_adapter_msg_to_check_supported {
410bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING,               // Batching
411bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH,         // Geofence Batched Breach
412bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
413bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    LOC_API_ADAPTER_MESSAGE_MAX
414bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo} LocCheckingMessagesID;
415bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
4168aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tangtypedef uint32_t LOC_GPS_LOCK_MASK;
4178aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockNone(lock) ((lock) == 0)
4188aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1))
4198aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2))
4208aa503a872e8c8cf241061f6ffed4e9fba125ffeKevin Tang#define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
421e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
422e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#ifdef __cplusplus
423e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo}
424e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#endif /* __cplusplus */
425e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
426e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo#endif /* GPS_EXTENDED_C_H */
427e14a6c846df2ce4bb1847e4250991f7c52fd793dDante Russo
428