From 39bc6e266bc2be92910901f6b14b8ad10ee8ce3d Mon Sep 17 00:00:00 2001 From: Jiafei Wen Date: Wed, 20 Nov 2013 17:04:39 -0800 Subject: [PATCH] Emergency SUPL This change is for the new added emergency SUPL session. Adding a new field in gps.conf named SUPL_ES, which is for emergency supl NI. CRs-fixed: 600375 Change-Id: I7c21c5589259df4f1cb7ec2f850e708b2c4faa1a --- core/gps_extended_c.h | 4 +++- core/loc_core_log.cpp | 5 +++-- etc/gps.conf | 3 +++ loc_api/libloc_api_50001/loc_eng_ni.cpp | 16 ++++++++++++---- loc_api/libloc_api_50001/loc_eng_ni.h | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index f970b644..55c158e3 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, 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 @@ -61,6 +61,8 @@ extern "C" { #define ULP_MIN_INTERVAL_INVALID 0xffffffff +/*Emergency SUPL*/ +#define GPS_NI_TYPE_EMERGENCY_SUPL 4 typedef struct { /** set to sizeof(UlpLocation) */ diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp index 461273ff..af2cced7 100644 --- a/core/loc_core_log.cpp +++ b/core/loc_core_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, 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 @@ -161,7 +161,8 @@ static loc_name_val_s_type loc_eng_ni_types[] = { NAME_VAL( GPS_NI_TYPE_VOICE ), NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ), - NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ) + NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ), + NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL ) }; static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type); diff --git a/etc/gps.conf b/etc/gps.conf index 15dda2a4..b79b3801 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -29,6 +29,9 @@ INTERMEDIATE_POS=0 # supl version 1.0 SUPL_VER=0x10000 +# Emergency SUPL, 1=enable, 0=disable +SUPL_ES=1 + # GPS Capabilities bit mask # SCHEDULING = 0x01 # MSB = 0x02 diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index f017cab6..74abfd42 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-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, 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 @@ -218,6 +218,8 @@ static void* ni_thread_proc(void *args) "pthread_cond_timedwait = %d\n",rc ); loc_eng_ni_data_p->respRecvd = FALSE; /* Reset the user response flag for the next session*/ + LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); + // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() @@ -225,9 +227,14 @@ static void* ni_thread_proc(void *args) LocEngInformNiResponse *msg = NULL; if (NULL != loc_eng_ni_data_p->rawRequest) { - msg = new LocEngInformNiResponse(adapter, - loc_eng_ni_data_p->resp, - loc_eng_ni_data_p->rawRequest); + if (loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE) { + LOC_LOGD("loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE \n"); + msg = new LocEngInformNiResponse(adapter, + loc_eng_ni_data_p->resp, + loc_eng_ni_data_p->rawRequest); + } else { + LOC_LOGD("this is the ignore reply for SUPL ES\n"); + } loc_eng_ni_data_p->rawRequest = NULL; } pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); @@ -236,6 +243,7 @@ static void* ni_thread_proc(void *args) loc_eng_ni_data_p->reqID++; if (NULL != msg) { + LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n"); adapter->sendMsg(msg); } diff --git a/loc_api/libloc_api_50001/loc_eng_ni.h b/loc_api/libloc_api_50001/loc_eng_ni.h index 9cbc57dc..8c076041 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.h +++ b/loc_api/libloc_api_50001/loc_eng_ni.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009,2011 The Linux Foundation. All rights reserved. +/* Copyright (c) 2009,2011,2014 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 @@ -34,6 +34,7 @@ #define LOC_NI_NO_RESPONSE_TIME 20 /* secs */ #define LOC_NI_NOTIF_KEY_ADDRESS "Address" +#define GPS_NI_RESPONSE_IGNORE 4 typedef struct { pthread_t thread; /* NI thread */