aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Janefalkar <tusharj@codeaurora.org>2014-05-27 17:10:23 -0700
committerDan Pasanen <dan.pasanen@gmail.com>2014-09-02 23:34:18 +0000
commit125a710193bd17768db3edcd228aebd79f53856e (patch)
tree0c7b5490af21b328f93d60421ac0ddbd064fe683
parent7ffda84d93e3e9c8b62b580b68f9cd7a40737e4c (diff)
Add option to fallback to LocApiV02
In case the lbs or izat libs are not present, fall back to LocApiV02 to obtain the qmi client handle. This change will enable basic GPS functionality without lbs or izat lib dependencies Change-Id: Ic2c8418d785e891ad0a660a615cd5111fafc4ff2
-rw-r--r--gps/core/ContextBase.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
index 1bd138e..8c2f8f0 100644
--- a/gps/core/ContextBase.cpp
+++ b/gps/core/ContextBase.cpp
@@ -66,12 +66,27 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
// first if can not be MPQ
if (TARGET_MPQ != loc_get_target()) {
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) {
- // only RPC is the option now
- void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
- if (NULL != handle) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
- if (NULL != getter) {
- locApi = (*getter)(mMsgTask, exMask);
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask,exMask);
+ }
+ }
+ // only RPC is the option now
+ else {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
+ __func__, __LINE__);
+ handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
+ if (NULL != handle) {
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if (NULL != getter) {
+ LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask, exMask);
+ }
}
}
}