Merge "dynamically build and load adapter libs"
This commit is contained in:
commit
b1c6ba1ffc
5 changed files with 32 additions and 14 deletions
|
@ -13,9 +13,11 @@ GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api/
|
||||||
|
|
||||||
endif #TARGET_NO_RPC
|
endif #TARGET_NO_RPC
|
||||||
|
|
||||||
|
ifeq (exists, $(shell test -d $(TOP)/vendor/qcom/proprietary/qmi-framework && echo exists))
|
||||||
#add QMI libraries for QMI targets
|
#add QMI libraries for QMI targets
|
||||||
QMI_BOARD_PLATFORM_LIST := msm8960
|
QMI_BOARD_PLATFORM_LIST := msm8960
|
||||||
QMI_BOARD_PLATFORM_LIST += msm8974
|
QMI_BOARD_PLATFORM_LIST += msm8974
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(call is-board-platform-in-list,$(QMI_BOARD_PLATFORM_LIST)),true)
|
ifeq ($(call is-board-platform-in-list,$(QMI_BOARD_PLATFORM_LIST)),true)
|
||||||
GPS_DIR_LIST += $(LOCAL_PATH)/loc_api_v02/
|
GPS_DIR_LIST += $(LOCAL_PATH)/loc_api_v02/
|
||||||
|
|
|
@ -19,7 +19,8 @@ LOCAL_MODULE_TAGS := optional
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
libutils \
|
libutils \
|
||||||
libcutils \
|
libcutils \
|
||||||
libgps.utils
|
libgps.utils \
|
||||||
|
libdl
|
||||||
|
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
loc_eng_log.cpp \
|
loc_eng_log.cpp \
|
||||||
|
@ -79,17 +80,6 @@ LOCAL_SRC_FILES += \
|
||||||
loc_eng_dmn_conn_glue_msg.c \
|
loc_eng_dmn_conn_glue_msg.c \
|
||||||
loc_eng_dmn_conn_glue_pipe.c
|
loc_eng_dmn_conn_glue_pipe.c
|
||||||
|
|
||||||
# if QMI is supported then link to loc_api_v02
|
|
||||||
ifeq ($(call is-board-platform-in-list,$(QMI_BOARD_PLATFORM_LIST)),true)
|
|
||||||
LOCAL_SHARED_LIBRARIES += libloc_api_v02
|
|
||||||
else
|
|
||||||
## Check if RPC is not unsupported
|
|
||||||
ifneq ($(TARGET_NO_RPC),true)
|
|
||||||
LOCAL_SHARED_LIBRARIES += libloc_api-rpc-qc
|
|
||||||
endif #TARGET_NO_RPC
|
|
||||||
|
|
||||||
endif #is-board-platform-in-list
|
|
||||||
|
|
||||||
LOCAL_CFLAGS += \
|
LOCAL_CFLAGS += \
|
||||||
-fno-short-enums \
|
-fno-short-enums \
|
||||||
-D_ANDROID_
|
-D_ANDROID_
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define LOG_NDDEBUG 0
|
#define LOG_NDDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_adapter"
|
#define LOG_TAG "LocSvc_adapter"
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include <LocApiAdapter.h>
|
#include <LocApiAdapter.h>
|
||||||
#include "loc_eng_msg.h"
|
#include "loc_eng_msg.h"
|
||||||
#include "loc_log.h"
|
#include "loc_log.h"
|
||||||
|
@ -67,6 +68,28 @@ LocApiAdapter::~LocApiAdapter()
|
||||||
LOC_LOGV("LocApiAdapter deleted");
|
LOC_LOGV("LocApiAdapter deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocApiAdapter* LocApiAdapter::getLocApiAdapter(LocEng &locEng)
|
||||||
|
{
|
||||||
|
void* handle;
|
||||||
|
LocApiAdapter* adapter = NULL;
|
||||||
|
|
||||||
|
handle = dlopen ("libloc_api_v02.so", RTLD_NOW);
|
||||||
|
|
||||||
|
if (!handle) {
|
||||||
|
handle = dlopen ("libloc_api-rpc-qc.so", RTLD_NOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handle) {
|
||||||
|
adapter = new LocApiAdapter(locEng);
|
||||||
|
} else {
|
||||||
|
getLocApiAdapter_t* getHandle = (getLocApiAdapter_t*)dlsym(handle, "getLocApiAdapter");
|
||||||
|
|
||||||
|
adapter = (*getHandle)(locEng);
|
||||||
|
}
|
||||||
|
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
int LocApiAdapter::hexcode(char *hexstring, int string_size,
|
int LocApiAdapter::hexcode(char *hexstring, int string_size,
|
||||||
const char *data, int data_size)
|
const char *data, int data_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,6 +115,8 @@ public:
|
||||||
//LocApiAdapter(int q, reportCb_t[LOC_API_ADAPTER_EVENT_MAX] callbackTable);
|
//LocApiAdapter(int q, reportCb_t[LOC_API_ADAPTER_EVENT_MAX] callbackTable);
|
||||||
virtual ~LocApiAdapter();
|
virtual ~LocApiAdapter();
|
||||||
|
|
||||||
|
static LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
||||||
|
|
||||||
static int hexcode(char *hexstring, int string_size,
|
static int hexcode(char *hexstring, int string_size,
|
||||||
const char *data, int data_size);
|
const char *data, int data_size);
|
||||||
static int decodeAddress(char *addr_string, int string_size,
|
static int decodeAddress(char *addr_string, int string_size,
|
||||||
|
@ -221,7 +223,8 @@ public:
|
||||||
inline virtual void setInSession(bool inSession) { navigating = inSession; }
|
inline virtual void setInSession(bool inSession) { navigating = inSession; }
|
||||||
};
|
};
|
||||||
|
|
||||||
LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
extern "C" LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
||||||
|
|
||||||
|
typedef LocApiAdapter* (getLocApiAdapter_t)(LocEng&);
|
||||||
|
|
||||||
#endif //LOC_API_RPC_ADAPTER_H
|
#endif //LOC_API_RPC_ADAPTER_H
|
||||||
|
|
|
@ -319,7 +319,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
||||||
LocEng locEngHandle(&loc_eng_data, event, loc_eng_data.acquire_wakelock_cb,
|
LocEng locEngHandle(&loc_eng_data, event, loc_eng_data.acquire_wakelock_cb,
|
||||||
loc_eng_data.release_wakelock_cb, loc_eng_msg_sender, loc_external_msg_sender,
|
loc_eng_data.release_wakelock_cb, loc_eng_msg_sender, loc_external_msg_sender,
|
||||||
callbacks->location_ext_parser, callbacks->sv_ext_parser);
|
callbacks->location_ext_parser, callbacks->sv_ext_parser);
|
||||||
loc_eng_data.client_handle = getLocApiAdapter(locEngHandle);
|
loc_eng_data.client_handle = LocApiAdapter::getLocApiAdapter(locEngHandle);
|
||||||
|
|
||||||
int ret_val =-1;
|
int ret_val =-1;
|
||||||
if (NULL == loc_eng_data.client_handle) {
|
if (NULL == loc_eng_data.client_handle) {
|
||||||
|
|
Loading…
Reference in a new issue