From 926d20ad7720934055a6bca897b54c0af4cb1cc6 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Tue, 12 Feb 2013 17:18:49 -0800 Subject: [PATCH] gps: moving agps/ni/xtra/time features out of afw Moving these features out of afw allows these features to still work on platforms that do not allow changes to afw and it also gives us more control. Change-Id: I6923b302f93222dc10189c3a6a7b6ba2ec1a3378 --- loc_api/Android.mk | 2 - .../libloc_api-rpc-glue/Android.mk | 4 - .../rpc_inc/LocApiRpcAdapter.h | 8 +- .../src/LocApiRpcAdapter.cpp | 20 +- loc_api/libloc_api/loc_eng.cpp | 2 +- loc_api/libloc_api_50001/Android.mk | 13 +- loc_api/libloc_api_50001/LocApiAdapter.h | 10 +- loc_api/libloc_api_50001/gps_extended.h | 94 +++++ loc_api/libloc_api_50001/loc.cpp | 333 +----------------- loc_api/libloc_api_50001/loc.h | 3 +- loc_api/libloc_api_50001/loc_eng.cpp | 100 +----- loc_api/libloc_api_50001/loc_eng.h | 20 +- loc_api/libloc_api_50001/loc_eng_agps.cpp | 36 +- loc_api/libloc_api_50001/loc_eng_agps.h | 16 +- loc_api/libloc_api_50001/loc_eng_log.cpp | 12 +- loc_api/libloc_api_50001/loc_eng_log.h | 4 +- loc_api/libloc_api_50001/loc_eng_msg.h | 51 +-- loc_api/libloc_api_50001/loc_eng_ni.cpp | 4 +- loc_api/libloc_api_50001/loc_eng_xtra.cpp | 4 +- loc_api/loc_api_v02/Android.mk | 4 - loc_api/loc_api_v02/LocApiV02Adapter.cpp | 24 +- loc_api/loc_api_v02/LocApiV02Adapter.h | 8 +- 22 files changed, 148 insertions(+), 624 deletions(-) create mode 100644 loc_api/libloc_api_50001/gps_extended.h diff --git a/loc_api/Android.mk b/loc_api/Android.mk index dd7a8f31..85dcb56b 100644 --- a/loc_api/Android.mk +++ b/loc_api/Android.mk @@ -4,9 +4,7 @@ LOCAL_PATH := $(call my-dir) GPS_DIR_LIST := -FEATURE_IPV6 := true FEATURE_DELEXT := true -FEATURE_ULP := true # add RPC dirs if RPC is available ifneq ($(TARGET_NO_RPC),true) diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk index 6a7c11cb..c7a245b8 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk @@ -20,10 +20,6 @@ LOCAL_CFLAGS+=$(GPS_FEATURES) # for loc_api_fixup.c LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL -ifeq ($(FEATURE_IPV6), true) -LOCAL_CFLAGS += -DFEATURE_IPV6 -endif #FEATURE_IPV6 - LOCAL_SHARED_LIBRARIES:= \ librpc \ libutils \ diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h index bdb28be4..1574a896 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -96,14 +96,8 @@ public: setServer(unsigned int ip, int port, LocServerType type); virtual enum loc_api_adapter_err setXtraData(char* data, int length); -#ifdef FEATURE_IPV6 virtual enum loc_api_adapter_err atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType); -#else - virtual enum loc_api_adapter_err - atlOpenStatus(int handle, int is_succ, char* apn, - AGpsType agpsType); -#endif virtual enum loc_api_adapter_err atlCloseStatus(int handle, int is_succ); virtual enum loc_api_adapter_err diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp index 9c2749bd..022daffe 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp @@ -958,22 +958,13 @@ LocApiRpcAdapter::setXtraData(char* data, int length) return convertErr(rpc_ret_val); } -#ifdef FEATURE_IPV6 enum loc_api_adapter_err LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType) -#else -enum loc_api_adapter_err -LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agpsType) -#endif { rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL; rpc_loc_ioctl_data_u_type ioctl_data; -#ifdef FEATURE_IPV6 if (AGPS_TYPE_INVALID == agpsType) { -#else - if (false) { -#endif rpc_loc_server_open_status_s_type *conn_open_status_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status; @@ -1010,7 +1001,6 @@ LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agp conn_multi_open_status_ptr->apn_name[0] = 0; } -#ifdef FEATURE_IPV6 switch(bearer) { case AGPS_APN_BEARER_IPV4: @@ -1025,9 +1015,7 @@ LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agp default: conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP; } -#else - conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP; -#endif + LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n", log_succ_fail_string(is_succ), apn, @@ -1081,22 +1069,16 @@ void LocApiRpcAdapter::ATLEvent(const rpc_loc_server_request_s_type *server_requ agps_type = AGPS_TYPE_SUPL; LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle); } else { -#ifdef FEATURE_IPV6 agps_type = AGPS_TYPE_WWAN_ANY; LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle); -#else - break; -#endif } requestATL(connHandle, agps_type); break; -#ifdef FEATURE_IPV6 case RPC_LOC_SERVER_REQUEST_OPEN: connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle; LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle); requestATL(connHandle, AGPS_TYPE_INVALID); break; -#endif case RPC_LOC_SERVER_REQUEST_CLOSE: connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle; LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle); diff --git a/loc_api/libloc_api/loc_eng.cpp b/loc_api/libloc_api/loc_eng.cpp index 944326b0..3b286303 100644 --- a/loc_api/libloc_api/loc_eng.cpp +++ b/loc_api/libloc_api/loc_eng.cpp @@ -1421,7 +1421,7 @@ SIDE EFFECTS ===========================================================================*/ static void loc_eng_process_deferred_action (void* arg) { - AGpsStatus status; + AGpsExtStatus status; status.size = sizeof(status); status.type = AGPS_TYPE_SUPL; diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index 9cd3b197..f36ae4fe 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -25,10 +25,6 @@ LOCAL_CFLAGS += \ -fno-short-enums \ -D_ANDROID_ -ifeq ($(FEATURE_IPV6), true) -LOCAL_CFLAGS += -DFEATURE_IPV6 -endif #FEATURE_IPV6 - ifeq ($(FEATURE_DELEXT), true) LOCAL_CFLAGS += -DFEATURE_DELEXT endif #FEATURE_DELEXT @@ -40,6 +36,7 @@ LOCAL_COPY_HEADERS_TO:= libloc_eng/ LOCAL_COPY_HEADERS:= \ LocApiAdapter.h \ loc.h \ + gps_extended.h \ loc_eng.h \ loc_eng_xtra.h \ loc_eng_ni.h \ @@ -85,10 +82,6 @@ LOCAL_CFLAGS += \ -fno-short-enums \ -D_ANDROID_ -ifeq ($(FEATURE_IPV6), true) -LOCAL_CFLAGS += -DFEATURE_IPV6 -endif #FEATURE_IPV6 - LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ hardware/qcom/gps/loc_api/ulp/inc @@ -121,10 +114,6 @@ LOCAL_CFLAGS += \ -fno-short-enums \ -D_ANDROID_ \ -ifeq ($(FEATURE_IPV6), true) -LOCAL_CFLAGS += -DFEATURE_IPV6 -endif #FEATURE_IPV6 - ## Includes LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ diff --git a/loc_api/libloc_api_50001/LocApiAdapter.h b/loc_api/libloc_api_50001/LocApiAdapter.h index 65fac91a..95b91740 100644 --- a/loc_api/libloc_api_50001/LocApiAdapter.h +++ b/loc_api/libloc_api_50001/LocApiAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -132,7 +132,7 @@ public: void* svExt); void reportStatus(GpsStatusValue status); void reportNmea(const char* nmea, int length); - void reportAgpsStatus(AGpsStatus &agpsStatus); + void reportAgpsStatus(AGpsExtStatus &agpsStatus); void requestXtraData(); void requestTime(); void requestLocation(); @@ -171,15 +171,9 @@ public: inline virtual enum loc_api_adapter_err setXtraData(char* data, int length) {LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;} -#ifdef FEATURE_IPV6 inline virtual enum loc_api_adapter_err atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType) {LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;} -#else - inline virtual enum loc_api_adapter_err - atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agpsType) - {LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;} -#endif inline virtual enum loc_api_adapter_err atlCloseStatus(int handle, int is_succ) {LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;} diff --git a/loc_api/libloc_api_50001/gps_extended.h b/loc_api/libloc_api_50001/gps_extended.h new file mode 100644 index 00000000..8e688c95 --- /dev/null +++ b/loc_api/libloc_api_50001/gps_extended.h @@ -0,0 +1,94 @@ +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Not a Contribution. + * + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GPS_EXTENDED_H +#define GPS_EXTENDED_H + +/** AGPS type */ +typedef int16_t AGpsExtType; +#define AGPS_TYPE_INVALID -1 +#define AGPS_TYPE_ANY 0 +#define AGPS_TYPE_SUPL 1 +#define AGPS_TYPE_C2K 2 +#define AGPS_TYPE_WWAN_ANY 3 +#define AGPS_TYPE_WIFI 4 + +/** SSID length */ +#define SSID_BUF_SIZE (32+1) + +typedef int16_t AGpsBearerType; +#define AGPS_APN_BEARER_INVALID -1 +#define AGPS_APN_BEARER_IPV4 0 +#define AGPS_APN_BEARER_IPV6 1 +#define AGPS_APN_BEARER_IPV4V6 2 + +/** GPS extended callback structure. */ +typedef struct { + /** set to sizeof(GpsCallbacks) */ + size_t size; + gps_set_capabilities set_capabilities_cb; + gps_acquire_wakelock acquire_wakelock_cb; + gps_release_wakelock release_wakelock_cb; + gps_create_thread create_thread_cb; + gps_request_utc_time request_utc_time_cb; +} GpsExtCallbacks; + +/** Callback structure for the XTRA interface. */ +typedef struct { + gps_xtra_download_request download_request_cb; + gps_create_thread create_thread_cb; +} GpsXtraExtCallbacks; + +/** Represents the status of AGPS. */ +typedef struct { + /** set to sizeof(AGpsExtStatus) */ + size_t size; + + AGpsExtType type; + AGpsStatusValue status; + uint32_t ipv4_addr; + char ipv6_addr[16]; + char ssid[SSID_BUF_SIZE]; + char password[SSID_BUF_SIZE]; +} AGpsExtStatus; + +/** Callback with AGPS status information. + * Can only be called from a thread created by create_thread_cb. + */ +typedef void (* agps_status_extended)(AGpsExtStatus* status); + +/** Callback structure for the AGPS interface. */ +typedef struct { + agps_status_extended status_cb; + gps_create_thread create_thread_cb; +} AGpsExtCallbacks; + + +/** GPS NI callback structure. */ +typedef struct +{ + /** + * Sends the notification request from HAL to GPSLocationProvider. + */ + gps_ni_notify_callback notify_cb; + gps_create_thread create_thread_cb; +} GpsNiExtCallbacks; + +#endif /* GPS_EXTENDED_H */ + diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 18d0fe05..d7362477 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -97,50 +97,6 @@ static const GpsInterface sLocEngInterface = loc_get_extension }; -// Function declarations for sLocEngAGpsInterface -static void loc_agps_init(AGpsCallbacks* callbacks); -#ifdef FEATURE_IPV6 -static int loc_agps_open(AGpsType agpsType, - const char* apn, AGpsBearerType bearerType); -static int loc_agps_closed(AGpsType agpsType); -static int loc_agps_open_failed(AGpsType agpsType); -#else -static int loc_agps_open(const char* apn); -static int loc_agps_closed(); -static int loc_agps_open_failed(); -#endif -static int loc_agps_set_server(AGpsType type, const char *hostname, int port); - -static const AGpsInterface sLocEngAGpsInterface = -{ - sizeof(AGpsInterface), - loc_agps_init, - loc_agps_open, - loc_agps_closed, - loc_agps_open_failed, - loc_agps_set_server -}; - -static int loc_xtra_init(GpsXtraCallbacks* callbacks); -static int loc_xtra_inject_data(char* data, int length); - -static const GpsXtraInterface sLocEngXTRAInterface = -{ - sizeof(GpsXtraInterface), - loc_xtra_init, - loc_xtra_inject_data -}; - -static void loc_ni_init(GpsNiCallbacks *callbacks); -static void loc_ni_respond(int notif_id, GpsUserResponseType user_response); - -const GpsNiInterface sLocEngNiInterface = -{ - sizeof(GpsNiInterface), - loc_ni_init, - loc_ni_respond, -}; - static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ); static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct); static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); @@ -301,12 +257,9 @@ static int loc_init(GpsCallbacks* callbacks) LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | LOC_API_ADAPTER_BIT_SATELLITE_REPORT | - LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | - LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | LOC_API_ADAPTER_BIT_IOCTL_REPORT | LOC_API_ADAPTER_BIT_STATUS_REPORT | - LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | - LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; + LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; LocCallbacks clientCallbacks = {loc_cb, /* location_cb */ callbacks->status_cb, /* status_cb */ sv_cb, /* sv_status_cb */ @@ -537,10 +490,8 @@ SIDE EFFECTS ===========================================================================*/ static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty) { - ENTRY_LOG(); - int ret_val = loc_eng_inject_time(loc_afw_data, time, timeReference, uncertainty); - EXIT_LOG(%d, ret_val); - return ret_val; + //inject time not handled by AFW + return 0; } @@ -704,19 +655,16 @@ const void* loc_get_extension(const char* name) LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name); if (strcmp(name, GPS_XTRA_INTERFACE) == 0) { - ret_val = &sLocEngXTRAInterface; + //xtra not handled by AFW } - else if (strcmp(name, AGPS_INTERFACE) == 0) { - ret_val = &sLocEngAGpsInterface; + //agps not handled by AFW } - else if (strcmp(name, GPS_NI_INTERFACE) == 0) { - ret_val = &sLocEngNiInterface; + //ni not handled by AFW } - else if (strcmp(name, AGPS_RIL_INTERFACE) == 0) { char baseband[PROPERTY_VALUE_MAX]; @@ -746,7 +694,6 @@ const void* loc_get_extension(const char* name) { ret_val = get_geofence_interface(); } - else { LOC_LOGE ("get_extension: Invalid interface passed in\n"); @@ -755,274 +702,6 @@ const void* loc_get_extension(const char* name) return ret_val; } -/*=========================================================================== -FUNCTION loc_agps_init - -DESCRIPTION - Initialize the AGps interface. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -static void loc_agps_init(AGpsCallbacks* callbacks) -{ - ENTRY_LOG(); - loc_eng_agps_init(loc_afw_data, callbacks); - EXIT_LOG(%s, VOID_RET); -} - -/*=========================================================================== -FUNCTION loc_agps_open - -DESCRIPTION - This function is called when on-demand data connection opening is successful. -It should inform ARM 9 about the data open result. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -#ifdef FEATURE_IPV6 -static int loc_agps_open(AGpsType agpsType, - const char* apn, AGpsBearerType bearerType) -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#else -static int loc_agps_open(const char* apn) -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_open(loc_afw_data, apn); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#endif - -/*=========================================================================== -FUNCTION loc_agps_closed - -DESCRIPTION - This function is called when on-demand data connection closing is done. -It should inform ARM 9 about the data close result. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -#ifdef FEATURE_IPV6 -static int loc_agps_closed(AGpsType agpsType) -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#else -static int loc_agps_closed() -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_closed(loc_afw_data); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#endif - -/*=========================================================================== -FUNCTION loc_agps_open_failed - -DESCRIPTION - This function is called when on-demand data connection opening has failed. -It should inform ARM 9 about the data open result. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -#ifdef FEATURE_IPV6 -int loc_agps_open_failed(AGpsType agpsType) -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#else -int loc_agps_open_failed() -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_open_failed(loc_afw_data); - - EXIT_LOG(%d, ret_val); - return ret_val; -} -#endif - -/*=========================================================================== -FUNCTION loc_agps_set_server - -DESCRIPTION - If loc_eng_set_server is called before loc_eng_init, it doesn't work. This - proxy buffers server settings and calls loc_eng_set_server when the client is - open. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int loc_agps_set_server(AGpsType type, const char* hostname, int port) -{ - ENTRY_LOG(); - LocServerType serverType; - switch (type) { - case AGPS_TYPE_SUPL: - serverType = LOC_AGPS_SUPL_SERVER; - break; - case AGPS_TYPE_C2K: - serverType = LOC_AGPS_CDMA_PDE_SERVER; - break; - } - int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port); - - EXIT_LOG(%d, ret_val); - return ret_val; -} - -/*=========================================================================== -FUNCTION loc_xtra_init - -DESCRIPTION - Initialize XTRA module. - -DEPENDENCIES - None - -RETURN VALUE - 0: success - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int loc_xtra_init(GpsXtraCallbacks* callbacks) -{ - ENTRY_LOG(); - int ret_val = loc_eng_xtra_init(loc_afw_data, callbacks); - - EXIT_LOG(%d, ret_val); - return ret_val; -} - - -/*=========================================================================== -FUNCTION loc_xtra_inject_data - -DESCRIPTION - Initialize XTRA module. - -DEPENDENCIES - None - -RETURN VALUE - 0: success - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int loc_xtra_inject_data(char* data, int length) -{ - ENTRY_LOG(); - int ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length); - - EXIT_LOG(%d, ret_val); - return ret_val; -} - -/*=========================================================================== -FUNCTION loc_ni_init - -DESCRIPTION - This function initializes the NI interface - -DEPENDENCIES - NONE - -RETURN VALUE - None - -SIDE EFFECTS - N/A - -===========================================================================*/ -void loc_ni_init(GpsNiCallbacks *callbacks) -{ - ENTRY_LOG(); - loc_eng_ni_init(loc_afw_data, callbacks); - EXIT_LOG(%s, VOID_RET); -} - -/*=========================================================================== -FUNCTION loc_ni_respond - -DESCRIPTION - This function sends an NI respond to the modem processor - -DEPENDENCIES - NONE - -RETURN VALUE - None - -SIDE EFFECTS - N/A - -===========================================================================*/ -void loc_ni_respond(int notif_id, GpsUserResponseType user_response) -{ - ENTRY_LOG(); - loc_eng_ni_respond(loc_afw_data, notif_id, user_response); - EXIT_LOG(%s, VOID_RET); -} - // Below stub functions are members of sLocEngAGpsRilInterface static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {} static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {} diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index 51273ddf..08392179 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,6 +38,7 @@ extern "C" { #include #include #include +#include "gps_extended.h" #define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */ diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 8fa87a0b..fb24249d 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -869,7 +869,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsCallbacks* callbacks) +void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks) { ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.context, return); @@ -886,14 +886,12 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsCallbacks* callbac loc_eng_data.agnss_nif = new AgpsStateMachine(loc_eng_data.agps_status_cb, AGPS_TYPE_SUPL, false); -#ifdef FEATURE_IPV6 loc_eng_data.internet_nif = new AgpsStateMachine(loc_eng_data.agps_status_cb, AGPS_TYPE_WWAN_ANY, false); loc_eng_data.wifi_nif = new AgpsStateMachine(loc_eng_data.agps_status_cb, AGPS_TYPE_WIFI, true); -#endif loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, NULL, NULL, &loc_eng_data); @@ -919,8 +917,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -#ifdef FEATURE_IPV6 -int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType, +int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType, const char* apn, AGpsBearerType bearerType) { ENTRY_LOG_CALLFLOW(); @@ -945,33 +942,6 @@ int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType, EXIT_LOG(%d, 0); return 0; } -#else -int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, - const char* apn) -{ - ENTRY_LOG_CALLFLOW(); - INIT_CHECK(loc_eng_data.context && loc_eng_data.agps_status_cb, - return -1); - - if (apn == NULL) - { - LOC_LOGE("APN Name NULL\n"); - return 0; - } - - LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn); - - int apn_len = smaller_of(strlen (apn), MAX_APN_LEN); - loc_eng_msg_atl_open_success *msg( - new loc_eng_msg_atl_open_success(&loc_eng_data, apn, - apn_len)); - msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, - msg, loc_eng_free_msg); - - EXIT_LOG(%d, 0); - return 0; -} -#endif /*=========================================================================== FUNCTION loc_eng_agps_closed @@ -990,8 +960,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -#ifdef FEATURE_IPV6 -int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType) +int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType) { ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.context && loc_eng_data.agps_status_cb, @@ -1004,21 +973,6 @@ int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType) EXIT_LOG(%d, 0); return 0; } -#else -int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data) -{ - ENTRY_LOG_CALLFLOW(); - INIT_CHECK(loc_eng_data.context && loc_eng_data.agps_status_cb, - return -1); - - loc_eng_msg_atl_closed *msg(new loc_eng_msg_atl_closed(&loc_eng_data)); - msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, - msg, loc_eng_free_msg); - - EXIT_LOG(%d, 0); - return 0; -} -#endif /*=========================================================================== FUNCTION loc_eng_agps_open_failed @@ -1037,8 +991,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -#ifdef FEATURE_IPV6 -int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType) +int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType) { ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.context && loc_eng_data.agps_status_cb, @@ -1051,21 +1004,6 @@ int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsTyp EXIT_LOG(%d, 0); return 0; } -#else -int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data) -{ - ENTRY_LOG_CALLFLOW(); - INIT_CHECK(loc_eng_data.context && loc_eng_data.agps_status_cb, - return -1); - - loc_eng_msg_atl_open_failed *msg(new loc_eng_msg_atl_open_failed(&loc_eng_data)); - msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q, - msg, loc_eng_free_msg); - - EXIT_LOG(%d, 0); - return 0; -} -#endif /*=========================================================================== @@ -1365,9 +1303,7 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) if (loc_eng_data.agps_status_cb != NULL) { loc_eng_data.agnss_nif->dropAllSubscribers(); -#ifdef FEATURE_IPV6 loc_eng_data.internet_nif->dropAllSubscribers(); -#endif loc_eng_agps_reinit(loc_eng_data); } @@ -1680,10 +1616,8 @@ static void loc_eng_deferred_action_thread(void* arg) loc_eng_msg_request_bit* brqMsg = (loc_eng_msg_request_bit*)msg; if (brqMsg->ifType == LOC_ENG_IF_REQUEST_TYPE_SUPL) { stateMachine = loc_eng_data_p->agnss_nif; -#ifdef FEATURE_IPV6 } else if (brqMsg->ifType == LOC_ENG_IF_REQUEST_TYPE_ANY) { stateMachine = loc_eng_data_p->internet_nif; -#endif } else { LOC_LOGD("%s]%d: unknown I/F request type = 0x%x\n", __func__, __LINE__, brqMsg->ifType); break; @@ -1700,10 +1634,8 @@ static void loc_eng_deferred_action_thread(void* arg) loc_eng_msg_release_bit* brlMsg = (loc_eng_msg_release_bit*)msg; if (brlMsg->ifType == LOC_ENG_IF_REQUEST_TYPE_SUPL) { stateMachine = loc_eng_data_p->agnss_nif; -#ifdef FEATURE_IPV6 } else if (brlMsg->ifType == LOC_ENG_IF_REQUEST_TYPE_ANY) { stateMachine = loc_eng_data_p->internet_nif; -#endif } else { LOC_LOGD("%s]%d: unknown I/F request type = 0x%x\n", __func__, __LINE__, brlMsg->ifType); break; @@ -1717,16 +1649,11 @@ static void loc_eng_deferred_action_thread(void* arg) case LOC_ENG_MSG_REQUEST_ATL: { loc_eng_msg_request_atl* arqMsg = (loc_eng_msg_request_atl*)msg; -#ifdef FEATURE_IPV6 boolean backwardCompatibleMode = AGPS_TYPE_INVALID == arqMsg->type; AgpsStateMachine* stateMachine = (AGPS_TYPE_SUPL == arqMsg->type || backwardCompatibleMode) ? loc_eng_data_p->agnss_nif : loc_eng_data_p->internet_nif; -#else - boolean backwardCompatibleMode = false; - AgpsStateMachine* stateMachine = loc_eng_data_p->agnss_nif; -#endif ATLSubscriber subscriber(arqMsg->handle, stateMachine, loc_eng_data_p->client_handle, @@ -1745,19 +1672,16 @@ static void loc_eng_deferred_action_thread(void* arg) false); // attempt to unsubscribe from agnss_nif first if (! loc_eng_data_p->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) { -#ifdef FEATURE_IPV6 ATLSubscriber s2(arlMsg->handle, loc_eng_data_p->internet_nif, loc_eng_data_p->client_handle, false); // if unsuccessful, try internet_nif loc_eng_data_p->internet_nif->unsubscribeRsrc((Subscriber*)&s2); -#endif } } break; -#ifdef FEATURE_IPV6 case LOC_ENG_MSG_REQUEST_WIFI: { loc_eng_msg_request_wifi *wrqMsg = (loc_eng_msg_request_wifi *)msg; @@ -1782,7 +1706,6 @@ static void loc_eng_deferred_action_thread(void* arg) stateMachine->unsubscribeRsrc((Subscriber*)&subscriber); } break; -#endif case LOC_ENG_MSG_REQUEST_XTRA_DATA: if (loc_eng_data_p->xtra_module_data.download_request_cb != NULL) @@ -1829,7 +1752,7 @@ static void loc_eng_deferred_action_thread(void* arg) { loc_eng_msg_atl_open_success *aosMsg = (loc_eng_msg_atl_open_success*)msg; AgpsStateMachine* stateMachine; -#ifdef FEATURE_IPV6 + switch (aosMsg->agpsType) { case AGPS_TYPE_WIFI: { stateMachine = loc_eng_data_p->wifi_nif; @@ -1845,9 +1768,6 @@ static void loc_eng_deferred_action_thread(void* arg) } stateMachine->setBearer(aosMsg->bearerType); -#else - stateMachine = loc_eng_data_p->agnss_nif; -#endif stateMachine->setAPN(aosMsg->apn, aosMsg->length); stateMachine->onRsrcEvent(RSRC_GRANTED); } @@ -1857,7 +1777,7 @@ static void loc_eng_deferred_action_thread(void* arg) { loc_eng_msg_atl_closed *acsMsg = (loc_eng_msg_atl_closed*)msg; AgpsStateMachine* stateMachine; -#ifdef FEATURE_IPV6 + switch (acsMsg->agpsType) { case AGPS_TYPE_WIFI: { stateMachine = loc_eng_data_p->wifi_nif; @@ -1871,9 +1791,6 @@ static void loc_eng_deferred_action_thread(void* arg) stateMachine = loc_eng_data_p->internet_nif; } } -#else - stateMachine = loc_eng_data_p->agnss_nif; -#endif stateMachine->onRsrcEvent(RSRC_RELEASED); } break; @@ -1882,7 +1799,7 @@ static void loc_eng_deferred_action_thread(void* arg) { loc_eng_msg_atl_open_failed *aofMsg = (loc_eng_msg_atl_open_failed*)msg; AgpsStateMachine* stateMachine; -#ifdef FEATURE_IPV6 + switch (aofMsg->agpsType) { case AGPS_TYPE_WIFI: { stateMachine = loc_eng_data_p->wifi_nif; @@ -1896,9 +1813,6 @@ static void loc_eng_deferred_action_thread(void* arg) stateMachine = loc_eng_data_p->internet_nif; } } -#else - stateMachine = loc_eng_data_p->agnss_nif; -#endif stateMachine->onRsrcEvent(RSRC_DENIED); } break; diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index d61cb12b..38940977 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -101,7 +101,7 @@ typedef struct loc_location_cb_ext location_cb; gps_status_callback status_cb; loc_sv_status_cb_ext sv_status_cb; - agps_status_callback agps_status_cb; + agps_status_extended agps_status_cb; gps_nmea_callback nmea_cb; gps_ni_notify_callback ni_notify_cb; gps_acquire_wakelock acquire_wakelock_cb; @@ -224,17 +224,11 @@ int loc_eng_update_criteria(loc_eng_data_s_type &loc_eng_data, UlpLocationCriteria criteria); void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, - AGpsCallbacks* callbacks); -#ifdef FEATURE_IPV6 -int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType, + AGpsExtCallbacks* callbacks); +int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType, const char* apn, AGpsBearerType bearerType); -int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType); -int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType); -#else -int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, const char* apn); -int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data); -int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data); -#endif +int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); +int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, LocServerType type, const char *hostname, int port); @@ -251,13 +245,13 @@ bool loc_eng_inject_raw_command(loc_eng_data_s_type &loc_eng_data, void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data); int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, - GpsXtraCallbacks* callbacks); + GpsXtraExtCallbacks* callbacks); int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, char* data, int length); extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, - GpsNiCallbacks *callbacks); + GpsNiExtCallbacks *callbacks); extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data, int notif_id, GpsUserResponseType user_response); extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp index 5bdae3d7..1f7d1ab7 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.cpp +++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -154,36 +154,22 @@ bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification) break; case RSRC_DENIED: { -#ifdef FEATURE_IPV6 - AGpsType type = mBackwardCompatibleMode ? + AGpsExtType type = mBackwardCompatibleMode ? AGPS_TYPE_INVALID : mStateMachine->getType(); ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0, (char*)mStateMachine->getAPN(), mStateMachine->getBearer(), type); -#else - AGpsType type = mStateMachine->getType(); - ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0, - (char*)mStateMachine->getAPN(), - type); -#endif } break; case RSRC_GRANTED: { -#ifdef FEATURE_IPV6 - AGpsType type = mBackwardCompatibleMode ? + AGpsExtType type = mBackwardCompatibleMode ? AGPS_TYPE_INVALID : mStateMachine->getType(); ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1, (char*)mStateMachine->getAPN(), mStateMachine->getBearer(), type); -#else - AGpsType type = mStateMachine->getType(); - ((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1, - (char*)mStateMachine->getAPN(), - type); -#endif } break; default: @@ -194,7 +180,6 @@ bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification) return notify; } -#ifdef FEATURE_IPV6 bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification) { bool notify = forMe(notification); @@ -226,7 +211,6 @@ bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification) return notify; } -#endif //====================================================================== // AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState @@ -567,8 +551,8 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data) // AgpsStateMachine //====================================================================== -AgpsStateMachine::AgpsStateMachine(void (*servicer)(AGpsStatus* status), - AGpsType type, +AgpsStateMachine::AgpsStateMachine(void (*servicer)(AGpsExtStatus* status), + AGpsExtType type, bool enforceSingleSubscriber) : mServicer(servicer), mType(type), mStatePtr(new AgpsReleasedState(this)), @@ -698,12 +682,11 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const (void*)¬ification, false); if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) { - AGpsStatus nifRequest; + AGpsExtStatus nifRequest; nifRequest.size = sizeof(nifRequest); nifRequest.type = mType; nifRequest.status = action; -#ifdef FEATURE_IPV6 if (s == NULL) { nifRequest.ipv4_addr = INADDR_NONE; nifRequest.ipv6_addr[0] = 0; @@ -713,13 +696,6 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr); s->setWifiInfo(nifRequest.ssid, nifRequest.password); } -#else - if (s == NULL) { - nifRequest.ipaddr = INADDR_NONE; - } else { - nifRequest.ipaddr = s->ID; - } -#endif CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action)); (*mServicer)(&nifRequest); diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index 22160c36..ff5a92ab 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -137,9 +137,9 @@ class AgpsStateMachine { friend class AgpsState; // handle to whoever provides the service - void (* const mServicer)(AGpsStatus* status); + void (* const mServicer)(AGpsExtStatus* status); // NIF type: AGNSS or INTERNET. - const AGpsType mType; + const AGpsExtType mType; // pointer to the current state. AgpsState* mStatePtr; // a linked list of subscribers. @@ -150,25 +150,21 @@ class AgpsStateMachine { char* mAPN; // for convenience, we don't do strlen each time. unsigned int mAPNLen; -#ifdef FEATURE_IPV6 // bear AGpsBearerType mBearer; -#endif // ipv4 address for routing bool mEnforceSingleSubscriber; public: - AgpsStateMachine(void (*servicer)(AGpsStatus* status), AGpsType type, bool enforceSingleSubscriber); + AgpsStateMachine(void (*servicer)(AGpsExtStatus* status), AGpsExtType type, bool enforceSingleSubscriber); virtual ~AgpsStateMachine(); // self explanatory methods below void setAPN(const char* apn, unsigned int len); inline const char* getAPN() const { return (const char*)mAPN; } -#ifdef FEATURE_IPV6 inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; } inline AGpsBearerType getBearer() const { return mBearer; } -#endif - inline AGpsType getType() const { return (AGpsType)mType; } + inline AGpsExtType getType() const { return (AGpsExtType)mType; } // someone, a ATL client or BIT, is asking for NIF void subscribeRsrc(Subscriber *subscriber); @@ -279,7 +275,6 @@ struct ATLSubscriber : public Subscriber { } }; -#ifdef FEATURE_IPV6 // WIFISubscriber, created with requests from MSAPM or QuIPC struct WIFISubscriber : public Subscriber { char * mSSID; @@ -326,6 +321,5 @@ struct WIFISubscriber : public Subscriber { return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId); } }; -#endif #endif //__LOC_ENG_AGPS_H__ diff --git a/loc_api/libloc_api_50001/loc_eng_log.cpp b/loc_api/libloc_api_50001/loc_eng_log.cpp index 895db1db..99959abb 100644 --- a/loc_api/libloc_api_50001/loc_eng_log.cpp +++ b/loc_api/libloc_api_50001/loc_eng_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -189,15 +189,11 @@ const char* loc_get_aiding_data_mask_names(GpsAidingData data) static loc_name_val_s_type loc_eng_agps_types[] = { -#ifdef FEATURE_IPV6 NAME_VAL( AGPS_TYPE_INVALID ), NAME_VAL( AGPS_TYPE_ANY ), -#endif NAME_VAL( AGPS_TYPE_SUPL ), - NAME_VAL( AGPS_TYPE_C2K ) -#ifdef FEATURE_IPV6 - ,NAME_VAL( AGPS_TYPE_WWAN_ANY ) -#endif + NAME_VAL( AGPS_TYPE_C2K ), + NAME_VAL( AGPS_TYPE_WWAN_ANY ) }; static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type); @@ -250,7 +246,6 @@ const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding) return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding); } -#ifdef FEATURE_IPV6 static loc_name_val_s_type loc_eng_agps_bears[] = { NAME_VAL( AGPS_APN_BEARER_INVALID ), @@ -264,7 +259,6 @@ const char* loc_get_agps_bear_name(AGpsBearerType bearer) { return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer); } -#endif static loc_name_val_s_type loc_eng_server_types[] = { diff --git a/loc_api/libloc_api_50001/loc_eng_log.h b/loc_api/libloc_api_50001/loc_eng_log.h index 4ee978af..95a672fd 100644 --- a/loc_api/libloc_api_50001/loc_eng_log.h +++ b/loc_api/libloc_api_50001/loc_eng_log.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,9 +48,7 @@ const char* loc_get_agps_type_name(AGpsType type); const char* loc_get_ni_type_name(GpsNiType type); const char* loc_get_ni_response_name(GpsUserResponseType response); const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding); -#ifdef FEATURE_IPV6 const char* loc_get_agps_bear_name(AGpsBearerType bear); -#endif const char* loc_get_server_type_name(LocServerType type); const char* loc_get_position_sess_status_name(enum loc_sess_status status); const char* loc_get_agps_status_name(AGpsStatusValue status); diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index df7cc092..7b14cf11 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -39,10 +39,6 @@ #include #include "loc_eng_msg_id.h" -#ifndef SSID_BUF_SIZE - #define SSID_BUF_SIZE (32+1) -#endif - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -720,7 +716,6 @@ struct loc_eng_msg_inject_xtra_data : public loc_eng_msg { } }; -#ifdef FEATURE_IPV6 struct loc_eng_msg_atl_open_success : public loc_eng_msg { const AGpsStatusValue agpsType; const int length; @@ -747,30 +742,8 @@ struct loc_eng_msg_atl_open_success : public loc_eng_msg { delete[] apn; } }; -#else -struct loc_eng_msg_atl_open_success : public loc_eng_msg { - const int length; - char* const apn; - inline loc_eng_msg_atl_open_success(void* instance, - const char* name, - int len) : - loc_eng_msg(instance, LOC_ENG_MSG_ATL_OPEN_SUCCESS), - length(len), - apn(new char[len+1]) - { - memcpy((void*)apn, (void*)name, len); - apn[len] = 0; - LOC_LOGV("apn: %s\n", - apn); - } - inline ~loc_eng_msg_atl_open_success() - { - delete[] apn; - } -}; -#endif -#ifdef FEATURE_IPV6 + struct loc_eng_msg_atl_open_failed : public loc_eng_msg { const AGpsStatusValue agpsType; inline loc_eng_msg_atl_open_failed(void* instance, @@ -782,17 +755,8 @@ struct loc_eng_msg_atl_open_failed : public loc_eng_msg { loc_get_agps_type_name(agpsType)); } }; -#else -struct loc_eng_msg_atl_open_failed : public loc_eng_msg { - inline loc_eng_msg_atl_open_failed(void* instance) : - loc_eng_msg(instance, LOC_ENG_MSG_ATL_OPEN_FAILED) - { - LOC_LOGV(""); - } -}; -#endif -#ifdef FEATURE_IPV6 + struct loc_eng_msg_atl_closed : public loc_eng_msg { const AGpsStatusValue agpsType; inline loc_eng_msg_atl_closed(void* instance, @@ -804,15 +768,6 @@ struct loc_eng_msg_atl_closed : public loc_eng_msg { loc_get_agps_type_name(agpsType)); } }; -#else -struct loc_eng_msg_atl_closed : public loc_eng_msg { - inline loc_eng_msg_atl_closed(void* instance) : - loc_eng_msg(instance, LOC_ENG_MSG_ATL_CLOSED) - { - LOC_LOGV(""); - } -}; -#endif struct loc_eng_msg_set_data_enable : public loc_eng_msg { const int enable; diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index 146b15b5..29900039 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -245,7 +245,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiCallbacks *callbacks) +void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks) { ENTRY_LOG_CALLFLOW(); diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp index 4b2d109d..e971891e 100644 --- a/loc_api/libloc_api_50001/loc_eng_xtra.cpp +++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -52,7 +52,7 @@ SIDE EFFECTS ===========================================================================*/ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, - GpsXtraCallbacks* callbacks) + GpsXtraExtCallbacks* callbacks) { int ret_val = -1; loc_eng_xtra_data_s_type *xtra_module_data_ptr; diff --git a/loc_api/loc_api_v02/Android.mk b/loc_api/loc_api_v02/Android.mk index 8617f3cb..b5b55303 100644 --- a/loc_api/loc_api_v02/Android.mk +++ b/loc_api/loc_api_v02/Android.mk @@ -28,10 +28,6 @@ LOCAL_CFLAGS += \ -fno-short-enums \ -D_ANDROID_ -ifeq ($(FEATURE_IPV6), true) -LOCAL_CFLAGS += -DFEATURE_IPV6 -endif #FEATURE_IPV6 - ifeq ($(FEATURE_DELEXT), true) LOCAL_CFLAGS += -DFEATURE_DELEXT endif #FEATURE_DELEXT diff --git a/loc_api/loc_api_v02/LocApiV02Adapter.cpp b/loc_api/loc_api_v02/LocApiV02Adapter.cpp index d7276e95..33bc36a0 100644 --- a/loc_api/loc_api_v02/LocApiV02Adapter.cpp +++ b/loc_api/loc_api_v02/LocApiV02Adapter.cpp @@ -1022,30 +1022,19 @@ enum loc_api_adapter_err LocApiV02Adapter :: setXtraData( return LOC_API_ADAPTER_ERR_SUCCESS; } -#ifdef FEATURE_IPV6 enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus( int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType) -#else -enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus( - int handle, int is_succ, char* apn, - AGpsType agpsType) -#endif { locClientStatusEnumType result = eLOC_CLIENT_SUCCESS; locClientReqUnionType req_union; qmiLocInformLocationServerConnStatusReqMsgT_v02 conn_status_req; qmiLocInformLocationServerConnStatusIndMsgT_v02 conn_status_ind; -#ifdef FEATURE_IPV6 + LOC_LOGD("%s:%d]: ATL open handle = %d, is_succ = %d, " "APN = [%s], bearer = %d \n", __func__, __LINE__, handle, is_succ, apn, bear); -#else - LOC_LOGD("%s:%d]: ATL open handle = %d, is_succ = %d, " - "APN = [%s] \n", __func__, __LINE__, - handle, is_succ, apn); -#endif memset(&conn_status_req, 0, sizeof(conn_status_req)); memset(&conn_status_ind, 0, sizeof(conn_status_ind)); @@ -1062,7 +1051,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus( strlcpy(conn_status_req.apnProfile.apnName, apn, sizeof(conn_status_req.apnProfile.apnName) ); -#ifdef FEATURE_IPV6 switch(bear) { case AGPS_APN_BEARER_IPV4: @@ -1084,10 +1072,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus( LOC_LOGE("%s:%d]:invalid bearer type\n",__func__,__LINE__); return LOC_API_ADAPTER_ERR_INVALID_HANDLE; } -#else - conn_status_req.apnProfile.pdnType = - eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4_V02; -#endif conn_status_req.apnProfile_valid = 1; } @@ -1915,7 +1899,7 @@ void LocApiV02Adapter :: reportAtlRequest( if(server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_OPEN_V02 ) { AGpsType agpsType; -#ifdef FEATURE_IPV6 + switch(server_request_ptr->wwanType) { case eQMI_LOC_WWAN_TYPE_INTERNET_V02: @@ -1930,9 +1914,7 @@ void LocApiV02Adapter :: reportAtlRequest( agpsType = AGPS_TYPE_WWAN_ANY; break; } -#else - agpsType = AGPS_TYPE_SUPL; -#endif + LocApiAdapter::requestATL(connHandle, agpsType); } diff --git a/loc_api/loc_api_v02/LocApiV02Adapter.h b/loc_api/loc_api_v02/LocApiV02Adapter.h index 10ea4069..3eda7526 100644 --- a/loc_api/loc_api_v02/LocApiV02Adapter.h +++ b/loc_api/loc_api_v02/LocApiV02Adapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -138,15 +138,9 @@ public: setServer(unsigned int ip, int port, LocServerType type); virtual enum loc_api_adapter_err setXtraData(char* data, int length); -#ifdef FEATURE_IPV6 virtual enum loc_api_adapter_err atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType); -#else - virtual enum loc_api_adapter_err - atlOpenStatus(int handle, int is_succ, char* apn, - AGpsType agpsType); -#endif virtual enum loc_api_adapter_err atlCloseStatus(int handle, int is_succ); virtual enum loc_api_adapter_err setSUPLVersion(uint32_t version); virtual enum loc_api_adapter_err setLPPConfig(uint32_t profile);