aboutsummaryrefslogtreecommitdiff
path: root/gps/core/ContextBase.cpp
diff options
context:
space:
mode:
authorFedor917 <cryscript@gmail.com>2016-11-10 15:53:00 +0700
committerFedor917 <cryscript@gmail.com>2016-11-10 15:53:00 +0700
commitf7102b858dc849cc94255bc96f95b880dfd93452 (patch)
tree3e6164b0b02bb62f7093ddc44bbbaebaf44aacf8 /gps/core/ContextBase.cpp
parentcc834f0c4bb0ce51baddc42d11935438bf63394a (diff)
Initialising brunch based on davidevinavil device tree (CM14.0 branch)
Diffstat (limited to 'gps/core/ContextBase.cpp')
-rw-r--r--gps/core/ContextBase.cpp72
1 files changed, 48 insertions, 24 deletions
diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
index 9f6c4aa..d2f9070 100644
--- a/gps/core/ContextBase.cpp
+++ b/gps/core/ContextBase.cpp
@@ -35,11 +35,32 @@
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
-#include <log_util.h>
+#include <platform_lib_includes.h>
#include <loc_log.h>
namespace loc_core {
+loc_gps_cfg_s_type ContextBase::mGps_conf {0};
+loc_sap_cfg_s_type ContextBase::mSap_conf {0};
+
+uint32_t ContextBase::getCarrierCapabilities() {
+ #define carrierMSA (uint32_t)0x2
+ #define carrierMSB (uint32_t)0x1
+ #define gpsConfMSA (uint32_t)0x4
+ #define gpsConfMSB (uint32_t)0x2
+ uint32_t capabilities = mGps_conf.CAPABILITIES;
+ if ((mGps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
+ capabilities &= ~gpsConfMSA;
+ }
+ if ((mGps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
+ capabilities &= ~gpsConfMSB;
+ }
+
+ LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
+ mGps_conf.CAPABILITIES, mGps_conf.SUPL_MODE, capabilities);
+ return capabilities;
+}
+
LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
{
LBSProxyBase* proxy = NULL;
@@ -52,6 +73,10 @@ LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
proxy = (*getter)();
}
}
+ else
+ {
+ LOC_LOGW("%s:%d]: FAILED TO LOAD libname: %s\n", __func__, __LINE__, libName);
+ }
if (NULL == proxy) {
proxy = new LBSProxyBase();
}
@@ -63,30 +88,29 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
{
LocApiBase* locApi = NULL;
- // first if can not be MPQ
- if (TARGET_MPQ != loc_get_target()) {
- if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
- 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(getter != NULL) {
- LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
- locApi = (*getter)(mMsgTask, exMask, this);
- }
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ 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 (getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
+ __LINE__);
+ locApi = (*getter)(mMsgTask, exMask, this);
}
- // 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, this);
- }
+ }
+ // 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, this);
}
}
}