Return NULL AGPS interface on APQ target.

The AGPS interface will be returned
as null if MSA and MSB capabilities
are not set in gps config

Change-Id: I388654c9f527bfed128f431ccb8956e19be0f7f2
(cherry picked from commit 50891ecfe09b19a130b675ddc818ecf4ae31a3da)
This commit is contained in:
Tushar Janefalkar 2013-08-07 18:48:22 -07:00 committed by Sridhar Nelloru
parent 61fedb4567
commit 782431aff0
2 changed files with 31 additions and 1 deletions

View file

@ -571,8 +571,20 @@ const void* loc_get_extension(const char* name)
}
else if (strcmp(name, AGPS_INTERFACE) == 0)
{
//Return an interface to AGPS only if MSA or MSB capabilities
//are present. If the target is an APQ, these masks are
//cleared in get_gps_interface() and the below logic will
//return NULL as the interface for AGPS
if((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) {
LOC_LOGD("%s:%d]: AGPS capabilities found\n", __func__, __LINE__);
ret_val = &sLocEngAGpsInterface;
}
else {
LOC_LOGD("%s:%d]: Returning NULL AgpsInterface\n", __func__, __LINE__);
ret_val = NULL;
}
}
else if (strcmp(name, GPS_NI_INTERFACE) == 0)
{
ret_val = &sLocEngNiInterface;

View file

@ -1454,6 +1454,13 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
loc_eng_data.generateNmea = false;
}
//Disable AGPS if capabilities are not present
if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA)) {
event &= ~(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST);
}
loc_eng_data.adapter =
new LocEngAdapter(event, &loc_eng_data,
(MsgTask::tCreate)callbacks->create_thread_cb);
@ -1950,6 +1957,17 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call
EXIT_LOG(%s, VOID_RET);
return;
}
//Proceed to create AGPS framework only if MSA or MSB capabilities
//are present. If the target is an APQ, these masks are
//cleared in get_gps_interface()
if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) {
LOC_LOGD("%s:%d]: No AGPS capabilities found. Returning\n",
__func__, __LINE__);
return;
}
loc_eng_data.agps_status_cb = callbacks->status_cb;
loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,