1f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/* Copyright (c) 2011, Code Aurora Forum. All rights reserved. 2f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * 3f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * Redistribution and use in source and binary forms, with or without 4f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * modification, are permitted provided that the following conditions are 5f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * met: 6f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * * Redistributions of source code must retain the above copyright 7f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * notice, this list of conditions and the following disclaimer. 8f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * * Redistributions in binary form must reproduce the above 9f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * copyright notice, this list of conditions and the following 10f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * disclaimer in the documentation and/or other materials provided 11f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * with the distribution. 12f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * * Neither the name of Code Aurora Forum, Inc. nor the names of its 13f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * contributors may be used to endorse or promote products derived 14f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * from this software without specific prior written permission. 15f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * 16f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani * 28f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani */ 29f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 30f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#define LOG_NDDEBUG 0 31f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#define LOG_TAG "LocSvc_afw" 32f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 33f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#include <hardware/gps.h> 34f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#include <loc_eng.h> 35f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#include <loc_log.h> 36f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 37f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic gps_location_callback gps_loc_cb = NULL; 38f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic gps_sv_status_callback gps_sv_cb = NULL; 39f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 40f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_cb(GpsLocation* location, void* locExt); 41f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void sv_cb(GpsSvStatus* sv_status, void* svExt); 42f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 43f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani// Function declarations for sLocEngInterface 44f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_init(GpsCallbacks* callbacks); 45f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_start(); 46f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_stop(); 47f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_cleanup(); 48f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty); 49f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_inject_location(double latitude, double longitude, float accuracy); 50f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_delete_aiding_data(GpsAidingData f); 51f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence, 52f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani uint32_t min_interval, uint32_t preferred_accuracy, 53f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani uint32_t preferred_time); 54f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const void* loc_get_extension(const char* name); 55f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 56f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_update_criteria(UlpLocationCriteria criteria); 57f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 58f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 59f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani// Defines the GpsInterface in gps.h 60f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const GpsInterface sLocEngInterface = 61f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 62f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(GpsInterface), 63f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_init, 64f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_start, 65f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_stop, 66f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_cleanup, 67f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_inject_time, 68f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_inject_location, 69f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_delete_aiding_data, 70f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_set_position_mode, 71f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_get_extension 72f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 73f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ,loc_update_criteria 74f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 75f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 76f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 77f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani// Function declarations for sLocEngAGpsInterface 78f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_init(AGpsCallbacks* callbacks); 79f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_IPV6 80f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open(AGpsType agpsType, 81f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani const char* apn, AGpsBearerType bearerType); 82f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_closed(AGpsType agpsType); 83f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open_failed(AGpsType agpsType); 84f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#else 85f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open(const char* apn); 86f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_closed(); 87f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open_failed(); 88f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 89f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_set_server(AGpsType type, const char *hostname, int port); 90f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 91f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const AGpsInterface sLocEngAGpsInterface = 92f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 93f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(AGpsInterface), 94f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_init, 95f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_open, 96f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_closed, 97f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_open_failed, 98f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_set_server 99f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 100f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 101f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_xtra_init(GpsXtraCallbacks* callbacks); 102f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_xtra_inject_data(char* data, int length); 103f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 104f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const GpsXtraInterface sLocEngXTRAInterface = 105f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 106f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(GpsXtraInterface), 107f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_xtra_init, 108f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_xtra_inject_data 109f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 110f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 111f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_ni_init(GpsNiCallbacks *callbacks); 112f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_ni_respond(int notif_id, GpsUserResponseType user_response); 113f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 114f77c85bb51137f5ba854184e5e9194197027438aAjay Dudaniconst GpsNiInterface sLocEngNiInterface = 115f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 116f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(GpsNiInterface), 117f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_ni_init, 118f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_ni_respond, 119f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 120f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 121f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_init( AGpsRilCallbacks* callbacks ); 122f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct); 123f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); 124f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_ni_message(uint8_t *msg, size_t len); 125f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info); 126f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_update_network_availability(int avaiable, const char* apn); 127f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 128f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const AGpsRilInterface sLocEngAGpsRilInterface = 129f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 130f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(AGpsRilInterface), 131f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_init, 132f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_set_ref_location, 133f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_set_set_id, 134f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_ni_message, 135f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_update_network_state, 136f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_agps_ril_update_network_availability 137f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 138f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 139f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 140f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic bool loc_inject_raw_command(char* command, int length); 141f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 142f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const InjectRawCmdInterface sLocEngInjectRawCmdInterface = 143f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 144f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sizeof(InjectRawCmdInterface), 145f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_inject_raw_command 146f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani}; 147f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 148f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 149f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic loc_eng_data_s_type loc_afw_data; 150f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 151f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 152f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION gps_get_hardware_interface 153f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 154f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 155f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Returns the GPS hardware interaface based on LOC API 156f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani if GPS is enabled. 157f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 158f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 159f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 160f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 161f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 162f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 163f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 164f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 165f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 166f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 167f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 168f77c85bb51137f5ba854184e5e9194197027438aAjay Dudaniconst GpsInterface* gps_get_hardware_interface () 169f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 170f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG_CALLFLOW(); 171f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani const GpsInterface* ret_val; 172f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 173f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani char propBuf[PROPERTY_VALUE_MAX]; 174f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 175f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani // check to see if GPS should be disabled 176f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani property_get("gps.disable", propBuf, ""); 177f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani if (propBuf[0] == '1') 178f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 179f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n"); 180f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = NULL; 181f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } else { 182f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngInterface; 183f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 184f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 185f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%p, ret_val); 186f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 187f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 188f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 189f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani// for gps.c 190f77c85bb51137f5ba854184e5e9194197027438aAjay Dudaniextern "C" const GpsInterface* get_gps_interface() 191f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 192f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return &sLocEngInterface; 193f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 194f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 195f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_init 196f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 197f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 198f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Initialize the location engine, this include setting up global datas 199f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani and registers location engien with loc api service. 200f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 201f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 202f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 203f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 204f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 205f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 206f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 207f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 208f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/Ax 209f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 210f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 211f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_init(GpsCallbacks* callbacks) 212f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 213f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 214f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_EVENT_MASK_T event = 215f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | 216f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_SATELLITE_REPORT | 217f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | 218f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | 219f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_IOCTL_REPORT | 220f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_STATUS_REPORT | 221f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | 222f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; 223f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LocCallbacks clientCallbacks = {loc_cb, /* location_cb */ 224f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->status_cb, /* status_cb */ 225f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani sv_cb, /* sv_status_cb */ 226f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->nmea_cb, /* nmea_cb */ 227f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->set_capabilities_cb, /* set_capabilities_cb */ 228f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */ 229f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->release_wakelock_cb, /* release_wakelock_cb */ 230f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani callbacks->create_thread_cb, /* create_thread_cb */ 231f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NULL, /* location_ext_parser */ 232f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NULL /* sv_ext_parser */}; 233f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_loc_cb = callbacks->location_cb; 234f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_sv_cb = callbacks->sv_status_cb; 235f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 236f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_init(loc_afw_data, &clientCallbacks, event); 237f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 238f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 239f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 240f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 241f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 242f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 243f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_cleanup 244f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 245f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 246f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Cleans location engine. The location client handle will be released. 247f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 248f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 249f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 250f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 251f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 252f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 253f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 254f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 255f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 256f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 257f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 258f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_cleanup() 259f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 260f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 261f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_cleanup(loc_afw_data); 262f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_loc_cb = NULL; 263f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_sv_cb = NULL; 264f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 265f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 266f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 267f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 268f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_start 269f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 270f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 271f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Starts the tracking session 272f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 273f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 274f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 275f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 276f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 277f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 278f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 279f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 280f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 281f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 282f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 283f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_start() 284f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 285f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 286f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_start(loc_afw_data); 287f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 288f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 289f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 290f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 291f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 292f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 293f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_stop 294f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 295f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 296f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Stops the tracking session 297f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 298f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 299f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 300f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 301f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 302f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 303f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 304f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 305f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 306f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 307f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 308f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_stop() 309f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 310f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 311f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_stop(loc_afw_data); 312f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 313f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 314f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 315f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 316f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 317f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 318f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_set_position_mode 319f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 320f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 321f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Sets the mode and fix frequency for the tracking session. 322f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 323f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 324f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 325f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 326f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 327f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 328f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 329f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 330f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 331f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 332f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 333f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_set_position_mode(GpsPositionMode mode, 334f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani GpsPositionRecurrence recurrence, 335f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani uint32_t min_interval, 336f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani uint32_t preferred_accuracy, 337f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani uint32_t preferred_time) 338f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 339f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 340f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LocPositionMode locMode; 341f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani switch (mode) { 342f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani case GPS_POSITION_MODE_MS_BASED: 343f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani locMode = LOC_POSITION_MODE_MS_BASED; 344f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani break; 345f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani case GPS_POSITION_MODE_MS_ASSISTED: 346f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani locMode = LOC_POSITION_MODE_MS_ASSISTED; 347f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani break; 348f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani default: 349f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani locMode = LOC_POSITION_MODE_STANDALONE; 350f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani break; 351f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 352f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_set_position_mode(loc_afw_data, locMode, 353f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani recurrence, min_interval, 354f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani preferred_accuracy, preferred_time); 355f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 356f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 357f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 358f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 359f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 360f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 361f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_inject_time 362f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 363f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 364f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is used by Java native function to do time injection. 365f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 366f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 367f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 368f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 369f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 370f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 371f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 372f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 373f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 374f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 375f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 376f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty) 377f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 378f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 379f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_inject_time(loc_afw_data, time, timeReference, uncertainty); 380f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 381f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 382f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 383f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 384f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 385f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 386f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 387f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_inject_location 388f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 389f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 390f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is used by Java native function to do location injection. 391f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 392f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 393f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 394f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 395f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 396f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 : Successful 397f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani error code : Failure 398f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 399f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 400f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 401f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 402f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_inject_location(double latitude, double longitude, float accuracy) 403f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 404f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 405f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy); 406f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 407f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 408f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 409f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 410f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 411f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 412f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 413f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_delete_aiding_data 414f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 415f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 416f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is used by Java native function to delete the aiding data. The function 417f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani updates the global variable for the aiding data to be deleted. If the GPS 418f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani engine is off, the aiding data will be deleted. Otherwise, the actual action 419f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani will happen when gps engine is turned off. 420f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 421f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 422f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Assumes the aiding data type specified in GpsAidingData matches with 423f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC API specification. 424f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 425f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 426f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 427f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 428f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 429f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 430f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 431f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 432f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_delete_aiding_data(GpsAidingData f) 433f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 434f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 435f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_delete_aiding_data(loc_afw_data, f); 436f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 437f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 438f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 439f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 440f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 441f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 442f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_update_criteria 443f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 444f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 445f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is used to inform the ULP module of new unique criteria that are passed 446f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani in by the applications 447f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 448f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 449f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 450f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 451f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 452f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 453f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 454f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 455f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 456f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 457f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_update_criteria(UlpLocationCriteria criteria) 458f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 459f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 460f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_update_criteria(loc_afw_data, criteria); 461f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 462f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 463f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 464f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 465f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 466f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 467f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 468f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_get_extension 469f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 470f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 471f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Get the gps extension to support XTRA. 472f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 473f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 474f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 475f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 476f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 477f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani The GPS extension interface. 478f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 479f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 480f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 481f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 482f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 483f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic const void* loc_get_extension(const char* name) 484f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 485f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 486f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani const void* ret_val = NULL; 487f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 488f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani if (strcmp(name, GPS_XTRA_INTERFACE) == 0) 489f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 490f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngXTRAInterface; 491f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 492f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 493f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani else if (strcmp(name, AGPS_INTERFACE) == 0) 494f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 495f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngAGpsInterface; 496f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 497f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 498f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani else if (strcmp(name, GPS_NI_INTERFACE) == 0) 499f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 500f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngNiInterface; 501f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 502f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 503f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani else if (strcmp(name, AGPS_RIL_INTERFACE) == 0) 504f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 505f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngAGpsRilInterface; 506f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 507f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 508f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani else if (strcmp(name, ULP_RAW_CMD_INTERFACE) == 0) 509f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 510f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ret_val = &sLocEngInjectRawCmdInterface; 511f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 512f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 513f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani else 514f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani { 515f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LOC_LOGE ("get_extension: Invalid interface passed in\n"); 516f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 517f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 518f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%p, ret_val); 519f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 520f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 521f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 522f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 523f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_init 524f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 525f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 526f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Initialize the AGps interface. 527f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 528f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 529f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 530f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 531f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 532f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 533f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 534f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 535f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 536f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 537f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 538f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_init(AGpsCallbacks* callbacks) 539f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 540f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 541f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_agps_init(loc_afw_data, callbacks); 542f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 543f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 544f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 545f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 546f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_open 547f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 548f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 549f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This function is called when on-demand data connection opening is successful. 550f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniIt should inform ARM 9 about the data open result. 551f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 552f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 553f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 554f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 555f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 556f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 557f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 558f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 559f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 560f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 561f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 562f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_IPV6 563f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open(AGpsType agpsType, 564f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani const char* apn, AGpsBearerType bearerType) 565f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 566f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 567f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType); 568f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 569f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 570f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 571f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 572f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#else 573f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_open(const char* apn) 574f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 575f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 576f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_open(loc_afw_data, apn); 577f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 578f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 579f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 580f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 581f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 582f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 583f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 584f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_closed 585f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 586f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 587f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This function is called when on-demand data connection closing is done. 588f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniIt should inform ARM 9 about the data close result. 589f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 590f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 591f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 592f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 593f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 594f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 595f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 596f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 597f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 598f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 599f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 600f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_IPV6 601f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_closed(AGpsType agpsType) 602f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 603f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 604f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType); 605f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 606f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 607f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 608f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 609f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#else 610f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_closed() 611f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 612f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 613f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_closed(loc_afw_data); 614f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 615f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 616f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 617f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 618f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 619f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 620f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 621f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_open_failed 622f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 623f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 624f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This function is called when on-demand data connection opening has failed. 625f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniIt should inform ARM 9 about the data open result. 626f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 627f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 628f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 629f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 630f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 631f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 632f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 633f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 634f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 635f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 636f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 637f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_IPV6 638f77c85bb51137f5ba854184e5e9194197027438aAjay Dudaniint loc_agps_open_failed(AGpsType agpsType) 639f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 640f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 641f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType); 642f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 643f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 644f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 645f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 646f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#else 647f77c85bb51137f5ba854184e5e9194197027438aAjay Dudaniint loc_agps_open_failed() 648f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 649f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 650f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_agps_open_failed(loc_afw_data); 651f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 652f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 653f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 654f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 655f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 656f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 657f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 658f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_set_server 659f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 660f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 661f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani If loc_eng_set_server is called before loc_eng_init, it doesn't work. This 662f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani proxy buffers server settings and calls loc_eng_set_server when the client is 663f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani open. 664f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 665f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 666f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 667f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 668f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 669f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0 670f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 671f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 672f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 673f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 674f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 675f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_agps_set_server(AGpsType type, const char* hostname, int port) 676f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 677f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 678f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani LocServerType serverType; 679f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani switch (type) { 680f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani case AGPS_TYPE_SUPL: 681f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani serverType = LOC_AGPS_SUPL_SERVER; 682f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani break; 683f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani case AGPS_TYPE_C2K: 684f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani serverType = LOC_AGPS_CDMA_PDE_SERVER; 685f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani break; 686f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 687f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port); 688f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 689f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 690f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 691f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 692f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 693f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 694f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_xtra_init 695f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 696f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 697f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Initialize XTRA module. 698f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 699f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 700f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 701f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 702f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 703f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 704f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 705f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 706f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 707f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 708f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 709f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_xtra_init(GpsXtraCallbacks* callbacks) 710f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 711f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 712f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_xtra_init(loc_afw_data, callbacks); 713f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 714f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 715f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 716f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 717f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 718f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 719f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 720f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_xtra_inject_data 721f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 722f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 723f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Initialize XTRA module. 724f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 725f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 726f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 727f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 728f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 729f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 730f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 731f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 732f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 733f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 734f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 735f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic int loc_xtra_inject_data(char* data, int length) 736f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 737f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 738f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length); 739f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 740f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%d, ret_val); 741f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 742f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 743f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 744f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 745f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_ni_init 746f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 747f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 748f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This function initializes the NI interface 749f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 750f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 751f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 752f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 753f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 754f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 755f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 756f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 757f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 758f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 759f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 760f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanivoid loc_ni_init(GpsNiCallbacks *callbacks) 761f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 762f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 763f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_ni_init(loc_afw_data, callbacks); 764f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 765f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 766f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 767f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 768f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_ni_respond 769f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 770f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 771f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This function sends an NI respond to the modem processor 772f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 773f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 774f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani NONE 775f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 776f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 777f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 778f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 779f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 780f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 781f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 782f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 783f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanivoid loc_ni_respond(int notif_id, GpsUserResponseType user_response) 784f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 785f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 786f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_ni_respond(loc_afw_data, notif_id, user_response); 787f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 788f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 789f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 790f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani// Below stub functions are members of sLocEngAGpsRilInterface 791f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {} 792f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {} 793f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {} 794f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {} 795f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {} 796f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 797f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 798f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_agps_ril_update_network_availability 799f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 800f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 801f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani Sets data call allow vs disallow flag to modem 802f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is the only member of sLocEngAGpsRilInterface implemented. 803f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 804f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 805f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani None 806f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 807f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 808f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 809f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 810f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 811f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 812f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 813f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 814f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_agps_ril_update_network_availability(int available, const char* apn) 815f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 816f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 817f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn); 818f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 819f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 820f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 821f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 822f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani/*=========================================================================== 823f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniFUNCTION loc_inject_raw_command 824f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 825f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDESCRIPTION 826f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani This is used to send special test modem commands from the applications 827f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani down into the HAL 828f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniDEPENDENCIES 829f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 830f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 831f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniRETURN VALUE 832f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 0: success 833f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 834f77c85bb51137f5ba854184e5e9194197027438aAjay DudaniSIDE EFFECTS 835f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani N/A 836f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 837f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani===========================================================================*/ 838f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic bool loc_inject_raw_command(char* command, int length) 839f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 840f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 841f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani int ret_val = loc_eng_inject_raw_command(loc_afw_data, command, length); 842f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]); 843f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani return ret_val; 844f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 845f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 846f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 847f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 848f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void loc_cb(GpsLocation* location, void* locExt) 849f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 850f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 851f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani if (NULL != gps_loc_cb && NULL != location) { 852f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#ifdef QCOM_FEATURE_ULP 853f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source); 854f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#else 855f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani CALLBACK_LOG_CALLFLOW("location_cb - at", %llu, location->timestamp); 856f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani#endif 857f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_loc_cb(location); 858f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 859f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 860f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 861f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani 862f77c85bb51137f5ba854184e5e9194197027438aAjay Dudanistatic void sv_cb(GpsSvStatus* sv_status, void* svExt) 863f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani{ 864f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani ENTRY_LOG(); 865f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani if (NULL != gps_sv_cb) { 866f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs); 867f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani gps_sv_cb(sv_status); 868f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani } 869f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani EXIT_LOG(%s, VOID_RET); 870f77c85bb51137f5ba854184e5e9194197027438aAjay Dudani} 871