gps: jb porting with qcom enhanced features
based from AU_LINUX_ANDROID_ICS.04.00.04.00.205 Change-Id: I0af1da1438a136e98b59110641ce5c7714da220b
This commit is contained in:
parent
3c2630ef2a
commit
3088fe9117
108 changed files with 6524 additions and 2593 deletions
19
loc_api/Android.mk
Executable file → Normal file
19
loc_api/Android.mk
Executable file → Normal file
|
@ -1,11 +1,3 @@
|
||||||
# Copyright (c) 2009, QUALCOMM USA, INC.
|
|
||||||
# All rights reserved.
|
|
||||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
||||||
# · Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
||||||
# · Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
# · Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
|
ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
|
||||||
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
@ -19,12 +11,15 @@ GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
|
||||||
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc/
|
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc/
|
||||||
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api/
|
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api/
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
GPS_DIR_LIST += $(LOCAL_PATH)/loc_api_v02/
|
|
||||||
|
|
||||||
endif #TARGET_NO_RPC
|
endif #TARGET_NO_RPC
|
||||||
|
|
||||||
|
#add QMI libraries for QMI targets
|
||||||
|
QMI_BOARD_PLATFORM_LIST := msm8960
|
||||||
|
|
||||||
|
ifeq ($(call is-board-platform-in-list,$(QMI_BOARD_PLATFORM_LIST)),true)
|
||||||
|
GPS_DIR_LIST += $(LOCAL_PATH)/loc_api_v02/
|
||||||
|
endif #is-board-platform-in-list
|
||||||
|
|
||||||
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
|
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
|
||||||
|
|
||||||
#call the subfolders
|
#call the subfolders
|
||||||
|
|
0
loc_api/libloc_api-rpc-50001/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
Executable file → Normal file
15
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h
Executable file → Normal file
15
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpcAdapter.h
Executable file → Normal file
|
@ -38,6 +38,8 @@ class LocApiRpcAdapter : public LocApiAdapter {
|
||||||
// RPC communication establishment
|
// RPC communication establishment
|
||||||
rpc_loc_client_handle_type client_handle;
|
rpc_loc_client_handle_type client_handle;
|
||||||
rpc_loc_event_mask_type eMask;
|
rpc_loc_event_mask_type eMask;
|
||||||
|
int dataEnableLastSet;
|
||||||
|
char apnLastSet[MAX_APN_LEN];
|
||||||
|
|
||||||
static const rpc_loc_event_mask_type locBits[];
|
static const rpc_loc_event_mask_type locBits[];
|
||||||
static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
||||||
|
@ -71,10 +73,11 @@ public:
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
stopFix();
|
stopFix();
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
setPositionMode(const LocPosMode *mode);
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
|
inline virtual enum loc_api_adapter_err
|
||||||
|
enableData(int enable) { return enableData(enable, false); }
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
enableData(int enable);
|
enableData(int enable, boolean force);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
|
@ -83,8 +86,10 @@ public:
|
||||||
deleteAidingData(GpsAidingData f);
|
deleteAidingData(GpsAidingData f);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
|
informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
|
||||||
|
inline virtual enum loc_api_adapter_err
|
||||||
|
setAPN(char* apn, int len) { return setAPN(apn, len, false); }
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setAPN(char* apn, int len);
|
setAPN(char* apn, int len, boolean force);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setServer(const char* url, int len);
|
setServer(const char* url, int len);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
|
@ -97,6 +102,8 @@ public:
|
||||||
atlCloseStatus(int handle, int is_succ);
|
atlCloseStatus(int handle, int is_succ);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setSUPLVersion(uint32_t version);
|
setSUPLVersion(uint32_t version);
|
||||||
|
|
||||||
|
virtual void setInSession(bool inSession);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //LOC_API_RPC_ADAPTER_H
|
#endif //LOC_API_RPC_ADAPTER_H
|
||||||
|
|
6
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
Executable file → Normal file
6
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
Executable file → Normal file
|
@ -37,7 +37,7 @@
|
||||||
#define PRINT(x...) do { \
|
#define PRINT(x...) do { \
|
||||||
fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
|
fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
|
||||||
fprintf(stdout, ##x); \
|
fprintf(stdout, ##x); \
|
||||||
LOGD(x); \
|
ALOGD(x); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -55,14 +55,14 @@
|
||||||
#define E(x...) do { \
|
#define E(x...) do { \
|
||||||
fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
|
fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
|
||||||
fprintf(stderr, ##x); \
|
fprintf(stderr, ##x); \
|
||||||
LOGE(x); \
|
ALOGE(x); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define FAILIF(cond, msg...) do { \
|
#define FAILIF(cond, msg...) do { \
|
||||||
if (__builtin_expect (cond, 0)) { \
|
if (__builtin_expect (cond, 0)) { \
|
||||||
fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
|
fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
|
||||||
fprintf(stderr, ##msg); \
|
fprintf(stderr, ##msg); \
|
||||||
LOGE(##msg); \
|
ALOGE(##msg); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
Executable file → Normal file
84
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp
Executable file → Normal file
84
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpcAdapter.cpp
Executable file → Normal file
|
@ -119,8 +119,10 @@ const rpc_loc_event_mask_type LocApiRpcAdapter::locBits[] =
|
||||||
LocApiRpcAdapter::LocApiRpcAdapter(LocEng &locEng) :
|
LocApiRpcAdapter::LocApiRpcAdapter(LocEng &locEng) :
|
||||||
LocApiAdapter(locEng),
|
LocApiAdapter(locEng),
|
||||||
client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
|
client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
|
||||||
eMask(convertMask(locEng.eventMask))
|
eMask(convertMask(locEng.eventMask)),
|
||||||
|
dataEnableLastSet(-1)
|
||||||
{
|
{
|
||||||
|
memset(apnLastSet, 0, sizeof(apnLastSet));
|
||||||
loc_api_glue_init();
|
loc_api_glue_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,9 +300,7 @@ LocApiRpcAdapter::stopFix() {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum loc_api_adapter_err
|
enum loc_api_adapter_err
|
||||||
LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
LocApiRpcAdapter::setPositionMode(const LocPosMode *posMode)
|
||||||
GpsPositionRecurrence recurrence, uint32_t min_interval,
|
|
||||||
uint32_t preferred_accuracy, uint32_t preferred_time)
|
|
||||||
{
|
{
|
||||||
rpc_loc_ioctl_data_u_type ioctl_data;
|
rpc_loc_ioctl_data_u_type ioctl_data;
|
||||||
rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
|
rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
|
||||||
|
@ -308,10 +308,13 @@ LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
||||||
rpc_loc_operation_mode_e_type op_mode;
|
rpc_loc_operation_mode_e_type op_mode;
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
|
if (NULL != posMode)
|
||||||
(int32) client_handle, min_interval, mode);
|
fixCriteria = *posMode;
|
||||||
|
|
||||||
switch (mode)
|
ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
|
||||||
|
(int32) client_handle, fixCriteria.min_interval, fixCriteria.mode);
|
||||||
|
|
||||||
|
switch (fixCriteria.mode)
|
||||||
{
|
{
|
||||||
case LOC_POSITION_MODE_MS_BASED:
|
case LOC_POSITION_MODE_MS_BASED:
|
||||||
op_mode = RPC_LOC_OPER_MODE_MSB;
|
op_mode = RPC_LOC_OPER_MODE_MSB;
|
||||||
|
@ -339,29 +342,22 @@ LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
||||||
fix_criteria_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
|
fix_criteria_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
|
||||||
fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
|
fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
|
||||||
RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
|
RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
|
||||||
fix_criteria_ptr->min_interval = min_interval;
|
fix_criteria_ptr->min_interval = fixCriteria.min_interval;
|
||||||
fix_criteria_ptr->preferred_operation_mode = op_mode;
|
fix_criteria_ptr->preferred_operation_mode = op_mode;
|
||||||
|
|
||||||
if (min_interval > 0) {
|
fix_criteria_ptr->min_interval = fixCriteria.min_interval;
|
||||||
fix_criteria_ptr->min_interval = min_interval;
|
|
||||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
|
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
|
||||||
}else if(min_interval == 0)
|
|
||||||
{
|
if (fixCriteria.preferred_accuracy > 0) {
|
||||||
/*If the framework passes in 0 transalate it into the maximum frequency we can report positions
|
fix_criteria_ptr->preferred_accuracy = fixCriteria.preferred_accuracy;
|
||||||
which is 1 Hz or once very second */
|
|
||||||
fix_criteria_ptr->min_interval = MIN_POSSIBLE_FIX_INTERVAL;
|
|
||||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
|
|
||||||
}
|
|
||||||
if (preferred_accuracy > 0) {
|
|
||||||
fix_criteria_ptr->preferred_accuracy = preferred_accuracy;
|
|
||||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
|
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
|
||||||
}
|
}
|
||||||
if (preferred_time > 0) {
|
if (fixCriteria.preferred_time > 0) {
|
||||||
fix_criteria_ptr->preferred_response_time = preferred_time;
|
fix_criteria_ptr->preferred_response_time = fixCriteria.preferred_time;
|
||||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
|
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (recurrence) {
|
switch (fixCriteria.recurrence) {
|
||||||
case GPS_POSITION_RECURRENCE_SINGLE:
|
case GPS_POSITION_RECURRENCE_SINGLE:
|
||||||
fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
|
fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
|
||||||
break;
|
break;
|
||||||
|
@ -484,20 +480,42 @@ LocApiRpcAdapter::informNiResponse(GpsUserResponseType userResponse,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum loc_api_adapter_err
|
enum loc_api_adapter_err
|
||||||
LocApiRpcAdapter::setAPN(char* apn, int len)
|
LocApiRpcAdapter::setAPN(char* apn, int len, boolean force)
|
||||||
{
|
{
|
||||||
|
enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
|
int size = sizeof(apnLastSet);
|
||||||
|
if (force || memcmp(apnLastSet, apn, size)) {
|
||||||
|
if (len < size) {
|
||||||
|
// size will be not larger than its original value
|
||||||
|
size = len + 1;
|
||||||
|
}
|
||||||
|
memcpy(apnLastSet, apn, size);
|
||||||
|
|
||||||
|
if (false == navigating) {
|
||||||
rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
|
rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
|
||||||
ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
|
ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
|
||||||
ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
|
ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
|
||||||
memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, len+1);
|
memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
|
||||||
|
|
||||||
return convertErr(
|
rtv = convertErr(
|
||||||
loc_eng_ioctl (client_handle,
|
loc_eng_ioctl (client_handle,
|
||||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
|
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
|
||||||
&ioctl_data,
|
&ioctl_data,
|
||||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||||
NULL)
|
NULL)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rtv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocApiRpcAdapter::setInSession(bool inSession)
|
||||||
|
{
|
||||||
|
LocApiAdapter::setInSession(inSession);
|
||||||
|
if (false == navigating) {
|
||||||
|
enableData(dataEnableLastSet, true);
|
||||||
|
setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum loc_api_adapter_err
|
enum loc_api_adapter_err
|
||||||
|
@ -567,18 +585,26 @@ LocApiRpcAdapter::setServer(unsigned int ip, int port, LocServerType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum loc_api_adapter_err
|
enum loc_api_adapter_err
|
||||||
LocApiRpcAdapter::enableData(int enable)
|
LocApiRpcAdapter::enableData(int enable, boolean force)
|
||||||
{
|
{
|
||||||
|
enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
|
if (force || dataEnableLastSet != enable) {
|
||||||
|
dataEnableLastSet = enable;
|
||||||
|
|
||||||
|
if (false == navigating) {
|
||||||
rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
|
rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
|
||||||
|
|
||||||
ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
|
ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
|
||||||
return convertErr(
|
rtv = convertErr(
|
||||||
loc_eng_ioctl (client_handle,
|
loc_eng_ioctl (client_handle,
|
||||||
RPC_LOC_IOCTL_SET_DATA_ENABLE,
|
RPC_LOC_IOCTL_SET_DATA_ENABLE,
|
||||||
&ioctl_data,
|
&ioctl_data,
|
||||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||||
NULL)
|
NULL)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rtv;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum loc_api_adapter_err
|
enum loc_api_adapter_err
|
||||||
|
@ -652,7 +678,9 @@ void LocApiRpcAdapter::reportPosition(const rpc_loc_parsed_position_s_type *loca
|
||||||
location.flags |= GPS_LOCATION_HAS_ACCURACY;
|
location.flags |= GPS_LOCATION_HAS_ACCURACY;
|
||||||
location.accuracy = location_report_ptr->hor_unc_circular;
|
location.accuracy = location_report_ptr->hor_unc_circular;
|
||||||
}
|
}
|
||||||
|
//Mark the location source as from GNSS
|
||||||
|
location.flags |= LOCATION_HAS_SOURCE_INFO;
|
||||||
|
location.position_source = ULP_LOCATION_IS_FROM_GNSS;
|
||||||
LOC_LOGV("reportPosition: fire callback\n");
|
LOC_LOGV("reportPosition: fire callback\n");
|
||||||
LocApiAdapter::reportPosition(location,
|
LocApiAdapter::reportPosition(location,
|
||||||
locEngHandle.extPosInfo((void*)location_report_ptr),
|
locEngHandle.extPosInfo((void*)location_report_ptr),
|
||||||
|
|
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
Executable file → Normal file
28
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
Executable file → Normal file
28
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
Executable file → Normal file
|
@ -62,8 +62,8 @@
|
||||||
/* Logging Improvement */
|
/* Logging Improvement */
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
|
|
||||||
/* Uncomment to force LOGD messages */
|
/* Uncomment to force ALOGD messages */
|
||||||
// #define LOGD LOGI
|
// #define ALOGD ALOGI
|
||||||
|
|
||||||
/*=====================================================================
|
/*=====================================================================
|
||||||
External declarations
|
External declarations
|
||||||
|
@ -316,30 +316,23 @@ rpc_loc_client_handle_type loc_open (
|
||||||
rpc_loc_open_args args;
|
rpc_loc_open_args args;
|
||||||
args.event_reg_mask = event_reg_mask;
|
args.event_reg_mask = event_reg_mask;
|
||||||
|
|
||||||
int i;
|
int i, j = LOC_API_CB_MAX_CLIENTS;
|
||||||
for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
|
for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
if (loc_glue_callback_table[i].cb_func == event_callback ||
|
if (loc_glue_callback_table[i].user == userData)
|
||||||
loc_glue_callback_table[i].user == userData)
|
|
||||||
{
|
{
|
||||||
LOC_LOGW("Client already opened service (callback=%p)...\n",
|
LOC_LOGW("Client already opened service (callback=%p)...\n",
|
||||||
event_callback);
|
event_callback);
|
||||||
break;
|
break;
|
||||||
|
} else if (j == LOC_API_CB_MAX_CLIENTS &&
|
||||||
|
loc_glue_callback_table[i].user == NULL) {
|
||||||
|
j = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == LOC_API_CB_MAX_CLIENTS)
|
if (i == LOC_API_CB_MAX_CLIENTS)
|
||||||
{
|
{
|
||||||
for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
|
i = j;
|
||||||
{
|
|
||||||
if (loc_glue_callback_table[i].cb_func == NULL)
|
|
||||||
{
|
|
||||||
loc_glue_callback_table[i].cb_func = event_callback;
|
|
||||||
loc_glue_callback_table[i].rpc_cb = rpc_cb;
|
|
||||||
loc_glue_callback_table[i].user = userData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == LOC_API_CB_MAX_CLIENTS)
|
if (i == LOC_API_CB_MAX_CLIENTS)
|
||||||
|
@ -348,6 +341,10 @@ rpc_loc_client_handle_type loc_open (
|
||||||
return RPC_LOC_CLIENT_HANDLE_INVALID;
|
return RPC_LOC_CLIENT_HANDLE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc_glue_callback_table[i].cb_func = event_callback;
|
||||||
|
loc_glue_callback_table[i].rpc_cb = rpc_cb;
|
||||||
|
loc_glue_callback_table[i].user = userData;
|
||||||
|
|
||||||
args.event_callback = loc_glue_callback_table[i].cb_id;
|
args.event_callback = loc_glue_callback_table[i].cb_id;
|
||||||
LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
|
LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
|
||||||
|
|
||||||
|
@ -405,6 +402,7 @@ void loc_clear(rpc_loc_client_handle_type handle) {
|
||||||
loc_glue_callback_table[i].cb_func = NULL;
|
loc_glue_callback_table[i].cb_func = NULL;
|
||||||
loc_glue_callback_table[i].rpc_cb = NULL;
|
loc_glue_callback_table[i].rpc_cb = NULL;
|
||||||
loc_glue_callback_table[i].handle = -1;
|
loc_glue_callback_table[i].handle = -1;
|
||||||
|
loc_glue_callback_table[i].user = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
22
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
Executable file → Normal file
22
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
Executable file → Normal file
|
@ -195,7 +195,7 @@ void loc_api_callback_process_sync_call(
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
LOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
|
ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
|
||||||
for (i = 0; i < loc_sync_data.num_of_slots; i++)
|
for (i = 0; i < loc_sync_data.num_of_slots; i++)
|
||||||
{
|
{
|
||||||
loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
|
loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
|
||||||
|
@ -211,7 +211,7 @@ void loc_api_callback_process_sync_call(
|
||||||
|
|
||||||
slot->loc_cb_received_event_mask = loc_event;
|
slot->loc_cb_received_event_mask = loc_event;
|
||||||
|
|
||||||
LOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
|
ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
|
||||||
pthread_cond_signal(&slot->loc_cb_arrived_cond);
|
pthread_cond_signal(&slot->loc_cb_arrived_cond);
|
||||||
slot->signal_sent = 1;
|
slot->signal_sent = 1;
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ static int loc_lock_a_slot()
|
||||||
loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
|
loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
|
||||||
if (pthread_mutex_trylock(&slot->lock) == EBUSY)
|
if (pthread_mutex_trylock(&slot->lock) == EBUSY)
|
||||||
{
|
{
|
||||||
LOGV("trylock EBUSY : %d", i);
|
ALOGV("trylock EBUSY : %d", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ static int loc_lock_a_slot()
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* LOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
|
/* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
|
||||||
pthread_mutex_unlock(&slot->lock);
|
pthread_mutex_unlock(&slot->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ static int loc_api_wait_callback(
|
||||||
if (rc == ETIMEDOUT)
|
if (rc == ETIMEDOUT)
|
||||||
{
|
{
|
||||||
ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
|
ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
|
||||||
LOGE("TIMEOUT: %d", select_id);
|
ALOGE("TIMEOUT: %d", select_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Obtained the first awaited callback */
|
/* Obtained the first awaited callback */
|
||||||
|
@ -462,7 +462,7 @@ int loc_api_sync_ioctl
|
||||||
|
|
||||||
if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
|
if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
|
||||||
{
|
{
|
||||||
LOGE("slot not available ioctl_type = %s",
|
ALOGE("slot not available ioctl_type = %s",
|
||||||
loc_get_ioctl_type_name(ioctl_type));
|
loc_get_ioctl_type_name(ioctl_type));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -474,17 +474,17 @@ int loc_api_sync_ioctl
|
||||||
|
|
||||||
if (rc != RPC_LOC_API_SUCCESS)
|
if (rc != RPC_LOC_API_SUCCESS)
|
||||||
{
|
{
|
||||||
LOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
|
ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
|
||||||
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
|
ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
|
||||||
select_id, ioctl_type);
|
select_id, ioctl_type);
|
||||||
// Wait for the callback of loc_ioctl
|
// Wait for the callback of loc_ioctl
|
||||||
if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
|
if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
|
||||||
{
|
{
|
||||||
// Callback waiting failed
|
// Callback waiting failed
|
||||||
LOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
|
ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
|
||||||
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -493,10 +493,10 @@ int loc_api_sync_ioctl
|
||||||
if (callback_data.status != RPC_LOC_API_SUCCESS)
|
if (callback_data.status != RPC_LOC_API_SUCCESS)
|
||||||
{
|
{
|
||||||
rc = callback_data.status;
|
rc = callback_data.status;
|
||||||
LOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
|
ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
|
||||||
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
|
||||||
} else {
|
} else {
|
||||||
LOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
|
ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
|
||||||
select_id, ioctl_type, rc);
|
select_id, ioctl_type, rc);
|
||||||
}
|
}
|
||||||
} /* wait callback */
|
} /* wait callback */
|
||||||
|
|
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc/Android.mk
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc/debug.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc/debug.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
Executable file → Normal file
0
loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
Executable file → Normal file
0
loc_api/libloc_api/Android.mk
Executable file → Normal file
0
loc_api/libloc_api/Android.mk
Executable file → Normal file
0
loc_api/libloc_api/loc_eng.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ioctl.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ioctl.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ioctl.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ioctl.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ni.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ni.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ni.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_ni.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_xtra.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_xtra.cpp
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_xtra.h
Executable file → Normal file
0
loc_api/libloc_api/loc_eng_xtra.h
Executable file → Normal file
18
loc_api/libloc_api_50001/Android.mk
Executable file → Normal file
18
loc_api/libloc_api_50001/Android.mk
Executable file → Normal file
|
@ -3,6 +3,7 @@ ifneq ($(BUILD_TINY_ANDROID),true)
|
||||||
|
|
||||||
BIT_ENABLED_BOARD_PLATFORM_LIST := msm7630_fusion
|
BIT_ENABLED_BOARD_PLATFORM_LIST := msm7630_fusion
|
||||||
BIT_ENABLED_BOARD_PLATFORM_LIST += msm8660
|
BIT_ENABLED_BOARD_PLATFORM_LIST += msm8660
|
||||||
|
BIT_ENABLED_BOARD_PLATFORM_LIST += msm8960
|
||||||
ifeq ($(call is-board-platform-in-list,$(BIT_ENABLED_BOARD_PLATFORM_LIST)),true)
|
ifeq ($(call is-board-platform-in-list,$(BIT_ENABLED_BOARD_PLATFORM_LIST)),true)
|
||||||
FEATURE_GNSS_BIT_API := true
|
FEATURE_GNSS_BIT_API := true
|
||||||
endif # is-board-platform-in-list
|
endif # is-board-platform-in-list
|
||||||
|
@ -57,8 +58,7 @@ LOCAL_SHARED_LIBRARIES := \
|
||||||
libutils \
|
libutils \
|
||||||
libcutils \
|
libcutils \
|
||||||
libloc_adapter \
|
libloc_adapter \
|
||||||
libgps.utils \
|
libgps.utils
|
||||||
libdl
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
loc_eng.cpp \
|
loc_eng.cpp \
|
||||||
|
@ -78,13 +78,17 @@ 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
|
## Check if RPC is not unsupported
|
||||||
ifneq ($(TARGET_NO_RPC),true)
|
ifneq ($(TARGET_NO_RPC),true)
|
||||||
LOCAL_SHARED_LIBRARIES += libloc_api-rpc-qc
|
LOCAL_SHARED_LIBRARIES += libloc_api-rpc-qc
|
||||||
else
|
|
||||||
LOCAL_SHARED_LIBRARIES += libloc_api_v02
|
|
||||||
endif #TARGET_NO_RPC
|
endif #TARGET_NO_RPC
|
||||||
|
|
||||||
|
endif #is-board-platform-in-list
|
||||||
|
|
||||||
LOCAL_CFLAGS += \
|
LOCAL_CFLAGS += \
|
||||||
-fno-short-enums \
|
-fno-short-enums \
|
||||||
-D_ANDROID_
|
-D_ANDROID_
|
||||||
|
@ -109,7 +113,8 @@ LOCAL_SHARED_LIBRARIES := \
|
||||||
libutils \
|
libutils \
|
||||||
libcutils \
|
libcutils \
|
||||||
libloc_eng \
|
libloc_eng \
|
||||||
libgps.utils
|
libgps.utils \
|
||||||
|
libdl
|
||||||
|
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
loc.cpp \
|
loc.cpp \
|
||||||
|
@ -121,7 +126,8 @@ LOCAL_CFLAGS += \
|
||||||
|
|
||||||
## Includes
|
## Includes
|
||||||
LOCAL_C_INCLUDES:= \
|
LOCAL_C_INCLUDES:= \
|
||||||
$(TARGET_OUT_HEADERS)/gps.utils
|
$(TARGET_OUT_HEADERS)/gps.utils \
|
||||||
|
hardware/qcom/gps/loc_api/ulp/inc
|
||||||
|
|
||||||
LOCAL_PRELINK_MODULE := false
|
LOCAL_PRELINK_MODULE := false
|
||||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||||
|
|
16
loc_api/libloc_api_50001/LocApiAdapter.cpp
Executable file → Normal file
16
loc_api/libloc_api_50001/LocApiAdapter.cpp
Executable file → Normal file
|
@ -44,11 +44,12 @@ LocEng::LocEng(void* caller,
|
||||||
gps_acquire_wakelock acqwl,
|
gps_acquire_wakelock acqwl,
|
||||||
gps_release_wakelock relwl,
|
gps_release_wakelock relwl,
|
||||||
loc_msg_sender msgSender,
|
loc_msg_sender msgSender,
|
||||||
|
loc_msg_sender msgUlpSender,
|
||||||
loc_ext_parser posParser,
|
loc_ext_parser posParser,
|
||||||
loc_ext_parser svParser) :
|
loc_ext_parser svParser) :
|
||||||
owner(caller),
|
owner(caller),
|
||||||
eventMask(emask), acquireWakelock(acqwl),
|
eventMask(emask), acquireWakelock(acqwl),
|
||||||
releaseWakeLock(relwl), sendMsge(msgSender),
|
releaseWakeLock(relwl), sendMsge(msgSender), sendUlpMsg(msgUlpSender),
|
||||||
extPosInfo(NULL == posParser ? noProc : posParser),
|
extPosInfo(NULL == posParser ? noProc : posParser),
|
||||||
extSvInfo(NULL == svParser ? noProc : svParser)
|
extSvInfo(NULL == svParser ? noProc : svParser)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +57,7 @@ LocEng::LocEng(void* caller,
|
||||||
}
|
}
|
||||||
|
|
||||||
LocApiAdapter::LocApiAdapter(LocEng &locEng) :
|
LocApiAdapter::LocApiAdapter(LocEng &locEng) :
|
||||||
locEngHandle(locEng)
|
locEngHandle(locEng), fixCriteria(), navigating(false)
|
||||||
{
|
{
|
||||||
LOC_LOGD("LocApiAdapter created");
|
LOC_LOGD("LocApiAdapter created");
|
||||||
}
|
}
|
||||||
|
@ -119,13 +120,24 @@ void LocApiAdapter::reportPosition(GpsLocation &location,
|
||||||
location,
|
location,
|
||||||
locationExt,
|
locationExt,
|
||||||
status));
|
status));
|
||||||
|
if (locEngHandle.sendUlpMsg) {
|
||||||
|
locEngHandle.sendUlpMsg(locEngHandle.owner, msg);
|
||||||
|
} else {
|
||||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocApiAdapter::reportSv(GpsSvStatus &svStatus, void* svExt)
|
void LocApiAdapter::reportSv(GpsSvStatus &svStatus, void* svExt)
|
||||||
{
|
{
|
||||||
loc_eng_msg_report_sv *msg(new loc_eng_msg_report_sv(locEngHandle.owner, svStatus, svExt));
|
loc_eng_msg_report_sv *msg(new loc_eng_msg_report_sv(locEngHandle.owner, svStatus, svExt));
|
||||||
|
|
||||||
|
//We want to send SV info to ULP to help it in determining GNSS signal strength
|
||||||
|
//ULP will forward the SV reports to HAL without any modifications
|
||||||
|
if (locEngHandle.sendUlpMsg) {
|
||||||
|
locEngHandle.sendUlpMsg(locEngHandle.owner, msg);
|
||||||
|
} else {
|
||||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocApiAdapter::reportStatus(GpsStatusValue status)
|
void LocApiAdapter::reportStatus(GpsStatusValue status)
|
||||||
|
|
40
loc_api/libloc_api_50001/LocApiAdapter.h
Executable file → Normal file
40
loc_api/libloc_api_50001/LocApiAdapter.h
Executable file → Normal file
|
@ -32,9 +32,13 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
#include <loc.h>
|
#include <loc.h>
|
||||||
|
#include <loc_eng_log.h>
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
|
#include <loc_eng_msg.h>
|
||||||
|
|
||||||
#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
|
#define MAX_APN_LEN 100
|
||||||
|
#define MAX_URL_LEN 256
|
||||||
|
#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
|
||||||
|
|
||||||
enum loc_api_adapter_err {
|
enum loc_api_adapter_err {
|
||||||
LOC_API_ADAPTER_ERR_SUCCESS = 0,
|
LOC_API_ADAPTER_ERR_SUCCESS = 0,
|
||||||
|
@ -85,6 +89,7 @@ struct LocEng {
|
||||||
const gps_acquire_wakelock acquireWakelock;
|
const gps_acquire_wakelock acquireWakelock;
|
||||||
const gps_release_wakelock releaseWakeLock;
|
const gps_release_wakelock releaseWakeLock;
|
||||||
const loc_msg_sender sendMsge;
|
const loc_msg_sender sendMsge;
|
||||||
|
const loc_msg_sender sendUlpMsg;
|
||||||
const loc_ext_parser extPosInfo;
|
const loc_ext_parser extPosInfo;
|
||||||
const loc_ext_parser extSvInfo;
|
const loc_ext_parser extSvInfo;
|
||||||
|
|
||||||
|
@ -93,6 +98,7 @@ struct LocEng {
|
||||||
gps_acquire_wakelock acqwl,
|
gps_acquire_wakelock acqwl,
|
||||||
gps_release_wakelock relwl,
|
gps_release_wakelock relwl,
|
||||||
loc_msg_sender msgSender,
|
loc_msg_sender msgSender,
|
||||||
|
loc_msg_sender msgUlpSender,
|
||||||
loc_ext_parser posParser,
|
loc_ext_parser posParser,
|
||||||
loc_ext_parser svParser);
|
loc_ext_parser svParser);
|
||||||
};
|
};
|
||||||
|
@ -100,6 +106,8 @@ struct LocEng {
|
||||||
class LocApiAdapter {
|
class LocApiAdapter {
|
||||||
protected:
|
protected:
|
||||||
const LocEng locEngHandle;
|
const LocEng locEngHandle;
|
||||||
|
LocPosMode fixCriteria;
|
||||||
|
bool navigating;
|
||||||
|
|
||||||
LocApiAdapter(LocEng &locEng);
|
LocApiAdapter(LocEng &locEng);
|
||||||
|
|
||||||
|
@ -157,22 +165,14 @@ public:
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setXtraData(char* data, int length)
|
setXtraData(char* data, int length)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType)
|
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
#else
|
|
||||||
inline virtual enum loc_api_adapter_err
|
|
||||||
atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agpsType)
|
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
|
||||||
#endif
|
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
atlCloseStatus(int handle, int is_succ)
|
atlCloseStatus(int handle, int is_succ)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
setPositionMode(const LocPosMode *posMode)
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
|
||||||
uint32_t preferred_time)
|
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setServer(const char* url, int len)
|
setServer(const char* url, int len)
|
||||||
|
@ -187,16 +187,32 @@ public:
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setSUPLVersion(uint32_t version)
|
setSUPLVersion(uint32_t version)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
|
inline virtual enum loc_api_adapter_err
|
||||||
|
setLPPConfig(uint32_t profile)
|
||||||
|
{LOC_LOGW("%s: default implementation invoked", __func__);
|
||||||
|
return LOC_API_ADAPTER_ERR_SUCCESS; }
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setSensorControlConfig(int sensorUsage)
|
setSensorControlConfig(int sensorUsage)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setSensorProperties(float gyroBiasVarianceRandomWalk)
|
setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
|
||||||
|
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
|
||||||
|
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
|
||||||
|
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
|
||||||
|
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
inline virtual enum loc_api_adapter_err
|
inline virtual enum loc_api_adapter_err
|
||||||
setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
|
setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||||
int gyroSamplesPerBatch, int gyroBatchesPerSec)
|
int gyroSamplesPerBatch, int gyroBatchesPerSec, int algorithmConfig)
|
||||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
|
inline virtual enum loc_api_adapter_err
|
||||||
|
setExtPowerConfig(int isBatteryCharging)
|
||||||
|
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||||
|
|
||||||
|
inline const LocPosMode& getPositionMode() const {return fixCriteria;}
|
||||||
|
|
||||||
|
inline bool isInSession() { return navigating; }
|
||||||
|
inline virtual void setInSession(bool inSession) { navigating = inSession; }
|
||||||
};
|
};
|
||||||
|
|
||||||
LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
||||||
|
|
0
loc_api/libloc_api_50001/gps.c
Executable file → Normal file
0
loc_api/libloc_api_50001/gps.c
Executable file → Normal file
377
loc_api/libloc_api_50001/loc.cpp
Executable file → Normal file
377
loc_api/libloc_api_50001/loc.cpp
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011 - 2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -33,7 +33,17 @@
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
#include <loc_eng.h>
|
#include <loc_eng.h>
|
||||||
#include <loc_log.h>
|
#include <loc_log.h>
|
||||||
|
#include <msg_q.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
//Globals defns
|
||||||
|
static const ulpInterface * loc_eng_ulp_inf = NULL;
|
||||||
|
static const ulpInterface * loc_eng_get_ulp_inf(void);
|
||||||
static gps_location_callback gps_loc_cb = NULL;
|
static gps_location_callback gps_loc_cb = NULL;
|
||||||
static gps_sv_status_callback gps_sv_cb = NULL;
|
static gps_sv_status_callback gps_sv_cb = NULL;
|
||||||
|
|
||||||
|
@ -52,9 +62,12 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||||
uint32_t preferred_time);
|
uint32_t preferred_time);
|
||||||
static const void* loc_get_extension(const char* name);
|
static const void* loc_get_extension(const char* name);
|
||||||
#ifdef QCOM_FEATURE_ULP
|
//ULP/Hybrid provider Function definitions
|
||||||
static int loc_update_criteria(UlpLocationCriteria criteria);
|
static int loc_update_criteria(UlpLocationCriteria criteria);
|
||||||
#endif
|
static int loc_ulp_network_init(UlpNetworkLocationCallbacks *callbacks);
|
||||||
|
static int loc_ulp_send_network_position(UlpNetworkPositionReport *position_report);
|
||||||
|
static int loc_ulp_phone_context_init(UlpPhoneContextCallbacks *callback);
|
||||||
|
static int loc_ulp_phone_context_settings_update(UlpPhoneContextSettings *settings);
|
||||||
|
|
||||||
// Defines the GpsInterface in gps.h
|
// Defines the GpsInterface in gps.h
|
||||||
static const GpsInterface sLocEngInterface =
|
static const GpsInterface sLocEngInterface =
|
||||||
|
@ -68,24 +81,16 @@ static const GpsInterface sLocEngInterface =
|
||||||
loc_inject_location,
|
loc_inject_location,
|
||||||
loc_delete_aiding_data,
|
loc_delete_aiding_data,
|
||||||
loc_set_position_mode,
|
loc_set_position_mode,
|
||||||
loc_get_extension
|
loc_get_extension,
|
||||||
#ifdef QCOM_FEATURE_ULP
|
loc_update_criteria
|
||||||
,loc_update_criteria
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function declarations for sLocEngAGpsInterface
|
// Function declarations for sLocEngAGpsInterface
|
||||||
static void loc_agps_init(AGpsCallbacks* callbacks);
|
static void loc_agps_init(AGpsCallbacks* callbacks);
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
static int loc_agps_open(AGpsType agpsType,
|
static int loc_agps_open(AGpsType agpsType,
|
||||||
const char* apn, AGpsBearerType bearerType);
|
const char* apn, AGpsBearerType bearerType);
|
||||||
static int loc_agps_closed(AGpsType agpsType);
|
static int loc_agps_closed(AGpsType agpsType);
|
||||||
static int loc_agps_open_failed(AGpsType agpsType);
|
static int loc_agps_open_failed(AGpsType agpsType);
|
||||||
#else
|
|
||||||
static int loc_agps_open(const char* apn);
|
|
||||||
static int loc_agps_closed();
|
|
||||||
static int loc_agps_open_failed();
|
|
||||||
#endif
|
|
||||||
static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
|
static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
|
||||||
|
|
||||||
static const AGpsInterface sLocEngAGpsInterface =
|
static const AGpsInterface sLocEngAGpsInterface =
|
||||||
|
@ -136,7 +141,6 @@ static const AGpsRilInterface sLocEngAGpsRilInterface =
|
||||||
loc_agps_ril_update_network_availability
|
loc_agps_ril_update_network_availability
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_ULP
|
|
||||||
static bool loc_inject_raw_command(char* command, int length);
|
static bool loc_inject_raw_command(char* command, int length);
|
||||||
|
|
||||||
static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
|
static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
|
||||||
|
@ -144,9 +148,81 @@ static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
|
||||||
sizeof(InjectRawCmdInterface),
|
sizeof(InjectRawCmdInterface),
|
||||||
loc_inject_raw_command
|
loc_inject_raw_command
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
|
//ULP/Hybrid provider interfaces
|
||||||
|
static const UlpNetworkInterface sUlpNetworkInterface =
|
||||||
|
{
|
||||||
|
sizeof(UlpNetworkInterface),
|
||||||
|
loc_ulp_network_init,
|
||||||
|
loc_ulp_send_network_position
|
||||||
|
};
|
||||||
|
static const UlpPhoneContextInterface sLocEngUlpPhoneContextInterface =
|
||||||
|
{
|
||||||
|
sizeof(UlpPhoneContextInterface),
|
||||||
|
loc_ulp_phone_context_init,
|
||||||
|
loc_ulp_phone_context_settings_update
|
||||||
|
};
|
||||||
static loc_eng_data_s_type loc_afw_data;
|
static loc_eng_data_s_type loc_afw_data;
|
||||||
|
static int gss_fd = 0;
|
||||||
|
|
||||||
|
#define TARGET_NAME_OTHER 0
|
||||||
|
#define TARGET_NAME_APQ8064_STANDALONE 1
|
||||||
|
#define TARGET_NAME_APQ8064_FUSION3 2
|
||||||
|
|
||||||
|
static int read_a_line(const char * file_path, char * line, int line_size)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
* line = '\0';
|
||||||
|
fp = fopen(file_path, "r" );
|
||||||
|
if( fp == NULL ) {
|
||||||
|
LOC_LOGE("open failed: %s: %s\n", file_path, strerror(errno));
|
||||||
|
result = -1;
|
||||||
|
} else {
|
||||||
|
int len;
|
||||||
|
fgets(line, line_size, fp);
|
||||||
|
len = strlen(line);
|
||||||
|
len = len < line_size - 1? len : line_size - 1;
|
||||||
|
line[len] = '\0';
|
||||||
|
LOC_LOGD("cat %s: %s", file_path, line);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LINE_LEN 100
|
||||||
|
#define STR_LIQUID "Liquid"
|
||||||
|
#define STR_SURF "Surf"
|
||||||
|
#define STRLEN_LIQUID (sizeof(STR_LIQUID) - 1)
|
||||||
|
#define STRLEN_SURF (sizeof(STR_SURF) - 1)
|
||||||
|
#define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r')
|
||||||
|
|
||||||
|
static int get_target_name(void)
|
||||||
|
{
|
||||||
|
int target_name = TARGET_NAME_OTHER;
|
||||||
|
|
||||||
|
char hw_platform[] = "/sys/devices/system/soc/soc0/hw_platform"; // "Liquid" or "Surf"
|
||||||
|
char id[] = "/sys/devices/system/soc/soc0/id"; //109
|
||||||
|
char mdm[] = "/dev/mdm"; // No such file or directory
|
||||||
|
|
||||||
|
char line[LINE_LEN];
|
||||||
|
|
||||||
|
read_a_line( hw_platform, line, LINE_LEN);
|
||||||
|
if(( !memcmp(line, STR_LIQUID, STRLEN_LIQUID) && IS_STR_END(line[STRLEN_LIQUID]) ) ||
|
||||||
|
( !memcmp(line, STR_SURF, STRLEN_SURF) && IS_STR_END(line[STRLEN_SURF]) )
|
||||||
|
) {
|
||||||
|
if (!read_a_line( mdm, line, LINE_LEN)) {
|
||||||
|
target_name = TARGET_NAME_APQ8064_FUSION3;
|
||||||
|
} else {
|
||||||
|
read_a_line( id, line, LINE_LEN);
|
||||||
|
if(!strncmp(line, "109", strlen("109"))) {
|
||||||
|
target_name = TARGET_NAME_APQ8064_STANDALONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target_name;
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION gps_get_hardware_interface
|
FUNCTION gps_get_hardware_interface
|
||||||
|
@ -189,8 +265,26 @@ const GpsInterface* gps_get_hardware_interface ()
|
||||||
// for gps.c
|
// for gps.c
|
||||||
extern "C" const GpsInterface* get_gps_interface()
|
extern "C" const GpsInterface* get_gps_interface()
|
||||||
{
|
{
|
||||||
|
loc_eng_read_config();
|
||||||
|
//We load up libulp module at this point itself if ULP configured to be On
|
||||||
|
if(gps_conf.CAPABILITIES & ULP_CAPABILITY) {
|
||||||
|
loc_eng_ulp_inf = loc_eng_get_ulp_inf();
|
||||||
|
}
|
||||||
return &sLocEngInterface;
|
return &sLocEngInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void loc_free_msg(void* msg)
|
||||||
|
{
|
||||||
|
delete (loc_eng_msg*)msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loc_ulp_msg_sender(void* loc_eng_data_p, void* msg)
|
||||||
|
{
|
||||||
|
LocEngContext* loc_eng_context = (LocEngContext*)((loc_eng_data_s_type*)loc_eng_data_p)->context;
|
||||||
|
msg_q_snd((void*)loc_eng_context->ulp_q, msg, loc_free_msg);
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_init
|
FUNCTION loc_init
|
||||||
|
|
||||||
|
@ -233,10 +327,28 @@ static int loc_init(GpsCallbacks* callbacks)
|
||||||
gps_loc_cb = callbacks->location_cb;
|
gps_loc_cb = callbacks->location_cb;
|
||||||
gps_sv_cb = callbacks->sv_status_cb;
|
gps_sv_cb = callbacks->sv_status_cb;
|
||||||
|
|
||||||
int ret_val = loc_eng_init(loc_afw_data, &clientCallbacks, event);
|
if (get_target_name() == TARGET_NAME_APQ8064_STANDALONE)
|
||||||
|
{
|
||||||
|
gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
|
||||||
|
gss_fd = open("/dev/gss", O_RDONLY);
|
||||||
|
if (gss_fd < 0) {
|
||||||
|
LOC_LOGE("GSS open failed: %s\n", strerror(errno));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
LOC_LOGD("GSS open success! CAPABILITIES %0x\n", gps_conf.CAPABILITIES);
|
||||||
|
}
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
int retVal = -1;
|
||||||
return ret_val;
|
if (loc_eng_ulp_inf == NULL)
|
||||||
|
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
|
||||||
|
NULL);
|
||||||
|
else
|
||||||
|
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
|
||||||
|
loc_ulp_msg_sender);
|
||||||
|
int ret_val1 = loc_eng_ulp_init(loc_afw_data, loc_eng_ulp_inf);
|
||||||
|
LOC_LOGD("loc_eng_ulp_init returned %d\n",ret_val1);
|
||||||
|
EXIT_LOG(%d, retVal);
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
@ -261,6 +373,15 @@ static void loc_cleanup()
|
||||||
loc_eng_cleanup(loc_afw_data);
|
loc_eng_cleanup(loc_afw_data);
|
||||||
gps_loc_cb = NULL;
|
gps_loc_cb = NULL;
|
||||||
gps_sv_cb = NULL;
|
gps_sv_cb = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if (get_target_name() == TARGET_NAME_APQ8064_STANDALONE)
|
||||||
|
* {
|
||||||
|
* close(gss_fd);
|
||||||
|
* LOC_LOGD("GSS shutdown.\n");
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,9 +470,10 @@ static int loc_set_position_mode(GpsPositionMode mode,
|
||||||
locMode = LOC_POSITION_MODE_STANDALONE;
|
locMode = LOC_POSITION_MODE_STANDALONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int ret_val = loc_eng_set_position_mode(loc_afw_data, locMode,
|
|
||||||
recurrence, min_interval,
|
LocPosMode params(locMode, recurrence, min_interval,
|
||||||
preferred_accuracy, preferred_time);
|
preferred_accuracy, preferred_time, NULL, NULL);
|
||||||
|
int ret_val = loc_eng_set_position_mode(loc_afw_data, params);
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
|
@ -437,7 +559,6 @@ static void loc_delete_aiding_data(GpsAidingData f)
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_ULP
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_update_criteria
|
FUNCTION loc_update_criteria
|
||||||
|
|
||||||
|
@ -462,7 +583,6 @@ static int loc_update_criteria(UlpLocationCriteria criteria)
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_get_extension
|
FUNCTION loc_get_extension
|
||||||
|
@ -501,20 +621,33 @@ static const void* loc_get_extension(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
|
else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
|
||||||
|
{
|
||||||
|
char baseband[PROPERTY_VALUE_MAX];
|
||||||
|
property_get("ro.baseband", baseband, "msm");
|
||||||
|
if (strcmp(baseband, "csfb") == 0)
|
||||||
{
|
{
|
||||||
ret_val = &sLocEngAGpsRilInterface;
|
ret_val = &sLocEngAGpsRilInterface;
|
||||||
}
|
}
|
||||||
#ifdef QCOM_FEATURE_ULP
|
}
|
||||||
else if (strcmp(name, ULP_RAW_CMD_INTERFACE) == 0)
|
else if (strcmp(name, ULP_RAW_CMD_INTERFACE) == 0)
|
||||||
{
|
{
|
||||||
ret_val = &sLocEngInjectRawCmdInterface;
|
ret_val = &sLocEngInjectRawCmdInterface;
|
||||||
}
|
}
|
||||||
#endif
|
else if(strcmp(name, ULP_PHONE_CONTEXT_INTERFACE) == 0)
|
||||||
|
{
|
||||||
|
ret_val = &sLocEngUlpPhoneContextInterface;
|
||||||
|
}
|
||||||
|
else if(strcmp(name, ULP_NETWORK_INTERFACE) == 0)
|
||||||
|
{
|
||||||
|
//Return a valid value for ULP Network Interface only if ULP
|
||||||
|
//turned on in gps.conf
|
||||||
|
if(gps_conf.CAPABILITIES & ULP_CAPABILITY)
|
||||||
|
ret_val = &sUlpNetworkInterface;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOC_LOGE ("get_extension: Invalid interface passed in\n");
|
LOC_LOGE ("get_extension: Invalid interface passed in\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
EXIT_LOG(%p, ret_val);
|
EXIT_LOG(%p, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
@ -559,7 +692,6 @@ SIDE EFFECTS
|
||||||
N/A
|
N/A
|
||||||
|
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
static int loc_agps_open(AGpsType agpsType,
|
static int loc_agps_open(AGpsType agpsType,
|
||||||
const char* apn, AGpsBearerType bearerType)
|
const char* apn, AGpsBearerType bearerType)
|
||||||
{
|
{
|
||||||
|
@ -569,16 +701,6 @@ static int loc_agps_open(AGpsType agpsType,
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static int loc_agps_open(const char* apn)
|
|
||||||
{
|
|
||||||
ENTRY_LOG();
|
|
||||||
int ret_val = loc_eng_agps_open(loc_afw_data, apn);
|
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_agps_closed
|
FUNCTION loc_agps_closed
|
||||||
|
@ -597,7 +719,6 @@ SIDE EFFECTS
|
||||||
N/A
|
N/A
|
||||||
|
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
static int loc_agps_closed(AGpsType agpsType)
|
static int loc_agps_closed(AGpsType agpsType)
|
||||||
{
|
{
|
||||||
ENTRY_LOG();
|
ENTRY_LOG();
|
||||||
|
@ -606,16 +727,6 @@ static int loc_agps_closed(AGpsType agpsType)
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static int loc_agps_closed()
|
|
||||||
{
|
|
||||||
ENTRY_LOG();
|
|
||||||
int ret_val = loc_eng_agps_closed(loc_afw_data);
|
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_agps_open_failed
|
FUNCTION loc_agps_open_failed
|
||||||
|
@ -634,7 +745,6 @@ SIDE EFFECTS
|
||||||
N/A
|
N/A
|
||||||
|
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
int loc_agps_open_failed(AGpsType agpsType)
|
int loc_agps_open_failed(AGpsType agpsType)
|
||||||
{
|
{
|
||||||
ENTRY_LOG();
|
ENTRY_LOG();
|
||||||
|
@ -643,16 +753,6 @@ int loc_agps_open_failed(AGpsType agpsType)
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int loc_agps_open_failed()
|
|
||||||
{
|
|
||||||
ENTRY_LOG();
|
|
||||||
int ret_val = loc_eng_agps_open_failed(loc_afw_data);
|
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_agps_set_server
|
FUNCTION loc_agps_set_server
|
||||||
|
@ -818,7 +918,6 @@ static void loc_agps_ril_update_network_availability(int available, const char*
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_ULP
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_inject_raw_command
|
FUNCTION loc_inject_raw_command
|
||||||
|
|
||||||
|
@ -842,18 +941,13 @@ static bool loc_inject_raw_command(char* command, int length)
|
||||||
EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
|
EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static void loc_cb(GpsLocation* location, void* locExt)
|
static void loc_cb(GpsLocation* location, void* locExt)
|
||||||
{
|
{
|
||||||
ENTRY_LOG();
|
ENTRY_LOG();
|
||||||
if (NULL != gps_loc_cb && NULL != location) {
|
if (NULL != gps_loc_cb && NULL != location) {
|
||||||
#ifdef QCOM_FEATURE_ULP
|
|
||||||
CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
|
CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
|
||||||
#else
|
|
||||||
CALLBACK_LOG_CALLFLOW("location_cb - at", %llu, location->timestamp);
|
|
||||||
#endif
|
|
||||||
gps_loc_cb(location);
|
gps_loc_cb(location);
|
||||||
}
|
}
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
|
@ -868,3 +962,156 @@ static void sv_cb(GpsSvStatus* sv_status, void* svExt)
|
||||||
}
|
}
|
||||||
EXIT_LOG(%s, VOID_RET);
|
EXIT_LOG(%s, VOID_RET);
|
||||||
}
|
}
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_eng_get_ulp_inf
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
This function checks if ULP is enabled, and loads the libulp2.so and
|
||||||
|
returns its interface
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
None
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
interface pointer to libulp: no error
|
||||||
|
NULL: errors
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
const ulpInterface * loc_eng_get_ulp_inf(void)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
void *handle;
|
||||||
|
const char *error;
|
||||||
|
get_ulp_interface* get_ulp_inf;
|
||||||
|
const ulpInterface* loc_eng_ulpInf = NULL;
|
||||||
|
|
||||||
|
if (!(gps_conf.CAPABILITIES & ULP_CAPABILITY)) {
|
||||||
|
LOC_LOGD ("%s, ULP is not configured to be On in gps.conf\n", __func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
dlerror(); /* Clear any existing error */
|
||||||
|
|
||||||
|
handle = dlopen ("libulp2.so", RTLD_NOW);
|
||||||
|
|
||||||
|
if (!handle)
|
||||||
|
{
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
LOC_LOGE ("%s, dlopen for libulp.so failed, error = %s\n", __func__, error);
|
||||||
|
}
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
dlerror(); /* Clear any existing error */
|
||||||
|
get_ulp_inf = (get_ulp_interface*) dlsym(handle, "ulp_get_interface");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
LOC_LOGE ("%s, dlsym for ulpInterface failed, error = %s\n", __func__, error);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the ULP interface
|
||||||
|
loc_eng_ulpInf = get_ulp_inf();
|
||||||
|
|
||||||
|
exit:
|
||||||
|
EXIT_LOG(%d, loc_eng_ulpInf == NULL);
|
||||||
|
return loc_eng_ulpInf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_ulp_network_init
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Initialize the ULP network interface.
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
NONE
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
0
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
static int loc_ulp_phone_context_init(UlpPhoneContextCallbacks *callbacks)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
int ret_val = loc_eng_ulp_phone_context_init(loc_afw_data, callbacks);
|
||||||
|
EXIT_LOG(%d, ret_val);
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_ulp_phone_context_settings_update
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
This is used to inform the ULP module of phone settings changes carried out
|
||||||
|
by the users
|
||||||
|
DEPENDENCIES
|
||||||
|
N/A
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
0: success
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
static int loc_ulp_phone_context_settings_update(UlpPhoneContextSettings *settings)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
int ret_val = -1;
|
||||||
|
ret_val = loc_eng_ulp_phone_context_settings_update(loc_afw_data, settings);
|
||||||
|
EXIT_LOG(%d, ret_val);
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_ulp_network_init
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Initialize the ULP network interface.
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
NONE
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
0
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
static int loc_ulp_network_init(UlpNetworkLocationCallbacks *callbacks)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
int ret_val = loc_eng_ulp_network_init(loc_afw_data, callbacks);
|
||||||
|
EXIT_LOG(%d, ret_val);
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION loc_eng_ulp_send_network_position
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Ulp send data
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
NONE
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
0
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
int loc_ulp_send_network_position(UlpNetworkPositionReport *position_report)
|
||||||
|
{
|
||||||
|
ENTRY_LOG();
|
||||||
|
int ret_val = -1;
|
||||||
|
ret_val = loc_eng_ulp_send_network_position(loc_afw_data, position_report);
|
||||||
|
EXIT_LOG(%d, ret_val);
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
|
3
loc_api/libloc_api_50001/loc.h
Executable file → Normal file
3
loc_api/libloc_api_50001/loc.h
Executable file → Normal file
|
@ -38,6 +38,8 @@ extern "C" {
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
|
|
||||||
|
#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
|
||||||
|
|
||||||
typedef enum loc_server_type {
|
typedef enum loc_server_type {
|
||||||
LOC_AGPS_CDMA_PDE_SERVER,
|
LOC_AGPS_CDMA_PDE_SERVER,
|
||||||
LOC_AGPS_CUSTOM_PDE_SERVER,
|
LOC_AGPS_CUSTOM_PDE_SERVER,
|
||||||
|
@ -78,6 +80,7 @@ enum loc_sess_status {
|
||||||
LOC_SESS_FAILURE
|
LOC_SESS_FAILURE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void loc_ulp_msg_sender(void* loc_eng_data_p, void* msg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
771
loc_api/libloc_api_50001/loc_eng.cpp
Executable file → Normal file
771
loc_api/libloc_api_50001/loc_eng.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load diff
88
loc_api/libloc_api_50001/loc_eng.h
Executable file → Normal file
88
loc_api/libloc_api_50001/loc_eng.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2009-2012 Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -36,6 +36,7 @@ extern "C" {
|
||||||
|
|
||||||
// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
|
// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
|
||||||
#define MAX_NUM_ATL_CONNECTIONS 2
|
#define MAX_NUM_ATL_CONNECTIONS 2
|
||||||
|
|
||||||
// Define boolean type to be used by libgps on loc api module
|
// Define boolean type to be used by libgps on loc api module
|
||||||
typedef unsigned char boolean;
|
typedef unsigned char boolean;
|
||||||
|
|
||||||
|
@ -67,16 +68,27 @@ typedef unsigned char boolean;
|
||||||
#define FAILURE FALSE
|
#define FAILURE FALSE
|
||||||
#define INVALID_ATL_CONNECTION_HANDLE -1
|
#define INVALID_ATL_CONNECTION_HANDLE -1
|
||||||
|
|
||||||
#define MAX_APN_LEN 100
|
|
||||||
#define MAX_URL_LEN 256
|
|
||||||
#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
|
|
||||||
|
|
||||||
enum loc_mute_session_e_type {
|
enum loc_mute_session_e_type {
|
||||||
LOC_MUTE_SESS_NONE = 0,
|
LOC_MUTE_SESS_NONE = 0,
|
||||||
LOC_MUTE_SESS_WAIT,
|
LOC_MUTE_SESS_WAIT,
|
||||||
LOC_MUTE_SESS_IN_SESSION
|
LOC_MUTE_SESS_IN_SESSION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LocEngContext {
|
||||||
|
// Data variables used by deferred action thread
|
||||||
|
const void* deferred_q;
|
||||||
|
const void* ulp_q;
|
||||||
|
const pthread_t deferred_action_thread;
|
||||||
|
static LocEngContext* get(gps_create_thread threadCreator);
|
||||||
|
void drop();
|
||||||
|
static pthread_mutex_t lock;
|
||||||
|
static pthread_cond_t cond;
|
||||||
|
private:
|
||||||
|
int counter;
|
||||||
|
static LocEngContext *me;
|
||||||
|
LocEngContext(gps_create_thread threadCreator);
|
||||||
|
};
|
||||||
|
|
||||||
// Module data
|
// Module data
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -89,6 +101,8 @@ typedef struct
|
||||||
gps_ni_notify_callback ni_notify_cb;
|
gps_ni_notify_callback ni_notify_cb;
|
||||||
gps_acquire_wakelock acquire_wakelock_cb;
|
gps_acquire_wakelock acquire_wakelock_cb;
|
||||||
gps_release_wakelock release_wakelock_cb;
|
gps_release_wakelock release_wakelock_cb;
|
||||||
|
ulp_network_location_request ulp_network_callback;
|
||||||
|
ulp_request_phone_context ulp_phone_context_req_cb;
|
||||||
boolean intermediateFix;
|
boolean intermediateFix;
|
||||||
AGpsStatusValue agps_status;
|
AGpsStatusValue agps_status;
|
||||||
// used to defer stopping the GPS engine until AGPS data calls are done
|
// used to defer stopping the GPS engine until AGPS data calls are done
|
||||||
|
@ -97,11 +111,10 @@ typedef struct
|
||||||
loc_eng_xtra_data_s_type xtra_module_data;
|
loc_eng_xtra_data_s_type xtra_module_data;
|
||||||
loc_eng_ni_data_s_type loc_eng_ni_data;
|
loc_eng_ni_data_s_type loc_eng_ni_data;
|
||||||
|
|
||||||
boolean navigating;
|
|
||||||
|
|
||||||
// AGPS state machines
|
// AGPS state machines
|
||||||
AgpsStateMachine* agnss_nif;
|
AgpsStateMachine* agnss_nif;
|
||||||
AgpsStateMachine* internet_nif;
|
AgpsStateMachine* internet_nif;
|
||||||
|
AgpsStateMachine* wifi_nif;
|
||||||
|
|
||||||
// GPS engine status
|
// GPS engine status
|
||||||
GpsStatusValue engine_status;
|
GpsStatusValue engine_status;
|
||||||
|
@ -112,8 +125,6 @@ typedef struct
|
||||||
|
|
||||||
void* context;
|
void* context;
|
||||||
|
|
||||||
loc_eng_msg_position_mode position_mode;
|
|
||||||
|
|
||||||
// For muting session broadcast
|
// For muting session broadcast
|
||||||
loc_mute_session_e_type mute_session_state;
|
loc_mute_session_e_type mute_session_state;
|
||||||
|
|
||||||
|
@ -127,12 +138,47 @@ typedef struct
|
||||||
int mpc_host_set;
|
int mpc_host_set;
|
||||||
char mpc_host_buf[101];
|
char mpc_host_buf[101];
|
||||||
int mpc_port_buf;
|
int mpc_port_buf;
|
||||||
|
bool ulp_initialized;
|
||||||
} loc_eng_data_s_type;
|
} loc_eng_data_s_type;
|
||||||
|
|
||||||
|
#include "ulp.h"
|
||||||
|
|
||||||
|
/* GPS.conf support */
|
||||||
|
typedef struct loc_gps_cfg_s
|
||||||
|
{
|
||||||
|
unsigned long INTERMEDIATE_POS;
|
||||||
|
unsigned long ACCURACY_THRES;
|
||||||
|
unsigned long ENABLE_WIPER;
|
||||||
|
unsigned long SUPL_VER;
|
||||||
|
unsigned long CAPABILITIES;
|
||||||
|
uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
|
||||||
|
double GYRO_BIAS_RANDOM_WALK;
|
||||||
|
unsigned long SENSOR_ACCEL_BATCHES_PER_SEC;
|
||||||
|
unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH;
|
||||||
|
unsigned long SENSOR_GYRO_BATCHES_PER_SEC;
|
||||||
|
unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH;
|
||||||
|
unsigned long SENSOR_CONTROL_MODE;
|
||||||
|
unsigned long SENSOR_USAGE;
|
||||||
|
unsigned long QUIPC_ENABLED;
|
||||||
|
unsigned long LPP_PROFILE;
|
||||||
|
unsigned long SENSOR_ALGORITHM_CONFIG_MASK;
|
||||||
|
uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||||
|
double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||||
|
uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||||
|
double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||||
|
uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||||
|
double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||||
|
uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||||
|
double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||||
|
} loc_gps_cfg_s_type;
|
||||||
|
|
||||||
|
extern loc_gps_cfg_s_type gps_conf;
|
||||||
|
|
||||||
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
|
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
|
||||||
LocCallbacks* callbacks,
|
LocCallbacks* callbacks,
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T event);
|
LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||||
|
void (*loc_external_msg_sender) (void*, void*));
|
||||||
|
int loc_eng_ulp_init(loc_eng_data_s_type &loc_eng_data, const ulpInterface * loc_eng_ulpInf);
|
||||||
int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
|
int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
|
||||||
int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
|
int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
|
||||||
void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
|
void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
|
||||||
|
@ -145,29 +191,19 @@ int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
|
||||||
void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
|
void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
|
||||||
GpsAidingData f);
|
GpsAidingData f);
|
||||||
int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
|
int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
|
||||||
LocPositionMode mode, GpsPositionRecurrence recurrence,
|
LocPosMode ¶ms);
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
|
||||||
uint32_t preferred_time);
|
|
||||||
const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
|
const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
|
||||||
const char* name);
|
const char* name);
|
||||||
#ifdef QCOM_FEATURE_ULP
|
|
||||||
int loc_eng_update_criteria(loc_eng_data_s_type &loc_eng_data,
|
int loc_eng_update_criteria(loc_eng_data_s_type &loc_eng_data,
|
||||||
UlpLocationCriteria criteria);
|
UlpLocationCriteria criteria);
|
||||||
#endif
|
|
||||||
|
|
||||||
void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
|
void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
|
||||||
AGpsCallbacks* callbacks);
|
AGpsCallbacks* callbacks);
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType,
|
int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType,
|
||||||
const char* apn, AGpsBearerType bearerType);
|
const char* apn, AGpsBearerType bearerType);
|
||||||
int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType);
|
int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType);
|
||||||
int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType);
|
int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType);
|
||||||
#else
|
|
||||||
int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, const char* apn);
|
|
||||||
int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data);
|
|
||||||
int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
|
int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
|
||||||
LocServerType type, const char *hostname, int port);
|
LocServerType type, const char *hostname, int port);
|
||||||
|
|
||||||
|
@ -196,7 +232,15 @@ extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
|
||||||
const GpsNiNotification *notif,
|
const GpsNiNotification *notif,
|
||||||
const void* passThrough);
|
const void* passThrough);
|
||||||
extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
|
extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
|
||||||
|
int loc_eng_ulp_network_init(loc_eng_data_s_type &loc_eng_data, UlpNetworkLocationCallbacks *callbacks);
|
||||||
|
|
||||||
|
int loc_eng_ulp_phone_context_settings_update(loc_eng_data_s_type &loc_eng_data,
|
||||||
|
UlpPhoneContextSettings *settings);
|
||||||
|
int loc_eng_ulp_phone_context_init(loc_eng_data_s_type &loc_eng_data,
|
||||||
|
UlpPhoneContextCallbacks *callback);
|
||||||
|
int loc_eng_ulp_send_network_position(loc_eng_data_s_type &loc_eng_data,
|
||||||
|
UlpNetworkPositionReport *position_report);
|
||||||
|
int loc_eng_read_config(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
109
loc_api/libloc_api_50001/loc_eng_agps.cpp
Executable file → Normal file
109
loc_api/libloc_api_50001/loc_eng_agps.cpp
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -87,7 +87,7 @@ const int Notification::BROADCAST_INACTIVE = 0x80000002;
|
||||||
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Subscriber: BITSubscriber / ATLSubscriber
|
// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
|
||||||
//======================================================================
|
//======================================================================
|
||||||
bool Subscriber::forMe(Notification ¬ification)
|
bool Subscriber::forMe(Notification ¬ification)
|
||||||
{
|
{
|
||||||
|
@ -120,14 +120,17 @@ bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
|
||||||
case RSRC_UNSUBSCRIBE:
|
case RSRC_UNSUBSCRIBE:
|
||||||
case RSRC_RELEASED:
|
case RSRC_RELEASED:
|
||||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||||
GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
||||||
break;
|
break;
|
||||||
case RSRC_DENIED:
|
case RSRC_DENIED:
|
||||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||||
GPSONE_LOC_API_IF_FAILURE);
|
GPSONE_LOC_API_IF_FAILURE);
|
||||||
break;
|
break;
|
||||||
case RSRC_GRANTED:
|
case RSRC_GRANTED:
|
||||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||||
GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -150,20 +153,56 @@ bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
|
||||||
((LocApiAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
|
((LocApiAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
|
||||||
break;
|
break;
|
||||||
case RSRC_DENIED:
|
case RSRC_DENIED:
|
||||||
|
{
|
||||||
|
AGpsType type = mBackwardCompatibleMode ?
|
||||||
|
AGPS_TYPE_INVALID : mStateMachine->getType();
|
||||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
|
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
|
||||||
(char*)mStateMachine->getAPN(),
|
(char*)mStateMachine->getAPN(),
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
mStateMachine->getBearer(),
|
mStateMachine->getBearer(),
|
||||||
#endif
|
type);
|
||||||
mStateMachine->getType());
|
}
|
||||||
break;
|
break;
|
||||||
case RSRC_GRANTED:
|
case RSRC_GRANTED:
|
||||||
|
{
|
||||||
|
AGpsType type = mBackwardCompatibleMode ?
|
||||||
|
AGPS_TYPE_INVALID : mStateMachine->getType();
|
||||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
|
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
|
||||||
(char*)mStateMachine->getAPN(),
|
(char*)mStateMachine->getAPN(),
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
mStateMachine->getBearer(),
|
mStateMachine->getBearer(),
|
||||||
#endif
|
type);
|
||||||
mStateMachine->getType());
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
notify = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return notify;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
|
||||||
|
{
|
||||||
|
bool notify = forMe(notification);
|
||||||
|
|
||||||
|
if (notify) {
|
||||||
|
switch(notification.rsrcStatus)
|
||||||
|
{
|
||||||
|
case RSRC_UNSUBSCRIBE:
|
||||||
|
break;
|
||||||
|
case RSRC_RELEASED:
|
||||||
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
senderId,
|
||||||
|
GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
||||||
|
break;
|
||||||
|
case RSRC_DENIED:
|
||||||
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
senderId,
|
||||||
|
GPSONE_LOC_API_IF_FAILURE);
|
||||||
|
break;
|
||||||
|
case RSRC_GRANTED:
|
||||||
|
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||||
|
senderId,
|
||||||
|
GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
notify = false;
|
notify = false;
|
||||||
|
@ -276,14 +315,11 @@ AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
Subscriber* subscriber = (Subscriber*) data;
|
Subscriber* subscriber = (Subscriber*) data;
|
||||||
if (subscriber->waitForCloseComplete()) {
|
if (subscriber->waitForCloseComplete()) {
|
||||||
subscriber->setInactive();
|
subscriber->setInactive();
|
||||||
if (!mStateMachine->hasActiveSubscribers()) {
|
|
||||||
// no more subscribers, move to RELEASED state
|
|
||||||
nextState = mReleasingState;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// auto notify this subscriber of the unsubscribe
|
// auto notify this subscriber of the unsubscribe
|
||||||
Notification notification(subscriber, event, true);
|
Notification notification(subscriber, event, true);
|
||||||
mStateMachine->notifySubscribers(notification);
|
mStateMachine->notifySubscribers(notification);
|
||||||
|
}
|
||||||
|
|
||||||
// now check if there is any subscribers left
|
// now check if there is any subscribers left
|
||||||
if (!mStateMachine->hasSubscribers()) {
|
if (!mStateMachine->hasSubscribers()) {
|
||||||
|
@ -292,7 +328,12 @@ AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
|
|
||||||
// tell connecivity service we can release NIF
|
// tell connecivity service we can release NIF
|
||||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||||
}
|
} else if (!mStateMachine->hasActiveSubscribers()) {
|
||||||
|
// only inactive subscribers, move to RELEASING state
|
||||||
|
nextState = mReleasingState;
|
||||||
|
|
||||||
|
// tell connecivity service we can release NIF
|
||||||
|
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -381,13 +422,13 @@ AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
// now check if there is any subscribers left
|
// now check if there is any subscribers left
|
||||||
if (!mStateMachine->hasSubscribers()) {
|
if (!mStateMachine->hasSubscribers()) {
|
||||||
// no more subscribers, move to RELEASED state
|
// no more subscribers, move to RELEASED state
|
||||||
nextState = mReleasingState;
|
nextState = mReleasedState;
|
||||||
|
|
||||||
// tell connecivity service we can release NIF
|
// tell connecivity service we can release NIF
|
||||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||||
} else if (!mStateMachine->hasActiveSubscribers()) {
|
} else if (!mStateMachine->hasActiveSubscribers()) {
|
||||||
// no more subscribers, move to RELEASED state
|
// only inactive subscribers, move to RELEASING state
|
||||||
nextState = mReleasedState;
|
nextState = mReleasingState;
|
||||||
|
|
||||||
// tell connecivity service we can release NIF
|
// tell connecivity service we can release NIF
|
||||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||||
|
@ -469,21 +510,14 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
|
|
||||||
// now check if there is any subscribers left
|
// now check if there is any subscribers left
|
||||||
if (!mStateMachine->hasSubscribers()) {
|
if (!mStateMachine->hasSubscribers()) {
|
||||||
// no more subscribers, move to RELEASED state
|
|
||||||
nextState = mReleasingState;
|
|
||||||
|
|
||||||
// tell connecivity service we can release NIF
|
|
||||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
|
||||||
} else if (!mStateMachine->hasActiveSubscribers()) {
|
|
||||||
// no more subscribers, move to RELEASED state
|
// no more subscribers, move to RELEASED state
|
||||||
nextState = mReleasedState;
|
nextState = mReleasedState;
|
||||||
|
|
||||||
// tell connecivity service we can release NIF
|
|
||||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RSRC_DENIED:
|
||||||
|
// A race condition subscriber unsubscribes before AFW denies resource.
|
||||||
case RSRC_RELEASED:
|
case RSRC_RELEASED:
|
||||||
{
|
{
|
||||||
nextState = mAcquiredState;
|
nextState = mAcquiredState;
|
||||||
|
@ -503,7 +537,6 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RSRC_GRANTED:
|
case RSRC_GRANTED:
|
||||||
case RSRC_DENIED:
|
|
||||||
default:
|
default:
|
||||||
LOC_LOGE("%s: unrecognized event %d", whoami(), event);
|
LOC_LOGE("%s: unrecognized event %d", whoami(), event);
|
||||||
// no state change.
|
// no state change.
|
||||||
|
@ -520,11 +553,13 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
AgpsStateMachine::AgpsStateMachine(void (*servicer)(AGpsStatus* status),
|
AgpsStateMachine::AgpsStateMachine(void (*servicer)(AGpsStatus* status),
|
||||||
AGpsType type) :
|
AGpsType type,
|
||||||
|
bool enforceSingleSubscriber) :
|
||||||
mServicer(servicer), mType(type),
|
mServicer(servicer), mType(type),
|
||||||
mStatePtr(new AgpsReleasedState(this)),
|
mStatePtr(new AgpsReleasedState(this)),
|
||||||
mAPN(NULL),
|
mAPN(NULL),
|
||||||
mAPNLen(0)
|
mAPNLen(0),
|
||||||
|
mEnforceSingleSubscriber(enforceSingleSubscriber)
|
||||||
{
|
{
|
||||||
linked_list_init(&mSubscribers);
|
linked_list_init(&mSubscribers);
|
||||||
|
|
||||||
|
@ -643,7 +678,7 @@ void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
|
||||||
void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
||||||
{
|
{
|
||||||
Subscriber* s = NULL;
|
Subscriber* s = NULL;
|
||||||
Notification notification(Notification::BROADCAST_ALL);
|
Notification notification(Notification::BROADCAST_ACTIVE);
|
||||||
linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
|
linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
|
||||||
(void*)¬ification, false);
|
(void*)¬ification, false);
|
||||||
|
|
||||||
|
@ -653,20 +688,15 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
||||||
nifRequest.type = mType;
|
nifRequest.type = mType;
|
||||||
nifRequest.status = action;
|
nifRequest.status = action;
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
nifRequest.ipv4_addr = INADDR_NONE;
|
nifRequest.ipv4_addr = INADDR_NONE;
|
||||||
nifRequest.ipv6_addr[0] = 0;
|
nifRequest.ipv6_addr[0] = 0;
|
||||||
|
nifRequest.ssid[0] = '\0';
|
||||||
|
nifRequest.password[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr);
|
s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr);
|
||||||
|
s->setWifiInfo(nifRequest.ssid, nifRequest.password);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (s == NULL) {
|
|
||||||
nifRequest.ipaddr = INADDR_NONE;
|
|
||||||
} else {
|
|
||||||
nifRequest.ipaddr = s->ID;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
|
CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
|
||||||
(*mServicer)(&nifRequest);
|
(*mServicer)(&nifRequest);
|
||||||
|
@ -675,7 +705,12 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
||||||
|
|
||||||
void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
|
void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
|
||||||
{
|
{
|
||||||
|
if (mEnforceSingleSubscriber && hasSubscribers()) {
|
||||||
|
Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
|
||||||
|
notifySubscriber(¬ification, subscriber);
|
||||||
|
} else {
|
||||||
mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
|
mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
|
bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
|
||||||
|
|
68
loc_api/libloc_api_50001/loc_eng_agps.h
Executable file → Normal file
68
loc_api/libloc_api_50001/loc_eng_agps.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
#include <linked_list.h>
|
#include <linked_list.h>
|
||||||
#include <LocApiAdapter.h>
|
#include <LocApiAdapter.h>
|
||||||
|
#include "loc_eng_msg.h"
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
class AgpsStateMachine;
|
class AgpsStateMachine;
|
||||||
|
@ -149,23 +150,20 @@ class AgpsStateMachine {
|
||||||
char* mAPN;
|
char* mAPN;
|
||||||
// for convenience, we don't do strlen each time.
|
// for convenience, we don't do strlen each time.
|
||||||
unsigned int mAPNLen;
|
unsigned int mAPNLen;
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
// bear
|
// bear
|
||||||
AGpsBearerType mBearer;
|
AGpsBearerType mBearer;
|
||||||
#endif
|
|
||||||
// ipv4 address for routing
|
// ipv4 address for routing
|
||||||
|
bool mEnforceSingleSubscriber;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AgpsStateMachine(void (*servicer)(AGpsStatus* status), AGpsType type);
|
AgpsStateMachine(void (*servicer)(AGpsStatus* status), AGpsType type, bool enforceSingleSubscriber);
|
||||||
virtual ~AgpsStateMachine();
|
virtual ~AgpsStateMachine();
|
||||||
|
|
||||||
// self explanatory methods below
|
// self explanatory methods below
|
||||||
void setAPN(const char* apn, unsigned int len);
|
void setAPN(const char* apn, unsigned int len);
|
||||||
inline const char* getAPN() const { return (const char*)mAPN; }
|
inline const char* getAPN() const { return (const char*)mAPN; }
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
|
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
|
||||||
inline AGpsBearerType getBearer() const { return mBearer; }
|
inline AGpsBearerType getBearer() const { return mBearer; }
|
||||||
#endif
|
|
||||||
inline AGpsType getType() const { return (AGpsType)mType; }
|
inline AGpsType getType() const { return (AGpsType)mType; }
|
||||||
|
|
||||||
// someone, a ATL client or BIT, is asking for NIF
|
// someone, a ATL client or BIT, is asking for NIF
|
||||||
|
@ -206,6 +204,7 @@ struct Subscriber {
|
||||||
inline virtual ~Subscriber() {}
|
inline virtual ~Subscriber() {}
|
||||||
|
|
||||||
virtual void setIPAddresses(int &v4, char* v6) = 0;
|
virtual void setIPAddresses(int &v4, char* v6) = 0;
|
||||||
|
inline virtual void setWifiInfo(char* ssid, char* password) {}
|
||||||
|
|
||||||
inline virtual bool equals(const Subscriber *s) const
|
inline virtual bool equals(const Subscriber *s) const
|
||||||
{ return ID == s->ID; }
|
{ return ID == s->ID; }
|
||||||
|
@ -256,10 +255,13 @@ private:
|
||||||
// ATLSubscriber, created with requests from ATL
|
// ATLSubscriber, created with requests from ATL
|
||||||
struct ATLSubscriber : public Subscriber {
|
struct ATLSubscriber : public Subscriber {
|
||||||
const LocApiAdapter* mLocAdapter;
|
const LocApiAdapter* mLocAdapter;
|
||||||
|
const bool mBackwardCompatibleMode;
|
||||||
inline ATLSubscriber(const int id,
|
inline ATLSubscriber(const int id,
|
||||||
const AgpsStateMachine* stateMachine,
|
const AgpsStateMachine* stateMachine,
|
||||||
const LocApiAdapter* adapter) :
|
const LocApiAdapter* adapter,
|
||||||
Subscriber(id, stateMachine), mLocAdapter(adapter) {}
|
const bool compatibleMode) :
|
||||||
|
Subscriber(id, stateMachine), mLocAdapter(adapter),
|
||||||
|
mBackwardCompatibleMode(compatibleMode){}
|
||||||
virtual bool notifyRsrcStatus(Notification ¬ification);
|
virtual bool notifyRsrcStatus(Notification ¬ification);
|
||||||
|
|
||||||
inline virtual void setIPAddresses(int &v4, char* v6)
|
inline virtual void setIPAddresses(int &v4, char* v6)
|
||||||
|
@ -267,7 +269,55 @@ struct ATLSubscriber : public Subscriber {
|
||||||
|
|
||||||
inline virtual Subscriber* clone()
|
inline virtual Subscriber* clone()
|
||||||
{
|
{
|
||||||
return new ATLSubscriber(ID, mStateMachine, mLocAdapter);
|
return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
|
||||||
|
mBackwardCompatibleMode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// WIFISubscriber, created with requests from MSAPM or QuIPC
|
||||||
|
struct WIFISubscriber : public Subscriber {
|
||||||
|
char * mSSID;
|
||||||
|
char * mPassword;
|
||||||
|
loc_if_req_sender_id_e_type senderId;
|
||||||
|
bool mIsInactive;
|
||||||
|
inline WIFISubscriber(const AgpsStateMachine* stateMachine,
|
||||||
|
char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
|
||||||
|
Subscriber(sender_id, stateMachine),
|
||||||
|
mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
|
||||||
|
mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
|
||||||
|
senderId(sender_id)
|
||||||
|
{
|
||||||
|
if (NULL != mSSID)
|
||||||
|
strlcpy(mSSID, ssid, SSID_BUF_SIZE);
|
||||||
|
if (NULL != mPassword)
|
||||||
|
strlcpy(mPassword, password, SSID_BUF_SIZE);
|
||||||
|
mIsInactive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool notifyRsrcStatus(Notification ¬ification);
|
||||||
|
|
||||||
|
inline virtual void setIPAddresses(int &v4, char* v6) {}
|
||||||
|
|
||||||
|
inline virtual void setWifiInfo(char* ssid, char* password)
|
||||||
|
{
|
||||||
|
if (NULL != mSSID)
|
||||||
|
strlcpy(ssid, mSSID, SSID_BUF_SIZE);
|
||||||
|
else
|
||||||
|
ssid[0] = '\0';
|
||||||
|
if (NULL != mPassword)
|
||||||
|
strlcpy(password, mPassword, SSID_BUF_SIZE);
|
||||||
|
else
|
||||||
|
password[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline virtual bool waitForCloseComplete() { return true; }
|
||||||
|
|
||||||
|
inline virtual void setInactive() { mIsInactive = true; }
|
||||||
|
inline virtual bool isInactive() { return mIsInactive; }
|
||||||
|
|
||||||
|
virtual Subscriber* clone()
|
||||||
|
{
|
||||||
|
return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
66
loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
Executable file → Normal file
66
loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -33,23 +33,54 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <grp.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
|
|
||||||
#include "loc_eng_dmn_conn_glue_msg.h"
|
#include "loc_eng_dmn_conn_glue_msg.h"
|
||||||
#include "loc_eng_dmn_conn_handler.h"
|
#include "loc_eng_dmn_conn_handler.h"
|
||||||
#include "loc_eng_dmn_conn.h"
|
#include "loc_eng_dmn_conn.h"
|
||||||
|
#include "loc_eng_msg.h"
|
||||||
|
|
||||||
static int loc_api_server_msgqid;
|
static int loc_api_server_msgqid;
|
||||||
static int loc_api_resp_msgqid;
|
static int loc_api_resp_msgqid;
|
||||||
|
static int quipc_msgqid;
|
||||||
|
static int msapm_msgqid;
|
||||||
|
|
||||||
static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
|
static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
|
||||||
static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
|
static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
|
||||||
|
static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
|
||||||
|
static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
|
||||||
|
|
||||||
static int loc_api_server_proc_init(void *context)
|
static int loc_api_server_proc_init(void *context)
|
||||||
{
|
{
|
||||||
loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
|
loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
|
||||||
|
//change mode/group for the global_loc_api_q_path pipe
|
||||||
|
int result = chmod (global_loc_api_q_path, 0660);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct group * gps_group = getgrnam("gps");
|
||||||
|
if (gps_group != NULL)
|
||||||
|
{
|
||||||
|
result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
LOC_LOGE("chown for pipe failed, gid = %d, result = %d, error = %s\n", gps_group->gr_gid, result, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
|
||||||
|
}
|
||||||
|
|
||||||
loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
|
loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
|
||||||
|
quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
|
||||||
|
msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
|
||||||
|
|
||||||
LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
|
LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -80,6 +111,7 @@ static int loc_api_server_proc(void *context)
|
||||||
LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
|
LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
|
||||||
length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
|
length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
|
free(p_cmsgbuf);
|
||||||
LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
|
LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -114,6 +146,8 @@ static int loc_api_server_proc_post(void *context)
|
||||||
LOC_LOGD("%s:%d]\n", __func__, __LINE__);
|
LOC_LOGD("%s:%d]\n", __func__, __LINE__);
|
||||||
loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
|
loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
|
||||||
loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
|
loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
|
||||||
|
loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
|
||||||
|
loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,16 +199,40 @@ int loc_eng_dmn_conn_loc_api_server_join(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loc_eng_dmn_conn_loc_api_server_data_conn(int status) {
|
int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
|
||||||
struct ctrl_msgbuf cmsgbuf;
|
struct ctrl_msgbuf cmsgbuf;
|
||||||
|
LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
|
||||||
cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
|
cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
|
||||||
cmsgbuf.cmsg.cmsg_response.result = status;
|
cmsgbuf.cmsg.cmsg_response.result = status;
|
||||||
LOC_LOGD("%s:%d] status = %d",__func__, __LINE__, status);
|
switch (sender_id) {
|
||||||
|
case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
|
||||||
|
LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
|
||||||
|
if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
|
||||||
|
LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
|
||||||
|
LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
|
||||||
|
if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
|
||||||
|
LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
|
||||||
|
LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
|
||||||
if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
|
if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
|
||||||
LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
|
LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
loc_api/libloc_api_50001/loc_eng_dmn_conn.h
Executable file → Normal file
8
loc_api/libloc_api_50001/loc_eng_dmn_conn.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -35,11 +35,15 @@
|
||||||
|
|
||||||
#define GPSONE_LOC_API_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_q"
|
#define GPSONE_LOC_API_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_q"
|
||||||
#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_resp_q"
|
#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_resp_q"
|
||||||
|
#define QUIPC_CTRL_Q_PATH "/data/misc/gpsone_d/quipc_ctrl_q"
|
||||||
|
#define MSAPM_CTRL_Q_PATH "/data/misc/gpsone_d/msapm_ctrl_q"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
|
#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
|
||||||
#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
|
#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
|
||||||
|
#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
|
||||||
|
#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread
|
||||||
const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
|
const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
|
||||||
int loc_eng_dmn_conn_loc_api_server_unblock(void);
|
int loc_eng_dmn_conn_loc_api_server_unblock(void);
|
||||||
int loc_eng_dmn_conn_loc_api_server_join(void);
|
int loc_eng_dmn_conn_loc_api_server_join(void);
|
||||||
int loc_eng_dmn_conn_loc_api_server_data_conn(int);
|
int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
|
||||||
|
|
||||||
#endif /* LOC_ENG_DATA_SERVER_H */
|
#endif /* LOC_ENG_DATA_SERVER_H */
|
||||||
|
|
||||||
|
|
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
Executable file → Normal file
136
loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
Executable file → Normal file
136
loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -47,15 +47,79 @@ int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NULL != loc_api_handle) {
|
||||||
|
loc_if_req_type_e_type type;
|
||||||
|
switch (pmsg->cmsg.cmsg_if_request.type) {
|
||||||
|
case IF_REQUEST_TYPE_SUPL:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_SUPL");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_SUPL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_TYPE_WIFI:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_WIFI");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_WIFI;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_TYPE_ANY:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_ANY");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_ANY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
LOC_LOGD("invalid IF_REQUEST_TYPE!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (pmsg->cmsg.cmsg_if_request.sender_id) {
|
||||||
|
case IF_REQUEST_SENDER_ID_QUIPC:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
|
||||||
|
loc_eng_msg_request_wifi *msg(
|
||||||
|
new loc_eng_msg_request_wifi(loc_api_handle,
|
||||||
|
type,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.ssid,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.password));
|
||||||
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_SENDER_ID_MSAPM:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
|
||||||
|
loc_eng_msg_request_wifi *msg(
|
||||||
|
new loc_eng_msg_request_wifi(loc_api_handle,
|
||||||
|
type,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.ssid,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.password));
|
||||||
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
|
||||||
loc_eng_msg_request_bit *msg(
|
loc_eng_msg_request_bit *msg(
|
||||||
new loc_eng_msg_request_bit(loc_api_handle,
|
new loc_eng_msg_request_bit(loc_api_handle,
|
||||||
pmsg->cmsg.cmsg_if_request.is_supl,
|
type,
|
||||||
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
||||||
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
||||||
loc_eng_msg_sender(loc_api_handle, msg);
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
loc_eng_dmn_conn_loc_api_server_data_conn(GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -64,14 +128,76 @@ int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg,
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s:%d]\n", __func__, __LINE__);
|
LOC_LOGD("%s:%d]\n", __func__, __LINE__);
|
||||||
#ifndef DEBUG_DMN_LOC_API
|
#ifndef DEBUG_DMN_LOC_API
|
||||||
|
loc_if_req_type_e_type type;
|
||||||
|
switch (pmsg->cmsg.cmsg_if_request.type) {
|
||||||
|
case IF_REQUEST_TYPE_SUPL:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_SUPL");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_SUPL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_TYPE_WIFI:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_WIFI");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_WIFI;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_TYPE_ANY:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_TYPE_ANY");
|
||||||
|
type = LOC_ENG_IF_REQUEST_TYPE_ANY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
LOC_LOGD("invalid IF_REQUEST_TYPE!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (pmsg->cmsg.cmsg_if_request.sender_id) {
|
||||||
|
case IF_REQUEST_SENDER_ID_QUIPC:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
|
||||||
|
loc_eng_msg_release_wifi *msg(
|
||||||
|
new loc_eng_msg_release_wifi(loc_api_handle,
|
||||||
|
type,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.ssid,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.password));
|
||||||
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_SENDER_ID_MSAPM:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
|
||||||
|
loc_eng_msg_release_wifi *msg(
|
||||||
|
new loc_eng_msg_release_wifi(loc_api_handle,
|
||||||
|
type,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.ssid,
|
||||||
|
(char*)pmsg->cmsg.cmsg_if_request.password));
|
||||||
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
|
||||||
|
{
|
||||||
|
LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
|
||||||
loc_eng_msg_release_bit *msg(
|
loc_eng_msg_release_bit *msg(
|
||||||
new loc_eng_msg_release_bit(loc_api_handle,
|
new loc_eng_msg_release_bit(loc_api_handle,
|
||||||
pmsg->cmsg.cmsg_if_request.is_supl,
|
type,
|
||||||
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
||||||
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
||||||
loc_eng_msg_sender(loc_api_handle, msg);
|
loc_eng_msg_sender(loc_api_handle, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
loc_eng_dmn_conn_loc_api_server_data_conn(GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
23
loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
Executable file → Normal file
23
loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -32,6 +32,9 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
//for SSID_BUF_SIZE
|
||||||
|
#include <hardware/gps.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* 0x0 - 0xEF is reserved for daemon internal */
|
/* 0x0 - 0xEF is reserved for daemon internal */
|
||||||
GPSONE_LOC_API_IF_REQUEST = 0xF0,
|
GPSONE_LOC_API_IF_REQUEST = 0xF0,
|
||||||
|
@ -55,10 +58,26 @@ struct ctrl_msg_unblock {
|
||||||
int reserved;
|
int reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
IF_REQUEST_TYPE_SUPL = 0,
|
||||||
|
IF_REQUEST_TYPE_WIFI,
|
||||||
|
IF_REQUEST_TYPE_ANY
|
||||||
|
} ctrl_if_req_type_e_type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
IF_REQUEST_SENDER_ID_QUIPC = 0,
|
||||||
|
IF_REQUEST_SENDER_ID_MSAPM,
|
||||||
|
IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||||
|
IF_REQUEST_SENDER_ID_MODEM
|
||||||
|
} ctrl_if_req_sender_id_e_type;
|
||||||
|
|
||||||
struct ctrl_msg_if_request {
|
struct ctrl_msg_if_request {
|
||||||
unsigned is_supl; /* 1: use Android SUPL connection; 0: use Android default internet connection */
|
ctrl_if_req_type_e_type type;
|
||||||
|
ctrl_if_req_sender_id_e_type sender_id;
|
||||||
unsigned long ipv4_addr;
|
unsigned long ipv4_addr;
|
||||||
unsigned char ipv6_addr[16];
|
unsigned char ipv6_addr[16];
|
||||||
|
char ssid[SSID_BUF_SIZE];
|
||||||
|
char password[SSID_BUF_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* do not change this structure */
|
/* do not change this structure */
|
||||||
|
|
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
Executable file → Normal file
36
loc_api/libloc_api_50001/loc_eng_log.cpp
Executable file → Normal file
36
loc_api/libloc_api_50001/loc_eng_log.cpp
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012 Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -31,7 +31,6 @@
|
||||||
#define LOG_TAG "LocSvc_eng"
|
#define LOG_TAG "LocSvc_eng"
|
||||||
|
|
||||||
#include "hardware/gps.h"
|
#include "hardware/gps.h"
|
||||||
#include "loc.h"
|
|
||||||
#include "loc_log.h"
|
#include "loc_log.h"
|
||||||
#include "loc_eng_log.h"
|
#include "loc_eng_log.h"
|
||||||
#include "loc_eng_msg_id.h"
|
#include "loc_eng_msg_id.h"
|
||||||
|
@ -88,10 +87,24 @@ static loc_name_val_s_type loc_eng_msgs[] =
|
||||||
NAME_VAL( LOC_ENG_MSG_RELEASE_ATL ),
|
NAME_VAL( LOC_ENG_MSG_RELEASE_ATL ),
|
||||||
NAME_VAL( LOC_ENG_MSG_REQUEST_BIT ),
|
NAME_VAL( LOC_ENG_MSG_REQUEST_BIT ),
|
||||||
NAME_VAL( LOC_ENG_MSG_RELEASE_BIT ),
|
NAME_VAL( LOC_ENG_MSG_RELEASE_BIT ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_REQUEST_WIFI ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_RELEASE_WIFI ),
|
||||||
NAME_VAL( LOC_ENG_MSG_REQUEST_NI ),
|
NAME_VAL( LOC_ENG_MSG_REQUEST_NI ),
|
||||||
NAME_VAL( LOC_ENG_MSG_INFORM_NI_RESPONSE ),
|
NAME_VAL( LOC_ENG_MSG_INFORM_NI_RESPONSE ),
|
||||||
NAME_VAL( LOC_ENG_MSG_REQUEST_XTRA_DATA ),
|
NAME_VAL( LOC_ENG_MSG_REQUEST_XTRA_DATA ),
|
||||||
NAME_VAL( LOC_ENG_MSG_REQUEST_TIME )
|
NAME_VAL( LOC_ENG_MSG_REQUEST_TIME ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_EXT_POWER_CONFIG ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_REQUEST_POSITION ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_REQUEST_PHONE_CONTEXT ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_REQUEST_NETWORK_POSIITON ),
|
||||||
|
NAME_VAL( ULP_MSG_UPDATE_CRITERIA ),
|
||||||
|
NAME_VAL( ULP_MSG_START_FIX ),
|
||||||
|
NAME_VAL( ULP_MSG_STOP_FIX ),
|
||||||
|
NAME_VAL( ULP_MSG_INJECT_PHONE_CONTEXT_SETTINGS ),
|
||||||
|
NAME_VAL( ULP_MSG_INJECT_NETWORK_POSITION ),
|
||||||
|
NAME_VAL( ULP_MSG_REPORT_QUIPC_POSITION ),
|
||||||
|
NAME_VAL( ULP_MSG_REQUEST_COARSE_POSITION ),
|
||||||
|
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG )
|
||||||
};
|
};
|
||||||
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);
|
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
@ -149,9 +162,8 @@ static loc_name_val_s_type loc_eng_aiding_data_bits[] =
|
||||||
NAME_VAL( GPS_DELETE_SVSTEER ),
|
NAME_VAL( GPS_DELETE_SVSTEER ),
|
||||||
NAME_VAL( GPS_DELETE_SADATA ),
|
NAME_VAL( GPS_DELETE_SADATA ),
|
||||||
NAME_VAL( GPS_DELETE_RTI ),
|
NAME_VAL( GPS_DELETE_RTI ),
|
||||||
NAME_VAL( GPS_DELETE_CELLDB_INFO )
|
NAME_VAL( GPS_DELETE_CELLDB_INFO ),
|
||||||
#ifdef QCOM_FEATURE_DELEXT
|
NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
|
||||||
,NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
|
|
||||||
NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
|
NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
|
||||||
NAME_VAL( GPS_DELETE_EPHEMERIS_GLO ),
|
NAME_VAL( GPS_DELETE_EPHEMERIS_GLO ),
|
||||||
NAME_VAL( GPS_DELETE_ALMANAC_GLO ),
|
NAME_VAL( GPS_DELETE_ALMANAC_GLO ),
|
||||||
|
@ -160,7 +172,6 @@ static loc_name_val_s_type loc_eng_aiding_data_bits[] =
|
||||||
NAME_VAL( GPS_DELETE_ALMANAC_CORR_GLO ),
|
NAME_VAL( GPS_DELETE_ALMANAC_CORR_GLO ),
|
||||||
NAME_VAL( GPS_DELETE_TIME_GPS ),
|
NAME_VAL( GPS_DELETE_TIME_GPS ),
|
||||||
NAME_VAL( GPS_DELETE_TIME_GLO )
|
NAME_VAL( GPS_DELETE_TIME_GLO )
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
|
static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
@ -172,15 +183,11 @@ const char* loc_get_aiding_data_mask_names(GpsAidingData data)
|
||||||
|
|
||||||
static loc_name_val_s_type loc_eng_agps_types[] =
|
static loc_name_val_s_type loc_eng_agps_types[] =
|
||||||
{
|
{
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
NAME_VAL( AGPS_TYPE_INVALID ),
|
NAME_VAL( AGPS_TYPE_INVALID ),
|
||||||
NAME_VAL( AGPS_TYPE_ANY ),
|
NAME_VAL( AGPS_TYPE_ANY ),
|
||||||
#endif
|
|
||||||
NAME_VAL( AGPS_TYPE_SUPL ),
|
NAME_VAL( AGPS_TYPE_SUPL ),
|
||||||
NAME_VAL( AGPS_TYPE_C2K )
|
NAME_VAL( AGPS_TYPE_C2K ),
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
NAME_VAL( AGPS_TYPE_WWAN_ANY )
|
||||||
,NAME_VAL( AGPS_TYPE_WWAN_ANY )
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
|
static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
@ -233,7 +240,7 @@ const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
|
||||||
return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
|
return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
static loc_name_val_s_type loc_eng_agps_bears[] =
|
static loc_name_val_s_type loc_eng_agps_bears[] =
|
||||||
{
|
{
|
||||||
NAME_VAL( AGPS_APN_BEARER_INVALID ),
|
NAME_VAL( AGPS_APN_BEARER_INVALID ),
|
||||||
|
@ -247,7 +254,6 @@ const char* loc_get_agps_bear_name(AGpsBearerType bearer)
|
||||||
{
|
{
|
||||||
return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
|
return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static loc_name_val_s_type loc_eng_server_types[] =
|
static loc_name_val_s_type loc_eng_server_types[] =
|
||||||
{
|
{
|
||||||
|
|
4
loc_api/libloc_api_50001/loc_eng_log.h
Executable file → Normal file
4
loc_api/libloc_api_50001/loc_eng_log.h
Executable file → Normal file
|
@ -37,7 +37,7 @@ extern "C"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
#include "loc_eng_msg_id.h"
|
#include <loc.h>
|
||||||
|
|
||||||
const char* loc_get_gps_status_name(GpsStatusValue gps_status);
|
const char* loc_get_gps_status_name(GpsStatusValue gps_status);
|
||||||
const char* loc_get_msg_name(int id);
|
const char* loc_get_msg_name(int id);
|
||||||
|
@ -48,9 +48,7 @@ const char* loc_get_agps_type_name(AGpsType type);
|
||||||
const char* loc_get_ni_type_name(GpsNiType type);
|
const char* loc_get_ni_type_name(GpsNiType type);
|
||||||
const char* loc_get_ni_response_name(GpsUserResponseType response);
|
const char* loc_get_ni_response_name(GpsUserResponseType response);
|
||||||
const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding);
|
const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding);
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
const char* loc_get_agps_bear_name(AGpsBearerType bear);
|
const char* loc_get_agps_bear_name(AGpsBearerType bear);
|
||||||
#endif
|
|
||||||
const char* loc_get_server_type_name(LocServerType type);
|
const char* loc_get_server_type_name(LocServerType type);
|
||||||
const char* loc_get_position_sess_status_name(enum loc_sess_status status);
|
const char* loc_get_position_sess_status_name(enum loc_sess_status status);
|
||||||
const char* loc_get_agps_status_name(AGpsStatusValue status);
|
const char* loc_get_agps_status_name(AGpsStatusValue status);
|
||||||
|
|
0
loc_api/libloc_api_50001/loc_eng_msg.cpp
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_msg.cpp
Executable file → Normal file
431
loc_api/libloc_api_50001/loc_eng_msg.h
Executable file → Normal file
431
loc_api/libloc_api_50001/loc_eng_msg.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012 Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -35,14 +35,83 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
#include "loc.h"
|
#include "loc.h"
|
||||||
#include "loc_eng_log.h"
|
#include <loc_eng_log.h>
|
||||||
#include "loc_eng_msg_id.h"
|
#include "loc_eng_msg_id.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
struct LocPosMode
|
||||||
|
{
|
||||||
|
LocPositionMode mode;
|
||||||
|
GpsPositionRecurrence recurrence;
|
||||||
|
uint32_t min_interval;
|
||||||
|
uint32_t preferred_accuracy;
|
||||||
|
uint32_t preferred_time;
|
||||||
|
char credentials[14];
|
||||||
|
char provider[8];
|
||||||
|
LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
|
||||||
|
uint32_t gap, uint32_t accu, uint32_t time,
|
||||||
|
const char* cred, const char* prov) :
|
||||||
|
mode(m), recurrence(recr),
|
||||||
|
min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
|
||||||
|
preferred_accuracy(accu), preferred_time(time) {
|
||||||
|
memset(credentials, 0, sizeof(credentials));
|
||||||
|
memset(provider, 0, sizeof(provider));
|
||||||
|
if (NULL != cred) {
|
||||||
|
memcpy(credentials, cred, sizeof(credentials)-1);
|
||||||
|
}
|
||||||
|
if (NULL != prov) {
|
||||||
|
memcpy(provider, prov, sizeof(provider)-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LocPosMode() :
|
||||||
|
mode(LOC_POSITION_MODE_MS_BASED), recurrence(GPS_POSITION_RECURRENCE_PERIODIC),
|
||||||
|
min_interval(MIN_POSSIBLE_FIX_INTERVAL), preferred_accuracy(50), preferred_time(120000) {
|
||||||
|
memset(credentials, 0, sizeof(credentials));
|
||||||
|
memset(provider, 0, sizeof(provider));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool equals(const LocPosMode &anotherMode) const
|
||||||
|
{
|
||||||
|
return anotherMode.mode == mode &&
|
||||||
|
anotherMode.recurrence == recurrence &&
|
||||||
|
anotherMode.min_interval == min_interval &&
|
||||||
|
anotherMode.preferred_accuracy == preferred_accuracy &&
|
||||||
|
anotherMode.preferred_time == preferred_time &&
|
||||||
|
!strncmp(anotherMode.credentials, credentials, sizeof(credentials)-1) &&
|
||||||
|
!strncmp(anotherMode.provider, provider, sizeof(provider)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void logv() const
|
||||||
|
{
|
||||||
|
LOC_LOGV ("Position mode: %s\n Position recurrence: %s\n min interval: %d\n preferred accuracy: %d\n preferred time: %d\n credentials: %s provider: %s",
|
||||||
|
loc_get_position_mode_name(mode),
|
||||||
|
loc_get_position_recurrence_name(recurrence),
|
||||||
|
min_interval,
|
||||||
|
preferred_accuracy,
|
||||||
|
preferred_time,
|
||||||
|
credentials,
|
||||||
|
provider);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LOC_ENG_IF_REQUEST_TYPE_SUPL = 0,
|
||||||
|
LOC_ENG_IF_REQUEST_TYPE_WIFI,
|
||||||
|
LOC_ENG_IF_REQUEST_TYPE_ANY
|
||||||
|
} loc_if_req_type_e_type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_MODEM,
|
||||||
|
LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN
|
||||||
|
} loc_if_req_sender_id_e_type;
|
||||||
|
|
||||||
struct loc_eng_msg {
|
struct loc_eng_msg {
|
||||||
const void* owner;
|
const void* owner;
|
||||||
const int msgid;
|
const int msgid;
|
||||||
|
@ -50,10 +119,12 @@ struct loc_eng_msg {
|
||||||
owner(instance), msgid(id)
|
owner(instance), msgid(id)
|
||||||
{
|
{
|
||||||
LOC_LOGV("creating msg %s", loc_get_msg_name(msgid));
|
LOC_LOGV("creating msg %s", loc_get_msg_name(msgid));
|
||||||
|
LOC_LOGV("creating msg ox%x", msgid);
|
||||||
}
|
}
|
||||||
virtual ~loc_eng_msg()
|
virtual ~loc_eng_msg()
|
||||||
{
|
{
|
||||||
LOC_LOGV("deleting msg %s", loc_get_msg_name(msgid));
|
LOC_LOGV("deleting msg %s", loc_get_msg_name(msgid));
|
||||||
|
LOC_LOGV("deleting msg ox%x", msgid);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,6 +138,26 @@ struct loc_eng_msg_suple_version : public loc_eng_msg {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_lpp_config : public loc_eng_msg {
|
||||||
|
const int lpp_config;
|
||||||
|
inline loc_eng_msg_lpp_config(void *instance, int profile) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_LPP_CONFIG),
|
||||||
|
lpp_config(profile)
|
||||||
|
{
|
||||||
|
LOC_LOGV("lpp profile: %d", profile);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_ext_power_config : public loc_eng_msg {
|
||||||
|
const int isBatteryCharging;
|
||||||
|
inline loc_eng_msg_ext_power_config(void* instance, int isBattCharging) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_EXT_POWER_CONFIG),
|
||||||
|
isBatteryCharging(isBattCharging)
|
||||||
|
{
|
||||||
|
LOC_LOGV("isBatteryCharging: %d", isBatteryCharging);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct loc_eng_msg_sensor_control_config : public loc_eng_msg {
|
struct loc_eng_msg_sensor_control_config : public loc_eng_msg {
|
||||||
const int sensorsDisabled;
|
const int sensorsDisabled;
|
||||||
inline loc_eng_msg_sensor_control_config(void* instance, int disabled) :
|
inline loc_eng_msg_sensor_control_config(void* instance, int disabled) :
|
||||||
|
@ -78,12 +169,51 @@ struct loc_eng_msg_sensor_control_config : public loc_eng_msg {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct loc_eng_msg_sensor_properties : public loc_eng_msg {
|
struct loc_eng_msg_sensor_properties : public loc_eng_msg {
|
||||||
|
const bool gyroBiasVarianceRandomWalk_valid;
|
||||||
const float gyroBiasVarianceRandomWalk;
|
const float gyroBiasVarianceRandomWalk;
|
||||||
inline loc_eng_msg_sensor_properties(void* instance, float gyroBiasRandomWalk) :
|
const bool accelRandomWalk_valid;
|
||||||
|
const float accelRandomWalk;
|
||||||
|
const bool angleRandomWalk_valid;
|
||||||
|
const float angleRandomWalk;
|
||||||
|
const bool rateRandomWalk_valid;
|
||||||
|
const float rateRandomWalk;
|
||||||
|
const bool velocityRandomWalk_valid;
|
||||||
|
const float velocityRandomWalk;
|
||||||
|
inline loc_eng_msg_sensor_properties(void* instance, bool gyroBiasRandomWalk_valid, float gyroBiasRandomWalk,
|
||||||
|
bool accelRandomWalk_valid, float accelRandomWalk,
|
||||||
|
bool angleRandomWalk_valid, float angleRandomWalk,
|
||||||
|
bool rateRandomWalk_valid, float rateRandomWalk,
|
||||||
|
bool velocityRandomWalk_valid, float velocityRandomWalk) :
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_SENSOR_PROPERTIES),
|
loc_eng_msg(instance, LOC_ENG_MSG_SET_SENSOR_PROPERTIES),
|
||||||
gyroBiasVarianceRandomWalk(gyroBiasRandomWalk)
|
gyroBiasVarianceRandomWalk_valid(gyroBiasRandomWalk_valid),
|
||||||
|
gyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
|
||||||
|
accelRandomWalk_valid(accelRandomWalk_valid),
|
||||||
|
accelRandomWalk(accelRandomWalk),
|
||||||
|
angleRandomWalk_valid(angleRandomWalk_valid),
|
||||||
|
angleRandomWalk(angleRandomWalk),
|
||||||
|
rateRandomWalk_valid(rateRandomWalk_valid),
|
||||||
|
rateRandomWalk(rateRandomWalk),
|
||||||
|
velocityRandomWalk_valid(velocityRandomWalk_valid),
|
||||||
|
velocityRandomWalk(velocityRandomWalk)
|
||||||
{
|
{
|
||||||
LOC_LOGV("Gyro Bias Random Walk: %f", gyroBiasRandomWalk);
|
LOC_LOGV("Sensor properties validity, Gyro Random walk: %d Accel Random Walk: %d "
|
||||||
|
"Angle Random Walk: %d Rate Random Walk: %d "
|
||||||
|
"Velocity Random Walk: %d",
|
||||||
|
gyroBiasRandomWalk_valid,
|
||||||
|
accelRandomWalk_valid,
|
||||||
|
angleRandomWalk_valid,
|
||||||
|
rateRandomWalk_valid,
|
||||||
|
velocityRandomWalk_valid
|
||||||
|
);
|
||||||
|
LOC_LOGV("Sensor properties, Gyro Random walk: %f Accel Random Walk: %f "
|
||||||
|
"Angle Random Walk: %f Rate Random Walk: %f "
|
||||||
|
"Velocity Random Walk: %f",
|
||||||
|
gyroBiasRandomWalk,
|
||||||
|
accelRandomWalk,
|
||||||
|
angleRandomWalk,
|
||||||
|
rateRandomWalk,
|
||||||
|
velocityRandomWalk
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,55 +223,40 @@ struct loc_eng_msg_sensor_perf_control_config : public loc_eng_msg {
|
||||||
const int accelBatchesPerSec;
|
const int accelBatchesPerSec;
|
||||||
const int gyroSamplesPerBatch;
|
const int gyroSamplesPerBatch;
|
||||||
const int gyroBatchesPerSec;
|
const int gyroBatchesPerSec;
|
||||||
|
const int algorithmConfig;
|
||||||
inline loc_eng_msg_sensor_perf_control_config(void* instance, int controlMode,
|
inline loc_eng_msg_sensor_perf_control_config(void* instance, int controlMode,
|
||||||
int accelSamplesPerBatch, int accelBatchesPerSec,
|
int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||||
int gyroSamplesPerBatch, int gyroBatchesPerSec) :
|
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||||
|
int algorithmConfig) :
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG),
|
loc_eng_msg(instance, LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG),
|
||||||
controlMode(controlMode),
|
controlMode(controlMode),
|
||||||
accelSamplesPerBatch(accelSamplesPerBatch),
|
accelSamplesPerBatch(accelSamplesPerBatch),
|
||||||
accelBatchesPerSec(accelBatchesPerSec),
|
accelBatchesPerSec(accelBatchesPerSec),
|
||||||
gyroSamplesPerBatch(gyroSamplesPerBatch),
|
gyroSamplesPerBatch(gyroSamplesPerBatch),
|
||||||
gyroBatchesPerSec(gyroBatchesPerSec)
|
gyroBatchesPerSec(gyroBatchesPerSec),
|
||||||
|
algorithmConfig(algorithmConfig)
|
||||||
{
|
{
|
||||||
LOC_LOGV("Sensor Perf Control Config (performanceControlMode)(%u) "
|
LOC_LOGV("Sensor Perf Control Config (performanceControlMode)(%u) "
|
||||||
"accel(#smp,#batches) (%u,%u) gyro(#smp,#batches) (%u,%u)\n",
|
"accel(#smp,#batches) (%u,%u) gyro(#smp,#batches) (%u,%u), algorithmConfig(%u)\n",
|
||||||
controlMode,
|
controlMode,
|
||||||
accelSamplesPerBatch,
|
accelSamplesPerBatch,
|
||||||
accelBatchesPerSec,
|
accelBatchesPerSec,
|
||||||
gyroSamplesPerBatch,
|
gyroSamplesPerBatch,
|
||||||
gyroBatchesPerSec
|
gyroBatchesPerSec,
|
||||||
|
algorithmConfig
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct loc_eng_msg_position_mode : public loc_eng_msg {
|
struct loc_eng_msg_position_mode : public loc_eng_msg {
|
||||||
const LocPositionMode pMode;
|
const LocPosMode pMode;
|
||||||
const GpsPositionRecurrence pRecurrence;
|
|
||||||
const uint32_t minInterval;
|
|
||||||
const uint32_t preferredAccuracy;
|
|
||||||
const uint32_t preferredTime;
|
|
||||||
inline loc_eng_msg_position_mode() :
|
|
||||||
loc_eng_msg(NULL, LOC_ENG_MSG_SET_POSITION_MODE),
|
|
||||||
pMode(LOC_POSITION_MODE_STANDALONE),
|
|
||||||
pRecurrence(0), minInterval(0),
|
|
||||||
preferredAccuracy(0), preferredTime(0) {}
|
|
||||||
inline loc_eng_msg_position_mode(void* instance,
|
inline loc_eng_msg_position_mode(void* instance,
|
||||||
LocPositionMode mode,
|
LocPosMode &mode) :
|
||||||
GpsPositionRecurrence recurrence,
|
|
||||||
uint32_t min_interval,
|
|
||||||
uint32_t preferred_accuracy,
|
|
||||||
uint32_t preferred_time) :
|
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_POSITION_MODE),
|
loc_eng_msg(instance, LOC_ENG_MSG_SET_POSITION_MODE),
|
||||||
pMode(mode), pRecurrence(recurrence), minInterval(min_interval),
|
pMode(mode)
|
||||||
preferredAccuracy(preferred_accuracy), preferredTime(preferred_time)
|
|
||||||
{
|
{
|
||||||
LOC_LOGV("Position mode: %s\n Position recurrence: %s\n min interval: %d\n preferred accuracy: %d\n preferred time: %d",
|
pMode.logv();
|
||||||
loc_get_position_mode_name(pMode),
|
|
||||||
loc_get_position_recurrence_name(pRecurrence),
|
|
||||||
minInterval,
|
|
||||||
preferredAccuracy,
|
|
||||||
preferredTime);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,18 +308,10 @@ struct loc_eng_msg_report_position : public loc_eng_msg {
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
||||||
location(loc), locationExt(locExt), status(st)
|
location(loc), locationExt(locExt), status(st)
|
||||||
{
|
{
|
||||||
#ifdef QCOM_FEATURE_ULP
|
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session status: %d",
|
||||||
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session status: %s",
|
|
||||||
location.flags, location.position_source, location.latitude, location.longitude,
|
location.flags, location.position_source, location.latitude, location.longitude,
|
||||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||||
location.timestamp, location.rawDataSize, location.rawData,
|
location.timestamp, location.rawDataSize, location.rawData,status);
|
||||||
loc_get_position_sess_status_name(status));
|
|
||||||
#else
|
|
||||||
LOC_LOGV("flags: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n Session status: %s",
|
|
||||||
location.flags, location.latitude, location.longitude,
|
|
||||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
|
||||||
location.timestamp, loc_get_position_sess_status_name(status));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -256,23 +363,23 @@ struct loc_eng_msg_report_nmea : public loc_eng_msg {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct loc_eng_msg_request_bit : public loc_eng_msg {
|
struct loc_eng_msg_request_bit : public loc_eng_msg {
|
||||||
const unsigned int isSupl;
|
const loc_if_req_type_e_type ifType;
|
||||||
const int ipv4Addr;
|
const int ipv4Addr;
|
||||||
char* const ipv6Addr;
|
char* const ipv6Addr;
|
||||||
inline loc_eng_msg_request_bit(void* instance,
|
inline loc_eng_msg_request_bit(void* instance,
|
||||||
unsigned int is_supl,
|
loc_if_req_type_e_type type,
|
||||||
int ipv4,
|
int ipv4,
|
||||||
char* ipv6) :
|
char* ipv6) :
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_REQUEST_BIT),
|
loc_eng_msg(instance, LOC_ENG_MSG_REQUEST_BIT),
|
||||||
isSupl(is_supl), ipv4Addr(ipv4),
|
ifType(type), ipv4Addr(ipv4),
|
||||||
ipv6Addr(NULL == ipv6 ? NULL : new char[16])
|
ipv6Addr(NULL == ipv6 ? NULL : new char[16])
|
||||||
{
|
{
|
||||||
if (NULL != ipv6Addr)
|
if (NULL != ipv6Addr)
|
||||||
memcpy(ipv6Addr, ipv6, 16);
|
memcpy(ipv6Addr, ipv6, 16);
|
||||||
LOC_LOGV("isSupl: %d, ipv4: %d.%d.%d.%d, ipv6: %s", isSupl,
|
LOC_LOGV("ifType: %d, ipv4: %d.%d.%d.%d, ipv6: %s", ifType,
|
||||||
(unsigned char)ipv4>>24,
|
(unsigned char)(ipv4>>24),
|
||||||
(unsigned char)ipv4>>16,
|
(unsigned char)(ipv4>>16),
|
||||||
(unsigned char)ipv4>>8,
|
(unsigned char)(ipv4>>8),
|
||||||
(unsigned char)ipv4,
|
(unsigned char)ipv4,
|
||||||
NULL != ipv6Addr ? ipv6Addr : "");
|
NULL != ipv6Addr ? ipv6Addr : "");
|
||||||
}
|
}
|
||||||
|
@ -285,24 +392,61 @@ struct loc_eng_msg_request_bit : public loc_eng_msg {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_request_wifi : public loc_eng_msg {
|
||||||
|
const loc_if_req_type_e_type ifType;
|
||||||
|
const loc_if_req_sender_id_e_type senderId;
|
||||||
|
char* const ssid;
|
||||||
|
char* const password;
|
||||||
|
inline loc_eng_msg_request_wifi(void* instance,
|
||||||
|
loc_if_req_type_e_type type,
|
||||||
|
loc_if_req_sender_id_e_type sender_id,
|
||||||
|
char* s,
|
||||||
|
char* p) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_REQUEST_WIFI),
|
||||||
|
ifType(type), senderId(sender_id),
|
||||||
|
ssid(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
|
||||||
|
password(NULL == p ? NULL : new char[SSID_BUF_SIZE])
|
||||||
|
{
|
||||||
|
if (NULL != ssid)
|
||||||
|
strlcpy(ssid, s, SSID_BUF_SIZE);
|
||||||
|
if (NULL != password)
|
||||||
|
strlcpy(password, p, SSID_BUF_SIZE);
|
||||||
|
LOC_LOGV("ifType: %d, senderId: %d, ssid: %s, password: %s",
|
||||||
|
ifType,
|
||||||
|
senderId,
|
||||||
|
NULL != ssid ? ssid : "",
|
||||||
|
NULL != password ? password : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ~loc_eng_msg_request_wifi()
|
||||||
|
{
|
||||||
|
if (NULL != ssid) {
|
||||||
|
delete[] ssid;
|
||||||
|
}
|
||||||
|
if (NULL != password) {
|
||||||
|
delete[] password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct loc_eng_msg_release_bit : public loc_eng_msg {
|
struct loc_eng_msg_release_bit : public loc_eng_msg {
|
||||||
const unsigned int isSupl;
|
const loc_if_req_type_e_type ifType;
|
||||||
const int ipv4Addr;
|
const int ipv4Addr;
|
||||||
char* const ipv6Addr;
|
char* const ipv6Addr;
|
||||||
inline loc_eng_msg_release_bit(void* instance,
|
inline loc_eng_msg_release_bit(void* instance,
|
||||||
unsigned int is_supl,
|
loc_if_req_type_e_type type,
|
||||||
int ipv4,
|
int ipv4,
|
||||||
char* ipv6) :
|
char* ipv6) :
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_RELEASE_BIT),
|
loc_eng_msg(instance, LOC_ENG_MSG_RELEASE_BIT),
|
||||||
isSupl(is_supl), ipv4Addr(ipv4),
|
ifType(type), ipv4Addr(ipv4),
|
||||||
ipv6Addr(NULL == ipv6 ? NULL : new char[16])
|
ipv6Addr(NULL == ipv6 ? NULL : new char[16])
|
||||||
{
|
{
|
||||||
if (NULL != ipv6Addr)
|
if (NULL != ipv6Addr)
|
||||||
memcpy(ipv6Addr, ipv6, 16);
|
memcpy(ipv6Addr, ipv6, 16);
|
||||||
LOC_LOGV("isSupl: %d, ipv4: %d.%d.%d.%d, ipv6: %s", isSupl,
|
LOC_LOGV("ifType: %d, ipv4: %d.%d.%d.%d, ipv6: %s", ifType,
|
||||||
(unsigned char)ipv4>>24,
|
(unsigned char)(ipv4>>24),
|
||||||
(unsigned char)ipv4>>16,
|
(unsigned char)(ipv4>>16),
|
||||||
(unsigned char)ipv4>>8,
|
(unsigned char)(ipv4>>8),
|
||||||
(unsigned char)ipv4,
|
(unsigned char)ipv4,
|
||||||
NULL != ipv6Addr ? ipv6Addr : "");
|
NULL != ipv6Addr ? ipv6Addr : "");
|
||||||
}
|
}
|
||||||
|
@ -315,6 +459,44 @@ struct loc_eng_msg_release_bit : public loc_eng_msg {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_release_wifi : public loc_eng_msg {
|
||||||
|
const loc_if_req_type_e_type ifType;
|
||||||
|
const loc_if_req_sender_id_e_type senderId;
|
||||||
|
char* const ssid;
|
||||||
|
char* const password;
|
||||||
|
inline loc_eng_msg_release_wifi(void* instance,
|
||||||
|
loc_if_req_type_e_type type,
|
||||||
|
loc_if_req_sender_id_e_type sender_id,
|
||||||
|
char* s,
|
||||||
|
char* p) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_RELEASE_WIFI),
|
||||||
|
ifType(type), senderId(sender_id),
|
||||||
|
ssid(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
|
||||||
|
password(NULL == p ? NULL : new char[SSID_BUF_SIZE])
|
||||||
|
{
|
||||||
|
if (NULL != s)
|
||||||
|
strlcpy(ssid, s, SSID_BUF_SIZE);
|
||||||
|
if (NULL != p)
|
||||||
|
strlcpy(password, p, SSID_BUF_SIZE);
|
||||||
|
LOC_LOGV("ifType: %d, senderId: %d, ssid: %s, password: %s",
|
||||||
|
ifType,
|
||||||
|
senderId,
|
||||||
|
NULL != ssid ? ssid : "",
|
||||||
|
NULL != password ? password : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ~loc_eng_msg_release_wifi()
|
||||||
|
{
|
||||||
|
if (NULL != ssid) {
|
||||||
|
delete[] ssid;
|
||||||
|
}
|
||||||
|
if (NULL != password) {
|
||||||
|
delete[] password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct loc_eng_msg_request_atl : public loc_eng_msg {
|
struct loc_eng_msg_request_atl : public loc_eng_msg {
|
||||||
const int handle;
|
const int handle;
|
||||||
const AGpsType type;
|
const AGpsType type;
|
||||||
|
@ -452,7 +634,6 @@ struct loc_eng_msg_inject_xtra_data : public loc_eng_msg {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
||||||
const AGpsStatusValue agpsType;
|
const AGpsStatusValue agpsType;
|
||||||
const int length;
|
const int length;
|
||||||
|
@ -479,30 +660,7 @@ struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
||||||
delete[] apn;
|
delete[] apn;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
|
||||||
const int length;
|
|
||||||
char* const apn;
|
|
||||||
inline loc_eng_msg_atl_open_success(void* instance,
|
|
||||||
const char* name,
|
|
||||||
int len) :
|
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_ATL_OPEN_SUCCESS),
|
|
||||||
length(len),
|
|
||||||
apn(new char[len+1])
|
|
||||||
{
|
|
||||||
memcpy((void*)apn, (void*)name, len);
|
|
||||||
apn[len] = 0;
|
|
||||||
LOC_LOGV("apn: %s\n",
|
|
||||||
apn);
|
|
||||||
}
|
|
||||||
inline ~loc_eng_msg_atl_open_success()
|
|
||||||
{
|
|
||||||
delete[] apn;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
||||||
const AGpsStatusValue agpsType;
|
const AGpsStatusValue agpsType;
|
||||||
inline loc_eng_msg_atl_open_failed(void* instance,
|
inline loc_eng_msg_atl_open_failed(void* instance,
|
||||||
|
@ -514,17 +672,7 @@ struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
||||||
loc_get_agps_type_name(agpsType));
|
loc_get_agps_type_name(agpsType));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
|
||||||
inline loc_eng_msg_atl_open_failed(void* instance) :
|
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_ATL_OPEN_FAILED)
|
|
||||||
{
|
|
||||||
LOC_LOGV("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
struct loc_eng_msg_atl_closed : public loc_eng_msg {
|
struct loc_eng_msg_atl_closed : public loc_eng_msg {
|
||||||
const AGpsStatusValue agpsType;
|
const AGpsStatusValue agpsType;
|
||||||
inline loc_eng_msg_atl_closed(void* instance,
|
inline loc_eng_msg_atl_closed(void* instance,
|
||||||
|
@ -536,15 +684,6 @@ struct loc_eng_msg_atl_closed : public loc_eng_msg {
|
||||||
loc_get_agps_type_name(agpsType));
|
loc_get_agps_type_name(agpsType));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
struct loc_eng_msg_atl_closed : public loc_eng_msg {
|
|
||||||
inline loc_eng_msg_atl_closed(void* instance) :
|
|
||||||
loc_eng_msg(instance, LOC_ENG_MSG_ATL_CLOSED)
|
|
||||||
{
|
|
||||||
LOC_LOGV("");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct loc_eng_msg_set_data_enable : public loc_eng_msg {
|
struct loc_eng_msg_set_data_enable : public loc_eng_msg {
|
||||||
const int enable;
|
const int enable;
|
||||||
|
@ -567,6 +706,98 @@ struct loc_eng_msg_set_data_enable : public loc_eng_msg {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_request_network_position : public loc_eng_msg {
|
||||||
|
const UlpNetworkRequestPos networkPosRequest;
|
||||||
|
inline loc_eng_msg_request_network_position (void* instance, UlpNetworkRequestPos networkPosReq) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_REQUEST_NETWORK_POSIITON),
|
||||||
|
networkPosRequest(networkPosReq)
|
||||||
|
{
|
||||||
|
LOC_LOGV("network position request: desired pos source %d\n request type: %d\n interval ms: %d ",
|
||||||
|
networkPosReq.desired_position_source,
|
||||||
|
networkPosReq.request_type,
|
||||||
|
networkPosReq.interval_ms);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct loc_eng_msg_request_phone_context : public loc_eng_msg {
|
||||||
|
const UlpPhoneContextRequest contextRequest;
|
||||||
|
inline loc_eng_msg_request_phone_context (void* instance, UlpPhoneContextRequest contextReq) :
|
||||||
|
loc_eng_msg(instance, LOC_ENG_MSG_REQUEST_PHONE_CONTEXT),
|
||||||
|
contextRequest(contextReq)
|
||||||
|
{
|
||||||
|
LOC_LOGV("phone context request: request type 0x%x context type: 0x%x ",
|
||||||
|
contextRequest.request_type,
|
||||||
|
contextRequest.context_type);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ulp_msg_update_criteria : public loc_eng_msg {
|
||||||
|
const UlpLocationCriteria locationCriteria;
|
||||||
|
inline ulp_msg_update_criteria (void* instance, UlpLocationCriteria criteria) :
|
||||||
|
loc_eng_msg(instance, ULP_MSG_UPDATE_CRITERIA),
|
||||||
|
locationCriteria(criteria)
|
||||||
|
{
|
||||||
|
LOC_LOGV("location criteria: aciton %d\n valid mask: %d\n provider source: %d\n accuracy %d\n recurrence type %d\n min interval %d\n power consumption %d\n intermediate pos %d ",
|
||||||
|
locationCriteria.action,
|
||||||
|
locationCriteria.valid_mask,
|
||||||
|
locationCriteria.provider_source,
|
||||||
|
locationCriteria.preferred_horizontal_accuracy,
|
||||||
|
locationCriteria.recurrence_type,
|
||||||
|
locationCriteria.min_interval,
|
||||||
|
locationCriteria.preferred_power_consumption,
|
||||||
|
locationCriteria.intermediate_pos_report_enabled);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ulp_msg_inject_phone_context_settings : public loc_eng_msg {
|
||||||
|
const UlpPhoneContextSettings phoneSetting;
|
||||||
|
inline ulp_msg_inject_phone_context_settings(void* instance, UlpPhoneContextSettings setting) :
|
||||||
|
loc_eng_msg(instance, ULP_MSG_INJECT_PHONE_CONTEXT_SETTINGS),
|
||||||
|
phoneSetting(setting)
|
||||||
|
{
|
||||||
|
LOC_LOGV("context type: %d\n gps enabled: %d\n network position available %d\n wifi setting enabled %d\n battery charging %d"
|
||||||
|
"is_agps_setting_enabled %d, is_enh_location_services_enabled %d\n",
|
||||||
|
phoneSetting.context_type,
|
||||||
|
phoneSetting.is_gps_enabled,
|
||||||
|
phoneSetting.is_network_position_available,
|
||||||
|
phoneSetting.is_wifi_setting_enabled,
|
||||||
|
phoneSetting.is_battery_charging,
|
||||||
|
phoneSetting.is_agps_enabled,
|
||||||
|
phoneSetting.is_enh_location_services_enabled);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ulp_msg_inject_network_position : public loc_eng_msg {
|
||||||
|
const UlpNetworkPositionReport networkPosition;
|
||||||
|
inline ulp_msg_inject_network_position(void* instance, UlpNetworkPositionReport networkPos) :
|
||||||
|
loc_eng_msg(instance, ULP_MSG_INJECT_NETWORK_POSITION),
|
||||||
|
networkPosition(networkPos)
|
||||||
|
{
|
||||||
|
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n accuracy %d",
|
||||||
|
networkPosition.valid_flag,
|
||||||
|
networkPosition.position.pos_source,
|
||||||
|
networkPosition.position.latitude,
|
||||||
|
networkPosition.position.longitude,
|
||||||
|
networkPosition.position.HEPE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ulp_msg_report_quipc_position : public loc_eng_msg {
|
||||||
|
const GpsLocation location;
|
||||||
|
const int quipc_error_code;
|
||||||
|
inline ulp_msg_report_quipc_position(void* instance, GpsLocation &loc,
|
||||||
|
int quipc_err) :
|
||||||
|
loc_eng_msg(instance, ULP_MSG_REPORT_QUIPC_POSITION),
|
||||||
|
location(loc), quipc_error_code(quipc_err)
|
||||||
|
{
|
||||||
|
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Quipc error: %d",
|
||||||
|
location.flags, location.position_source, location.latitude, location.longitude,
|
||||||
|
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||||
|
location.timestamp, location.rawDataSize, location.rawData,
|
||||||
|
quipc_error_code);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void loc_eng_msg_sender(void* loc_eng_data_p, void* msg);
|
void loc_eng_msg_sender(void* loc_eng_data_p, void* msg);
|
||||||
int loc_eng_msgget(int * p_req_msgq);
|
int loc_eng_msgget(int * p_req_msgq);
|
||||||
int loc_eng_msgremove(int req_msgq);
|
int loc_eng_msgremove(int req_msgq);
|
||||||
|
|
41
loc_api/libloc_api_50001/loc_eng_msg_id.h
Executable file → Normal file
41
loc_api/libloc_api_50001/loc_eng_msg_id.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011,2012 Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -76,11 +76,48 @@ enum loc_eng_msg_ids_t {
|
||||||
LOC_ENG_MSG_RELEASE_BIT,
|
LOC_ENG_MSG_RELEASE_BIT,
|
||||||
LOC_ENG_MSG_REQUEST_ATL,
|
LOC_ENG_MSG_REQUEST_ATL,
|
||||||
LOC_ENG_MSG_RELEASE_ATL,
|
LOC_ENG_MSG_RELEASE_ATL,
|
||||||
|
LOC_ENG_MSG_REQUEST_WIFI,
|
||||||
|
LOC_ENG_MSG_RELEASE_WIFI,
|
||||||
LOC_ENG_MSG_REQUEST_NI,
|
LOC_ENG_MSG_REQUEST_NI,
|
||||||
LOC_ENG_MSG_INFORM_NI_RESPONSE,
|
LOC_ENG_MSG_INFORM_NI_RESPONSE,
|
||||||
LOC_ENG_MSG_REQUEST_XTRA_DATA,
|
LOC_ENG_MSG_REQUEST_XTRA_DATA,
|
||||||
LOC_ENG_MSG_REQUEST_TIME,
|
LOC_ENG_MSG_REQUEST_TIME,
|
||||||
LOC_ENG_MSG_REQUEST_POSITION
|
LOC_ENG_MSG_REQUEST_POSITION,
|
||||||
|
LOC_ENG_MSG_EXT_POWER_CONFIG,
|
||||||
|
|
||||||
|
// The following messages are added for ulp
|
||||||
|
LOC_ENG_MSG_REQUEST_PHONE_CONTEXT,
|
||||||
|
LOC_ENG_MSG_REQUEST_NETWORK_POSIITON,
|
||||||
|
|
||||||
|
/* Following messages are for ulp, start at index 0x600 */
|
||||||
|
|
||||||
|
// Message is sent by GPS HAL layer to add/remove unique request criteria
|
||||||
|
ULP_MSG_UPDATE_CRITERIA = 0x600,
|
||||||
|
|
||||||
|
// Message is sent by GPS HAL layer to request ULP to start producing position fixes
|
||||||
|
|
||||||
|
ULP_MSG_START_FIX,
|
||||||
|
|
||||||
|
// Message is sent by Android framework(GpsLocationProvider)
|
||||||
|
// to request ULP to stop producing position fixes
|
||||||
|
ULP_MSG_STOP_FIX,
|
||||||
|
|
||||||
|
// Message is sent by Android framework(GpsLocationProvider)
|
||||||
|
// to inject phone context setting include initial phone context setting and subsequent changes
|
||||||
|
ULP_MSG_INJECT_PHONE_CONTEXT_SETTINGS,
|
||||||
|
|
||||||
|
// Message is sent by network provider to INJECT the position in UlpNetworkPositionReport format
|
||||||
|
ULP_MSG_INJECT_NETWORK_POSITION,
|
||||||
|
|
||||||
|
// Message is sent by QUIPC provider in order to report the position in GpsPosition format with QUIPC status
|
||||||
|
ULP_MSG_REPORT_QUIPC_POSITION,
|
||||||
|
|
||||||
|
// Message is sent by QUIPC module in order to request some info from ULP
|
||||||
|
ULP_MSG_REQUEST_COARSE_POSITION,
|
||||||
|
|
||||||
|
/* Message is sent by HAL to LOC API to configure LTE Positioning
|
||||||
|
Profile in modem */
|
||||||
|
LOC_ENG_MSG_LPP_CONFIG
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
0
loc_api/libloc_api_50001/loc_eng_ni.cpp
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_ni.cpp
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_ni.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_ni.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_xtra.cpp
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_xtra.cpp
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_xtra.h
Executable file → Normal file
0
loc_api/libloc_api_50001/loc_eng_xtra.h
Executable file → Normal file
0
loc_api/loc_api_v02/Android.mk
Executable file → Normal file
0
loc_api/loc_api_v02/Android.mk
Executable file → Normal file
312
loc_api/loc_api_v02/LocApiV02Adapter.cpp
Executable file → Normal file
312
loc_api/loc_api_v02/LocApiV02Adapter.cpp
Executable file → Normal file
|
@ -26,6 +26,9 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LOG_NDEBUG 0
|
||||||
|
#define LOG_TAG "LocSvc_adapter"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -40,9 +43,6 @@
|
||||||
#include "loc_api_v02_log.h"
|
#include "loc_api_v02_log.h"
|
||||||
#include "loc_api_sync_req.h"
|
#include "loc_api_sync_req.h"
|
||||||
#include "LocApiAdapter.h"
|
#include "LocApiAdapter.h"
|
||||||
|
|
||||||
#define LOG_NDEBUG 0
|
|
||||||
#define LOG_TAG "LocSvc_adapter"
|
|
||||||
#include "loc_util_log.h"
|
#include "loc_util_log.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,10 +161,7 @@ locClientCallbacksType globalCallbacks =
|
||||||
/* Constructor for LocApiV02Adapter */
|
/* Constructor for LocApiV02Adapter */
|
||||||
LocApiV02Adapter :: LocApiV02Adapter(LocEng &locEng):
|
LocApiV02Adapter :: LocApiV02Adapter(LocEng &locEng):
|
||||||
LocApiAdapter(locEng), clientHandle( LOC_CLIENT_INVALID_HANDLE_VALUE),
|
LocApiAdapter(locEng), clientHandle( LOC_CLIENT_INVALID_HANDLE_VALUE),
|
||||||
eventMask(convertMask(locEng.eventMask)), navigating(false),
|
eventMask(convertMask(locEng.eventMask))
|
||||||
fixCriteria (LOC_POSITION_MODE_MS_BASED, GPS_POSITION_RECURRENCE_PERIODIC,
|
|
||||||
LOC_API_V02_DEF_MIN_INTERVAL, LOC_API_V02_DEF_HORZ_ACCURACY,
|
|
||||||
LOC_API_V02_DEF_TIMEOUT )
|
|
||||||
{
|
{
|
||||||
// initialize loc_sync_req interface
|
// initialize loc_sync_req interface
|
||||||
loc_sync_req_init();
|
loc_sync_req_init();
|
||||||
|
@ -236,6 +233,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
||||||
memset (&set_mode_ind, 0, sizeof(set_mode_ind));
|
memset (&set_mode_ind, 0, sizeof(set_mode_ind));
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: start \n", __func__, __LINE__);
|
LOC_LOGV("%s:%d]: start \n", __func__, __LINE__);
|
||||||
|
fixCriteria.logv();
|
||||||
|
|
||||||
// fill in the start request
|
// fill in the start request
|
||||||
switch(fixCriteria.mode)
|
switch(fixCriteria.mode)
|
||||||
|
@ -277,12 +275,10 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
||||||
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; // error
|
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; // error
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fixCriteria.min_interval > 0)
|
|
||||||
{
|
|
||||||
start_msg.minInterval_valid = 1;
|
start_msg.minInterval_valid = 1;
|
||||||
start_msg.minInterval = fixCriteria.min_interval;
|
start_msg.minInterval = fixCriteria.min_interval;
|
||||||
}
|
|
||||||
|
|
||||||
|
if (fixCriteria.preferred_accuracy > 0) {
|
||||||
start_msg.horizontalAccuracyLevel_valid = 1;
|
start_msg.horizontalAccuracyLevel_valid = 1;
|
||||||
|
|
||||||
if (fixCriteria.preferred_accuracy <= 100)
|
if (fixCriteria.preferred_accuracy <= 100)
|
||||||
|
@ -300,6 +296,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
||||||
//fix needs low accuracy
|
//fix needs low accuracy
|
||||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
|
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
start_msg.fixRecurrence_valid = 1;
|
start_msg.fixRecurrence_valid = 1;
|
||||||
if(GPS_POSITION_RECURRENCE_SINGLE == fixCriteria.recurrence)
|
if(GPS_POSITION_RECURRENCE_SINGLE == fixCriteria.recurrence)
|
||||||
|
@ -313,7 +310,25 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
||||||
|
|
||||||
//dummy session id
|
//dummy session id
|
||||||
// TBD: store session ID, check for session id in pos reports.
|
// TBD: store session ID, check for session id in pos reports.
|
||||||
start_msg.sessionId = LOC_API_V02_DEF_SESSION_ID;;
|
start_msg.sessionId = LOC_API_V02_DEF_SESSION_ID;
|
||||||
|
|
||||||
|
if (fixCriteria.credentials[0] != 0) {
|
||||||
|
int size1 = sizeof(start_msg.applicationId.applicationName);
|
||||||
|
int size2 = sizeof(fixCriteria.credentials);
|
||||||
|
int len = ((size1 < size2) ? size1 : size2) - 1;
|
||||||
|
memcpy(start_msg.applicationId.applicationName,
|
||||||
|
fixCriteria.credentials,
|
||||||
|
len);
|
||||||
|
|
||||||
|
size1 = sizeof(start_msg.applicationId.applicationProvider);
|
||||||
|
size2 = sizeof(fixCriteria.provider);
|
||||||
|
len = ((size1 < size2) ? size1 : size2) - 1;
|
||||||
|
memcpy(start_msg.applicationId.applicationProvider,
|
||||||
|
fixCriteria.provider,
|
||||||
|
len);
|
||||||
|
|
||||||
|
start_msg.applicationId_valid = 1;
|
||||||
|
}
|
||||||
|
|
||||||
req_union.pStartReq = &start_msg;
|
req_union.pStartReq = &start_msg;
|
||||||
|
|
||||||
|
@ -322,13 +337,9 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
||||||
|
|
||||||
if( eLOC_CLIENT_SUCCESS == status)
|
if( eLOC_CLIENT_SUCCESS == status)
|
||||||
{
|
{
|
||||||
navigating = true;
|
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start_fix failed so MO fix is not in progress
|
|
||||||
navigating = false;
|
|
||||||
|
|
||||||
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
|
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +366,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: stopFix()
|
||||||
|
|
||||||
if( eLOC_CLIENT_SUCCESS == status)
|
if( eLOC_CLIENT_SUCCESS == status)
|
||||||
{
|
{
|
||||||
navigating = false;
|
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,31 +376,16 @@ enum loc_api_adapter_err LocApiV02Adapter :: stopFix()
|
||||||
|
|
||||||
/* set the positioning fix criteria */
|
/* set the positioning fix criteria */
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: setPositionMode(
|
enum loc_api_adapter_err LocApiV02Adapter :: setPositionMode(
|
||||||
LocPositionMode mode, GpsPositionRecurrence recurrence,
|
const LocPosMode *posMode)
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
|
||||||
uint32_t preferred_time)
|
|
||||||
{
|
{
|
||||||
|
LOC_LOGV ("%s:%d]: posMode %p",__func__, __LINE__, posMode);
|
||||||
|
|
||||||
LOC_LOGV ("%s:%d]: interval = %d, mode = %d, recurrence = %d, preferred_accuracy = %d\n",__func__, __LINE__,
|
if (NULL != posMode &&
|
||||||
min_interval, mode, recurrence, preferred_accuracy);
|
!fixCriteria.equals(*posMode)) {
|
||||||
|
//making a copy of the fix criteria
|
||||||
|
fixCriteria = *posMode;
|
||||||
|
|
||||||
//store the fix criteria
|
LOC_LOGD ("%s:%d]: new fix criteria", __func__, __LINE__);
|
||||||
fixCriteria.mode = mode;
|
|
||||||
|
|
||||||
fixCriteria.recurrence = recurrence;
|
|
||||||
|
|
||||||
if(min_interval == 0)
|
|
||||||
{
|
|
||||||
fixCriteria.min_interval = MIN_POSSIBLE_FIX_INTERVAL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fixCriteria.min_interval = min_interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
fixCriteria.preferred_accuracy = preferred_accuracy;
|
|
||||||
|
|
||||||
fixCriteria.preferred_time = preferred_time;
|
|
||||||
|
|
||||||
if(true == navigating)
|
if(true == navigating)
|
||||||
{
|
{
|
||||||
|
@ -400,6 +395,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: setPositionMode(
|
||||||
|
|
||||||
return( startFix());
|
return( startFix());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -563,13 +559,12 @@ enum loc_api_adapter_err LocApiV02Adapter :: deleteAidingData(GpsAidingData f)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QCOM_FEATURE_DELEXT
|
|
||||||
if( f & GPS_DELETE_TIME_GPS )
|
if( f & GPS_DELETE_TIME_GPS )
|
||||||
{
|
{
|
||||||
delete_req.deleteGnssDataMask_valid = 1;
|
delete_req.deleteGnssDataMask_valid = 1;
|
||||||
delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GPS_TIME_V02;
|
delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GPS_TIME_V02;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if(f & GPS_DELETE_POSITION )
|
if(f & GPS_DELETE_POSITION )
|
||||||
{
|
{
|
||||||
delete_req.deleteGnssDataMask_valid = 1;
|
delete_req.deleteGnssDataMask_valid = 1;
|
||||||
|
@ -631,7 +626,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: deleteAidingData(GpsAidingData f)
|
||||||
QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02) ;
|
QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef QCOM_FEATURE_DELEXT
|
|
||||||
if(f & GPS_DELETE_ALMANAC_CORR )
|
if(f & GPS_DELETE_ALMANAC_CORR )
|
||||||
{
|
{
|
||||||
delete_req.deleteGnssDataMask_valid = 1;
|
delete_req.deleteGnssDataMask_valid = 1;
|
||||||
|
@ -705,7 +699,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: deleteAidingData(GpsAidingData f)
|
||||||
delete_req.deleteGnssDataMask_valid = 1;
|
delete_req.deleteGnssDataMask_valid = 1;
|
||||||
delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GLO_TIME_V02;
|
delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GLO_TIME_V02;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
req_union.pDeleteAssistDataReq = &delete_req;
|
req_union.pDeleteAssistDataReq = &delete_req;
|
||||||
|
@ -1002,7 +995,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: setXtraData(
|
||||||
|
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
||||||
int handle, int is_succ, char* apn, AGpsBearerType bear,
|
int handle, int is_succ, char* apn, AGpsBearerType bear,
|
||||||
AGpsType agpsType)
|
AGpsType agpsType)
|
||||||
|
@ -1082,68 +1075,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
|
||||||
int handle, int is_succ, char* apn, AGpsType agpsType)
|
|
||||||
{
|
|
||||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
|
||||||
locClientReqUnionType req_union;
|
|
||||||
qmiLocInformLocationServerConnStatusReqMsgT_v02 conn_status_req;
|
|
||||||
qmiLocInformLocationServerConnStatusIndMsgT_v02 conn_status_ind;
|
|
||||||
|
|
||||||
LOC_LOGD("%s:%d]: ATL open handle = %d, is_succ = %d, "
|
|
||||||
"APN = [%s] \n", __func__, __LINE__,
|
|
||||||
handle, is_succ, apn);
|
|
||||||
|
|
||||||
memset(&conn_status_req, 0, sizeof(conn_status_req));
|
|
||||||
memset(&conn_status_ind, 0, sizeof(conn_status_ind));
|
|
||||||
|
|
||||||
// Fill in data
|
|
||||||
conn_status_req.connHandle = handle;
|
|
||||||
|
|
||||||
conn_status_req.requestType = eQMI_LOC_SERVER_REQUEST_OPEN_V02;
|
|
||||||
|
|
||||||
if(is_succ)
|
|
||||||
{
|
|
||||||
conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_SUCCESS_V02;
|
|
||||||
|
|
||||||
strlcpy(conn_status_req.apnProfile.apnName, apn,
|
|
||||||
sizeof(conn_status_req.apnProfile.apnName) );
|
|
||||||
|
|
||||||
|
|
||||||
conn_status_req.apnProfile.pdnType =
|
|
||||||
eQMI_LOC_APN_PROFILE_PDN_TYPE_IPV4_V02;
|
|
||||||
|
|
||||||
conn_status_req.apnProfile_valid = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
conn_status_req.statusType = eQMI_LOC_SERVER_REQ_STATUS_FAILURE_V02;
|
|
||||||
}
|
|
||||||
|
|
||||||
req_union.pInformLocationServerConnStatusReq = &conn_status_req;
|
|
||||||
|
|
||||||
result = loc_sync_send_req(clientHandle,
|
|
||||||
QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02,
|
|
||||||
req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
|
|
||||||
QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_IND_V02,
|
|
||||||
&conn_status_ind);
|
|
||||||
|
|
||||||
if(result != eLOC_CLIENT_SUCCESS ||
|
|
||||||
eQMI_LOC_SUCCESS_V02 != conn_status_ind.status)
|
|
||||||
{
|
|
||||||
LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
|
|
||||||
__func__, __LINE__,
|
|
||||||
loc_get_v02_client_status_name(result),
|
|
||||||
loc_get_v02_qmi_status_name(conn_status_ind.status));
|
|
||||||
|
|
||||||
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* close atl connection */
|
/* close atl connection */
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: atlCloseStatus(
|
enum loc_api_adapter_err LocApiV02Adapter :: atlCloseStatus(
|
||||||
int handle, int is_succ)
|
int handle, int is_succ)
|
||||||
|
@ -1239,6 +1171,67 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSUPLVersion(uint32_t version)
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the configuration for LTE positioning profile (LPP) */
|
||||||
|
enum loc_api_adapter_err LocApiV02Adapter :: setLPPConfig(uint32_t profile)
|
||||||
|
{
|
||||||
|
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||||
|
locClientReqUnionType req_union;
|
||||||
|
qmiLocSetProtocolConfigParametersReqMsgT_v02 lpp_config_req;
|
||||||
|
qmiLocSetProtocolConfigParametersIndMsgT_v02 lpp_config_ind;
|
||||||
|
|
||||||
|
LOC_LOGD("%s:%d]: lpp profile = %d\n", __func__, __LINE__, profile);
|
||||||
|
|
||||||
|
memset(&lpp_config_req, 0, sizeof(lpp_config_req));
|
||||||
|
memset(&lpp_config_ind, 0, sizeof(lpp_config_ind));
|
||||||
|
|
||||||
|
lpp_config_req.lppConfig_valid = 1;
|
||||||
|
// Default RRLP or User or Control plane configuration
|
||||||
|
switch(profile)
|
||||||
|
{
|
||||||
|
/* RRLP */
|
||||||
|
case 0:
|
||||||
|
lpp_config_req.lppConfig = profile;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* User plane */
|
||||||
|
case 1:
|
||||||
|
lpp_config_req.lppConfig = QMI_LOC_LPP_CONFIG_ENABLE_USER_PLANE_V02;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
lpp_config_req.lppConfig = QMI_LOC_LPP_CONFIG_ENABLE_CONTROL_PLANE_V02;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
LOC_LOGE("%s:%d]: Invalid LPP Profile Config Setting Provided in gps.conf = %d!",
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
profile);
|
||||||
|
return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
req_union.pSetProtocolConfigParametersReq = &lpp_config_req;
|
||||||
|
|
||||||
|
result = loc_sync_send_req(clientHandle,
|
||||||
|
QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02,
|
||||||
|
req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
|
||||||
|
QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_IND_V02,
|
||||||
|
&lpp_config_ind);
|
||||||
|
|
||||||
|
if(result != eLOC_CLIENT_SUCCESS ||
|
||||||
|
eQMI_LOC_SUCCESS_V02 != lpp_config_ind.status)
|
||||||
|
{
|
||||||
|
LOC_LOGE ("%s:%d]: Error status = %s, ind..status = %s ",
|
||||||
|
__func__, __LINE__,
|
||||||
|
loc_get_v02_client_status_name(result),
|
||||||
|
loc_get_v02_qmi_status_name(lpp_config_ind.status));
|
||||||
|
|
||||||
|
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
|
||||||
|
}
|
||||||
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* set the Sensor Configuration */
|
/* set the Sensor Configuration */
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: setSensorControlConfig(int sensorsDisabled)
|
enum loc_api_adapter_err LocApiV02Adapter :: setSensorControlConfig(int sensorsDisabled)
|
||||||
{
|
{
|
||||||
|
@ -1280,7 +1273,11 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorControlConfig(int sensorsD
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the Sensor Properties */
|
/* set the Sensor Properties */
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(float gyroBiasVarianceRandomWalk)
|
enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
|
||||||
|
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
|
||||||
|
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
|
||||||
|
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
|
||||||
|
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk)
|
||||||
{
|
{
|
||||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||||
locClientReqUnionType req_union;
|
locClientReqUnionType req_union;
|
||||||
|
@ -1288,15 +1285,30 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(float gyroBiasV
|
||||||
qmiLocSetSensorPropertiesReqMsgT_v02 sensor_prop_req;
|
qmiLocSetSensorPropertiesReqMsgT_v02 sensor_prop_req;
|
||||||
qmiLocSetSensorPropertiesIndMsgT_v02 sensor_prop_ind;
|
qmiLocSetSensorPropertiesIndMsgT_v02 sensor_prop_ind;
|
||||||
|
|
||||||
LOC_LOGI("%s:%d]: sensors prop gyroBiasRandomWalk = %f\n",
|
LOC_LOGI("%s:%d]: sensors prop: gyroBiasRandomWalk = %f, accelRandomWalk = %f, "
|
||||||
__func__, __LINE__, gyroBiasVarianceRandomWalk);
|
"angleRandomWalk = %f, rateRandomWalk = %f, velocityRandomWalk = %f\n",
|
||||||
|
__func__, __LINE__, gyroBiasVarianceRandomWalk, accelBiasVarianceRandomWalk,
|
||||||
|
angleBiasVarianceRandomWalk, rateBiasVarianceRandomWalk, velocityBiasVarianceRandomWalk);
|
||||||
|
|
||||||
memset(&sensor_prop_req, 0, sizeof(sensor_prop_req));
|
memset(&sensor_prop_req, 0, sizeof(sensor_prop_req));
|
||||||
memset(&sensor_prop_ind, 0, sizeof(sensor_prop_ind));
|
memset(&sensor_prop_ind, 0, sizeof(sensor_prop_ind));
|
||||||
|
|
||||||
sensor_prop_req.gyroBiasVarianceRandomWalk_valid = 1;
|
/* Set the validity bit and value for each sensor property */
|
||||||
|
sensor_prop_req.gyroBiasVarianceRandomWalk_valid = gyroBiasVarianceRandomWalk_valid;
|
||||||
sensor_prop_req.gyroBiasVarianceRandomWalk = gyroBiasVarianceRandomWalk;
|
sensor_prop_req.gyroBiasVarianceRandomWalk = gyroBiasVarianceRandomWalk;
|
||||||
|
|
||||||
|
sensor_prop_req.accelerationRandomWalkSpectralDensity_valid = accelBiasVarianceRandomWalk_valid;
|
||||||
|
sensor_prop_req.accelerationRandomWalkSpectralDensity = accelBiasVarianceRandomWalk;
|
||||||
|
|
||||||
|
sensor_prop_req.angleRandomWalkSpectralDensity_valid = angleBiasVarianceRandomWalk_valid;
|
||||||
|
sensor_prop_req.angleRandomWalkSpectralDensity = angleBiasVarianceRandomWalk;
|
||||||
|
|
||||||
|
sensor_prop_req.rateRandomWalkSpectralDensity_valid = rateBiasVarianceRandomWalk_valid;
|
||||||
|
sensor_prop_req.rateRandomWalkSpectralDensity = rateBiasVarianceRandomWalk;
|
||||||
|
|
||||||
|
sensor_prop_req.velocityRandomWalkSpectralDensity_valid = velocityBiasVarianceRandomWalk_valid;
|
||||||
|
sensor_prop_req.velocityRandomWalkSpectralDensity = velocityBiasVarianceRandomWalk;
|
||||||
|
|
||||||
req_union.pSetSensorPropertiesReq = &sensor_prop_req;
|
req_union.pSetSensorPropertiesReq = &sensor_prop_req;
|
||||||
|
|
||||||
result = loc_sync_send_req(clientHandle,
|
result = loc_sync_send_req(clientHandle,
|
||||||
|
@ -1322,7 +1334,8 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(float gyroBiasV
|
||||||
/* set the Sensor Performance Config */
|
/* set the Sensor Performance Config */
|
||||||
enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int controlMode,
|
enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int controlMode,
|
||||||
int accelSamplesPerBatch, int accelBatchesPerSec,
|
int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||||
int gyroSamplesPerBatch, int gyroBatchesPerSec)
|
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||||
|
int algorithmConfig)
|
||||||
{
|
{
|
||||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||||
locClientReqUnionType req_union;
|
locClientReqUnionType req_union;
|
||||||
|
@ -1331,14 +1344,16 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
||||||
qmiLocSetSensorPerformanceControlConfigIndMsgT_v02 sensor_perf_config_ind;
|
qmiLocSetSensorPerformanceControlConfigIndMsgT_v02 sensor_perf_config_ind;
|
||||||
|
|
||||||
LOC_LOGD("%s:%d]: Sensor Perf Control Config (performanceControlMode)(%u) "
|
LOC_LOGD("%s:%d]: Sensor Perf Control Config (performanceControlMode)(%u) "
|
||||||
"accel(#smp,#batches) (%u,%u) gyro(#smp,#batches) (%u,%u)\n",
|
"accel(#smp,#batches) (%u,%u) gyro(#smp,#batches) (%u,%u) "
|
||||||
|
"algorithmConfig(%u)\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
__LINE__,
|
__LINE__,
|
||||||
controlMode,
|
controlMode,
|
||||||
accelSamplesPerBatch,
|
accelSamplesPerBatch,
|
||||||
accelBatchesPerSec,
|
accelBatchesPerSec,
|
||||||
gyroSamplesPerBatch,
|
gyroSamplesPerBatch,
|
||||||
gyroBatchesPerSec
|
gyroBatchesPerSec,
|
||||||
|
algorithmConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
memset(&sensor_perf_config_req, 0, sizeof(sensor_perf_config_req));
|
memset(&sensor_perf_config_req, 0, sizeof(sensor_perf_config_req));
|
||||||
|
@ -1352,6 +1367,8 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
||||||
sensor_perf_config_req.gyroSamplingSpec_valid = 1;
|
sensor_perf_config_req.gyroSamplingSpec_valid = 1;
|
||||||
sensor_perf_config_req.gyroSamplingSpec.batchesPerSecond = gyroBatchesPerSec;
|
sensor_perf_config_req.gyroSamplingSpec.batchesPerSecond = gyroBatchesPerSec;
|
||||||
sensor_perf_config_req.gyroSamplingSpec.samplesPerBatch = gyroSamplesPerBatch;
|
sensor_perf_config_req.gyroSamplingSpec.samplesPerBatch = gyroSamplesPerBatch;
|
||||||
|
sensor_perf_config_req.algorithmConfig_valid = 1;
|
||||||
|
sensor_perf_config_req.algorithmConfig = algorithmConfig;
|
||||||
|
|
||||||
req_union.pSetSensorPerformanceControlConfigReq = &sensor_perf_config_req;
|
req_union.pSetSensorPerformanceControlConfigReq = &sensor_perf_config_req;
|
||||||
|
|
||||||
|
@ -1375,6 +1392,65 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
||||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the External Power Config */
|
||||||
|
enum loc_api_adapter_err LocApiV02Adapter :: setExtPowerConfig(int isBatteryCharging)
|
||||||
|
{
|
||||||
|
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||||
|
locClientReqUnionType req_union;
|
||||||
|
|
||||||
|
qmiLocSetExternalPowerConfigReqMsgT_v02 ext_pwr_req;
|
||||||
|
qmiLocGetExternalPowerConfigIndMsgT_v02 ext_pwr_ind;
|
||||||
|
|
||||||
|
LOC_LOGI("%s:%d]: Ext Pwr Config (isBatteryCharging)(%u)",
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
isBatteryCharging
|
||||||
|
);
|
||||||
|
|
||||||
|
memset(&ext_pwr_req, 0, sizeof(ext_pwr_req));
|
||||||
|
memset(&ext_pwr_ind, 0, sizeof(ext_pwr_ind));
|
||||||
|
|
||||||
|
switch(isBatteryCharging)
|
||||||
|
{
|
||||||
|
/* Charging */
|
||||||
|
case 1:
|
||||||
|
ext_pwr_req.externalPowerState = eQMI_LOC_EXTERNAL_POWER_CONNECTED_V02;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Not charging */
|
||||||
|
case 0:
|
||||||
|
ext_pwr_req.externalPowerState = eQMI_LOC_EXTERNAL_POWER_NOT_CONNECTED_V02;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
LOC_LOGE("%s:%d]: Invalid ext power state = %d!",
|
||||||
|
__FUNCTION__,
|
||||||
|
__LINE__,
|
||||||
|
isBatteryCharging);
|
||||||
|
return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
req_union.pSetExternalPowerConfigReq = &ext_pwr_req;
|
||||||
|
|
||||||
|
result = loc_sync_send_req(clientHandle,
|
||||||
|
QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02,
|
||||||
|
req_union, LOC_ENGINE_SYNC_REQUEST_TIMEOUT,
|
||||||
|
QMI_LOC_SET_EXTERNAL_POWER_CONFIG_IND_V02,
|
||||||
|
&ext_pwr_ind);
|
||||||
|
|
||||||
|
if(result != eLOC_CLIENT_SUCCESS ||
|
||||||
|
eQMI_LOC_SUCCESS_V02 != ext_pwr_ind.status)
|
||||||
|
{
|
||||||
|
LOC_LOGE ("%s:%d]: Error status = %d, ind..status = %d ",
|
||||||
|
__func__, __LINE__, result, ext_pwr_ind.status);
|
||||||
|
|
||||||
|
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert event mask from loc eng to loc_api_v02 format */
|
/* Convert event mask from loc eng to loc_api_v02 format */
|
||||||
locClientEventMaskType LocApiV02Adapter :: convertMask(
|
locClientEventMaskType LocApiV02Adapter :: convertMask(
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T mask)
|
LOC_API_ADAPTER_EVENT_MASK_T mask)
|
||||||
|
@ -1461,7 +1537,7 @@ void LocApiV02Adapter :: reportPosition (
|
||||||
const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr)
|
const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr)
|
||||||
{
|
{
|
||||||
GpsLocation location;
|
GpsLocation location;
|
||||||
|
LOC_LOGD("Reporting postion from V2 Adapter\n");
|
||||||
memset(&location, 0, sizeof (GpsLocation));
|
memset(&location, 0, sizeof (GpsLocation));
|
||||||
location.size = sizeof(location);
|
location.size = sizeof(location);
|
||||||
// Process the position from final and intermediate reports
|
// Process the position from final and intermediate reports
|
||||||
|
@ -1518,7 +1594,9 @@ void LocApiV02Adapter :: reportPosition (
|
||||||
location.flags |= GPS_LOCATION_HAS_ACCURACY;
|
location.flags |= GPS_LOCATION_HAS_ACCURACY;
|
||||||
location.accuracy = location_report_ptr->horUncCircular;
|
location.accuracy = location_report_ptr->horUncCircular;
|
||||||
}
|
}
|
||||||
|
//Mark the location source as from GNSS
|
||||||
|
location.flags |= LOCATION_HAS_SOURCE_INFO;
|
||||||
|
location.position_source = ULP_LOCATION_IS_FROM_GNSS;
|
||||||
LocApiAdapter::reportPosition( location,
|
LocApiAdapter::reportPosition( location,
|
||||||
locEngHandle.extPosInfo((void*)location_report_ptr),
|
locEngHandle.extPosInfo((void*)location_report_ptr),
|
||||||
(location_report_ptr->sessionStatus
|
(location_report_ptr->sessionStatus
|
||||||
|
@ -1639,7 +1717,7 @@ void LocApiV02Adapter :: reportSv (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SvStatus.num_svs != 0)
|
if (SvStatus.num_svs >= 0)
|
||||||
{
|
{
|
||||||
LOC_LOGV ("%s:%d]: firing SV callback\n", __func__, __LINE__);
|
LOC_LOGV ("%s:%d]: firing SV callback\n", __func__, __LINE__);
|
||||||
LocApiAdapter::reportSv(SvStatus,
|
LocApiAdapter::reportSv(SvStatus,
|
||||||
|
@ -1713,8 +1791,7 @@ void LocApiV02Adapter :: reportAtlRequest(
|
||||||
// service ATL open request; copy the WWAN type
|
// service ATL open request; copy the WWAN type
|
||||||
if(server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_OPEN_V02 )
|
if(server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_OPEN_V02 )
|
||||||
{
|
{
|
||||||
AGpsType agpsType;
|
AGpsType agpsType = AGPS_TYPE_WWAN_ANY;
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
switch(server_request_ptr->wwanType)
|
switch(server_request_ptr->wwanType)
|
||||||
{
|
{
|
||||||
case eQMI_LOC_WWAN_TYPE_INTERNET_V02:
|
case eQMI_LOC_WWAN_TYPE_INTERNET_V02:
|
||||||
|
@ -1729,9 +1806,6 @@ void LocApiV02Adapter :: reportAtlRequest(
|
||||||
agpsType = AGPS_TYPE_WWAN_ANY;
|
agpsType = AGPS_TYPE_WWAN_ANY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
agpsType = AGPS_TYPE_SUPL;
|
|
||||||
#endif
|
|
||||||
LocApiAdapter::requestATL(connHandle, agpsType);
|
LocApiAdapter::requestATL(connHandle, agpsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
loc_api/loc_api_v02/LocApiV02Adapter.h
Executable file → Normal file
53
loc_api/loc_api_v02/LocApiV02Adapter.h
Executable file → Normal file
|
@ -34,25 +34,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
/* Fix criteria structure*/
|
|
||||||
struct LocApiV02FixCriteria
|
|
||||||
{
|
|
||||||
LocPositionMode mode;
|
|
||||||
GpsPositionRecurrence recurrence;
|
|
||||||
uint32_t min_interval ;
|
|
||||||
uint32_t preferred_accuracy ;
|
|
||||||
uint32_t preferred_time;
|
|
||||||
|
|
||||||
/* Constructor for the structure */
|
|
||||||
inline LocApiV02FixCriteria (LocPositionMode mode,
|
|
||||||
GpsPositionRecurrence recur,
|
|
||||||
uint32_t min_int,
|
|
||||||
uint32_t pref_acc,
|
|
||||||
uint32_t pref_time) :
|
|
||||||
mode(mode), recurrence(recur), min_interval(min_int),
|
|
||||||
preferred_accuracy(pref_acc), preferred_time(pref_time) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* This class derives from the LocApiAdapter class.
|
/* This class derives from the LocApiAdapter class.
|
||||||
The members of this class are responsible for converting
|
The members of this class are responsible for converting
|
||||||
the Loc API V02 data structures into Loc Engine data structures.
|
the Loc API V02 data structures into Loc Engine data structures.
|
||||||
|
@ -66,15 +47,6 @@ class LocApiV02Adapter : public LocApiAdapter {
|
||||||
/* events the client is registered for */
|
/* events the client is registered for */
|
||||||
locClientEventMaskType eventMask;
|
locClientEventMaskType eventMask;
|
||||||
|
|
||||||
/* current session state */
|
|
||||||
bool navigating;
|
|
||||||
|
|
||||||
/* current fix criteria, for Loc aPI V02 this is
|
|
||||||
stored when set_position_mode is called and
|
|
||||||
sent out with Loc aPI V02 start message when the
|
|
||||||
start_fix() is called by loc engine. */
|
|
||||||
LocApiV02FixCriteria fixCriteria;
|
|
||||||
|
|
||||||
/* Convert event mask from loc eng to loc_api_v02 format */
|
/* Convert event mask from loc eng to loc_api_v02 format */
|
||||||
locClientEventMaskType convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
locClientEventMaskType convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
||||||
|
|
||||||
|
@ -145,9 +117,7 @@ public:
|
||||||
virtual enum loc_api_adapter_err stopFix();
|
virtual enum loc_api_adapter_err stopFix();
|
||||||
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
setPositionMode(const LocPosMode *mode);
|
||||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
|
||||||
uint32_t preferred_time);
|
|
||||||
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||||
|
@ -168,30 +138,27 @@ public:
|
||||||
setServer(unsigned int ip, int port, LocServerType type);
|
setServer(unsigned int ip, int port, LocServerType type);
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setXtraData(char* data, int length);
|
setXtraData(char* data, int length);
|
||||||
#ifdef QCOM_FEATURE_IPV6
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear,
|
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear,
|
||||||
AGpsType agpsType);
|
AGpsType agpsType);
|
||||||
#else
|
|
||||||
virtual enum loc_api_adapter_err
|
|
||||||
atlOpenStatus(int handle, int is_succ, char* apn,
|
|
||||||
AGpsType agpsType);
|
|
||||||
#endif
|
|
||||||
virtual enum loc_api_adapter_err atlCloseStatus(int handle, int is_succ);
|
virtual enum loc_api_adapter_err atlCloseStatus(int handle, int is_succ);
|
||||||
virtual enum loc_api_adapter_err setSUPLVersion(uint32_t version);
|
virtual enum loc_api_adapter_err setSUPLVersion(uint32_t version);
|
||||||
|
virtual enum loc_api_adapter_err setLPPConfig(uint32_t profile);
|
||||||
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setSensorControlConfig(int sensorUsage);
|
setSensorControlConfig(int sensorUsage);
|
||||||
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setSensorProperties(float gyroBiasVarianceRandomWalk);
|
setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
|
||||||
|
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
|
||||||
|
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
|
||||||
|
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
|
||||||
|
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
|
||||||
|
|
||||||
virtual enum loc_api_adapter_err
|
virtual enum loc_api_adapter_err
|
||||||
setSensorPerfControlConfig(int controlMode,
|
setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||||
int accelSamplesPerBatch,
|
int gyroSamplesPerBatch, int gyroBatchesPerSec, int algorithmConfig);
|
||||||
int accelBatchesPerSec,
|
virtual enum loc_api_adapter_err setExtPowerConfig(int isBatteryCharging);
|
||||||
int gyroSamplesPerBatch,
|
|
||||||
int gyroBatchesPerSec);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //LOC_API_V_0_2_ADAPTER_H
|
#endif //LOC_API_V_0_2_ADAPTER_H
|
||||||
|
|
8
loc_api/loc_api_v02/loc_api_sync_req.c
Executable file → Normal file
8
loc_api/loc_api_v02/loc_api_sync_req.c
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -36,7 +35,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "loc_api_v02_client.h"
|
#include "loc_api_v02_client.h"
|
||||||
#include "loc_api_v02_log.h"
|
|
||||||
#include "loc_api_sync_req.h"
|
#include "loc_api_sync_req.h"
|
||||||
|
|
||||||
/* Logging */
|
/* Logging */
|
||||||
|
@ -162,7 +160,7 @@ void loc_sync_process_ind(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: received indication, handle = %d ind_id = %d \n",
|
LOC_LOGV("%s:%d]: received indication, handle = %p ind_id = %u \n",
|
||||||
__func__,__LINE__, client_handle, ind_id);
|
__func__,__LINE__, client_handle, ind_id);
|
||||||
|
|
||||||
pthread_mutex_lock(&loc_sync_call_mutex);
|
pthread_mutex_lock(&loc_sync_call_mutex);
|
||||||
|
@ -353,7 +351,7 @@ static int loc_sync_select_ind(
|
||||||
{
|
{
|
||||||
int select_id = loc_alloc_slot();
|
int select_id = loc_alloc_slot();
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: client handle %d, ind_id %u, req_id %u \n",
|
LOC_LOGV("%s:%d]: client handle %p, ind_id %u, req_id %u \n",
|
||||||
__func__, __LINE__, client_handle, ind_id, req_id);
|
__func__, __LINE__, client_handle, ind_id, req_id);
|
||||||
|
|
||||||
if (select_id < 0)
|
if (select_id < 0)
|
||||||
|
|
0
loc_api/loc_api_v02/loc_api_sync_req.h
Executable file → Normal file
0
loc_api/loc_api_v02/loc_api_sync_req.h
Executable file → Normal file
333
loc_api/loc_api_v02/loc_api_v02_client.c
Executable file → Normal file
333
loc_api/loc_api_v02/loc_api_v02_client.c
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include "qmi_client.h"
|
#include "qmi_client.h"
|
||||||
#include "qmi_idl_lib.h"
|
#include "qmi_idl_lib.h"
|
||||||
#include "qmi_cci_target_ext.h"
|
#include "qmi_cci_target_ext.h"
|
||||||
|
@ -33,23 +34,15 @@
|
||||||
#if defined( _ANDROID_)
|
#if defined( _ANDROID_)
|
||||||
#include "qmi_cci_target.h"
|
#include "qmi_cci_target.h"
|
||||||
#include "qmi_cci_common.h"
|
#include "qmi_cci_common.h"
|
||||||
#elif defined(LOC_UTIL_TARGET_OFF_TARGET)
|
#define LOG_NDEBUG 0
|
||||||
#include <stdlib.h>
|
#define LOG_TAG "LocSvc_api_v02"
|
||||||
#include <sys/time.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#endif //_ANDROID_
|
#endif //_ANDROID_
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "loc_api_v02_client.h"
|
#include "loc_api_v02_client.h"
|
||||||
#include "loc_api_v02_log.h"
|
|
||||||
|
|
||||||
#define LOG_NDEBUG 0
|
|
||||||
#define LOG_TAG "LocSvc_api_v02"
|
|
||||||
|
|
||||||
#include "loc_util_log.h"
|
#include "loc_util_log.h"
|
||||||
|
|
||||||
#ifdef LOC_UTIL_TARGET_OFF_TARGET
|
#ifdef LOC_UTIL_TARGET_OFF_TARGET
|
||||||
|
@ -71,7 +64,8 @@
|
||||||
#endif //LOC_UTIL_TARGET_OFF_TARGET
|
#endif //LOC_UTIL_TARGET_OFF_TARGET
|
||||||
|
|
||||||
//timeout in ms to wait for the service to come up
|
//timeout in ms to wait for the service to come up
|
||||||
#define LOC_CLIENT_SERVICE_TIMEOUT (20000)
|
#define LOC_CLIENT_SERVICE_TIMEOUT_UNIT (4000)
|
||||||
|
#define LOC_CLIENT_SERVICE_TIMEOUT_TOTAL (40000)
|
||||||
|
|
||||||
/* Table to relate eventId, size and mask value used to enable the event*/
|
/* Table to relate eventId, size and mask value used to enable the event*/
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -152,7 +146,22 @@ static locClientEventIndTableStructT locClientEventIndTable[]= {
|
||||||
//Location Server Connection Request event
|
//Location Server Connection Request event
|
||||||
{ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02,
|
{ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02,
|
||||||
sizeof(qmiLocEventLocationServerConnectionReqIndMsgT_v02),
|
sizeof(qmiLocEventLocationServerConnectionReqIndMsgT_v02),
|
||||||
QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ_V02 }
|
QMI_LOC_EVENT_MASK_LOCATION_SERVER_CONNECTION_REQ_V02 },
|
||||||
|
|
||||||
|
// NI Geofence Event
|
||||||
|
{ QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02,
|
||||||
|
sizeof(qmiLocEventNiGeofenceNotificationIndMsgT_v02),
|
||||||
|
QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION_V02},
|
||||||
|
|
||||||
|
// Geofence General Alert Event
|
||||||
|
{ QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02,
|
||||||
|
sizeof(qmiLocEventGeofenceGenAlertIndMsgT_v02),
|
||||||
|
QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT_V02},
|
||||||
|
|
||||||
|
//Geofence Breach event
|
||||||
|
{ QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02,
|
||||||
|
sizeof(qmiLocEventGeofenceBreachIndMsgT_v02),
|
||||||
|
QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* table to relate the respInd Id with its size */
|
/* table to relate the respInd Id with its size */
|
||||||
|
@ -345,8 +354,27 @@ static locClientRespIndTableStructT locClientRespIndTable[]= {
|
||||||
|
|
||||||
// Get Position Engine Config
|
// Get Position Engine Config
|
||||||
{ QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02,
|
{ QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02,
|
||||||
sizeof(qmiLocGetPositionEngineConfigParametersIndMsgT_v02)}
|
sizeof(qmiLocGetPositionEngineConfigParametersIndMsgT_v02)},
|
||||||
|
|
||||||
|
//Add a Circular Geofence
|
||||||
|
{ QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02,
|
||||||
|
sizeof(qmiLocAddCircularGeofenceIndMsgT_v02)},
|
||||||
|
|
||||||
|
//Delete a Geofence
|
||||||
|
{ QMI_LOC_DELETE_GEOFENCE_IND_V02,
|
||||||
|
sizeof(qmiLocDeleteGeofenceIndMsgT_v02)} ,
|
||||||
|
|
||||||
|
//Query a Geofence
|
||||||
|
{ QMI_LOC_QUERY_GEOFENCE_IND_V02,
|
||||||
|
sizeof(qmiLocQueryGeofenceIndMsgT_v02)},
|
||||||
|
|
||||||
|
//Edit a Geofence
|
||||||
|
{ QMI_LOC_EDIT_GEOFENCE_IND_V02,
|
||||||
|
sizeof(qmiLocEditGeofenceIndMsgT_v02)},
|
||||||
|
|
||||||
|
//Get best available position
|
||||||
|
{ QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02,
|
||||||
|
sizeof(qmiLocGetBestAvailablePositionIndMsgT_v02)}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -467,7 +495,7 @@ static locClientStatusEnumType convertQmiResponseToLocStatus(
|
||||||
locClientStatusEnumType status = eLOC_CLIENT_FAILURE_INTERNAL;
|
locClientStatusEnumType status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
|
||||||
// if result == SUCCESS don't look at error code
|
// if result == SUCCESS don't look at error code
|
||||||
if(pResponse->resp.result == QMI_RESULT_SUCCESS )
|
if(pResponse->resp.result == QMI_RESULT_SUCCESS_V01 )
|
||||||
{
|
{
|
||||||
status = eLOC_CLIENT_SUCCESS;
|
status = eLOC_CLIENT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -476,6 +504,7 @@ static locClientStatusEnumType convertQmiResponseToLocStatus(
|
||||||
switch(pResponse->resp.error)
|
switch(pResponse->resp.error)
|
||||||
{
|
{
|
||||||
case QMI_ERR_MALFORMED_MSG_V01:
|
case QMI_ERR_MALFORMED_MSG_V01:
|
||||||
|
case QMI_ERR_INVALID_ARG_V01:
|
||||||
status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
|
status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -749,6 +778,27 @@ static bool locClientHandleIndication(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02:
|
||||||
|
{
|
||||||
|
//locClientHandleNiGeofenceNotificationInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02:
|
||||||
|
{
|
||||||
|
//locClientHandleGeofenceGenAlertInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02:
|
||||||
|
{
|
||||||
|
//locClientHandleGeofenceBreachInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
// handle the response indications
|
// handle the response indications
|
||||||
|
@ -761,6 +811,13 @@ static bool locClientHandleIndication(
|
||||||
indBuffer, indSize);
|
indBuffer, indSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_GET_FIX_CRITERIA_IND_V02:
|
||||||
|
{
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// predicted orbits data response indication
|
// predicted orbits data response indication
|
||||||
case QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02:
|
case QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02:
|
||||||
{
|
{
|
||||||
|
@ -847,6 +904,50 @@ static bool locClientHandleIndication(
|
||||||
status = true;
|
status = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02:
|
||||||
|
{
|
||||||
|
// locClientHandleAddCircularGeofenceInd(
|
||||||
|
// user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_DELETE_GEOFENCE_IND_V02:
|
||||||
|
{
|
||||||
|
// locClientHandleDeleteGeofenceInd(
|
||||||
|
// user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_EDIT_GEOFENCE_IND_V02:
|
||||||
|
{
|
||||||
|
// locClientHandleEditGeofenceInd(
|
||||||
|
// user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_QUERY_GEOFENCE_IND_V02:
|
||||||
|
{
|
||||||
|
// locClientHandleQueryGeofenceInd(
|
||||||
|
// user_handle, msg_id, ind_buf, ind_buf_len);
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02:
|
||||||
|
{
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QMI_LOC_GET_ENGINE_LOCK_IND_V02:
|
||||||
|
{
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// for indications that only have a "status" field
|
// for indications that only have a "status" field
|
||||||
case QMI_LOC_NI_USER_RESPONSE_IND_V02:
|
case QMI_LOC_NI_USER_RESPONSE_IND_V02:
|
||||||
case QMI_LOC_INJECT_UTC_TIME_IND_V02:
|
case QMI_LOC_INJECT_UTC_TIME_IND_V02:
|
||||||
|
@ -971,7 +1072,7 @@ static void locClientIndCb
|
||||||
// check user handle
|
// check user handle
|
||||||
if(memcmp(&pCallbackData->userHandle, &user_handle, sizeof(user_handle)))
|
if(memcmp(&pCallbackData->userHandle, &user_handle, sizeof(user_handle)))
|
||||||
{
|
{
|
||||||
LOC_LOGE("%s:%d]: invalid user_handle got 0x%x expected 0x%x\n",
|
LOC_LOGE("%s:%d]: invalid user_handle got %p expected %p\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
user_handle, pCallbackData->userHandle);
|
user_handle, pCallbackData->userHandle);
|
||||||
return;
|
return;
|
||||||
|
@ -1315,6 +1416,12 @@ static bool validateRequest(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocGetSensorPropertiesReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02:
|
case QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02:
|
||||||
{
|
{
|
||||||
*pOutLen = sizeof(qmiLocSetSensorPropertiesReqMsgT_v02);
|
*pOutLen = sizeof(qmiLocSetSensorPropertiesReqMsgT_v02);
|
||||||
|
@ -1347,6 +1454,31 @@ static bool validateRequest(
|
||||||
*pOutLen = sizeof(qmiLocGetPositionEngineConfigParametersReqMsgT_v02);
|
*pOutLen = sizeof(qmiLocGetPositionEngineConfigParametersReqMsgT_v02);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocAddCircularGeofenceReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QMI_LOC_DELETE_GEOFENCE_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocDeleteGeofenceReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QMI_LOC_QUERY_GEOFENCE_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocQueryGeofenceReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QMI_LOC_EDIT_GEOFENCE_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocEditGeofenceReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02:
|
||||||
|
{
|
||||||
|
*pOutLen = sizeof(qmiLocGetBestAvailablePositionReqMsgT_v02);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// ALL requests with no payload
|
// ALL requests with no payload
|
||||||
case QMI_LOC_GET_SERVICE_REVISION_REQ_V02:
|
case QMI_LOC_GET_SERVICE_REVISION_REQ_V02:
|
||||||
|
@ -1364,7 +1496,6 @@ static bool validateRequest(
|
||||||
case QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02:
|
case QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02:
|
||||||
case QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02:
|
case QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02:
|
||||||
case QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02:
|
case QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02:
|
||||||
case QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02:
|
|
||||||
case QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02:
|
case QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02:
|
||||||
{
|
{
|
||||||
noPayloadFlag = true;
|
noPayloadFlag = true;
|
||||||
|
@ -1401,14 +1532,17 @@ static bool validateRequest(
|
||||||
static locClientStatusEnumType locClientQmiCtrlPointInit(
|
static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
locClientCallbackDataType *pLocClientCbData)
|
locClientCallbackDataType *pLocClientCbData)
|
||||||
{
|
{
|
||||||
uint32_t num_services, num_entries = 10;
|
|
||||||
qmi_client_type clnt, notifier;
|
qmi_client_type clnt, notifier;
|
||||||
qmi_client_os_params os_params;
|
bool notifierInitFlag = false;
|
||||||
|
locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
|
||||||
// num instances of this service
|
// instances of this service
|
||||||
qmi_service_info serviceInfo[5];
|
qmi_service_info *pServiceInfo = NULL;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uint32_t num_services = 0, num_entries = 0;
|
||||||
qmi_client_error_type rc = QMI_NO_ERR;
|
qmi_client_error_type rc = QMI_NO_ERR;
|
||||||
|
bool nosignal = false;
|
||||||
|
|
||||||
// Get the service object for the qmiLoc Service
|
// Get the service object for the qmiLoc Service
|
||||||
qmi_idl_service_object_type locClientServiceObject =
|
qmi_idl_service_object_type locClientServiceObject =
|
||||||
|
@ -1419,56 +1553,84 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
{
|
{
|
||||||
LOC_LOGE("%s:%d]: qmiLoc_get_service_object_v02 failed\n" ,
|
LOC_LOGE("%s:%d]: qmiLoc_get_service_object_v02 failed\n" ,
|
||||||
__func__, __LINE__ );
|
__func__, __LINE__ );
|
||||||
return(eLOC_CLIENT_FAILURE_INTERNAL);
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// register for service notification
|
|
||||||
rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
|
|
||||||
|
|
||||||
if(rc != QMI_NO_ERR)
|
|
||||||
{
|
|
||||||
LOC_LOGE("%s:%d]: qmi_client_notifier_init failed\n",
|
|
||||||
__func__, __LINE__ );
|
|
||||||
return(eLOC_CLIENT_FAILURE_INTERNAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If service is not up wait on a signal until the service is up
|
|
||||||
* or a timeout occurs. */
|
|
||||||
|
|
||||||
QMI_CCI_OS_SIGNAL_WAIT(&os_params, LOC_CLIENT_SERVICE_TIMEOUT);
|
|
||||||
|
|
||||||
if(QMI_CCI_OS_SIGNAL_TIMED_OUT(&os_params))
|
|
||||||
{
|
|
||||||
// timed out, return with error
|
|
||||||
LOC_LOGE("%s:%d]: timed out waiting for service\n",
|
|
||||||
__func__, __LINE__);
|
|
||||||
|
|
||||||
return(eLOC_CLIENT_FAILURE_TIMEOUT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// get the service addressing information
|
// get the service addressing information
|
||||||
rc = qmi_client_get_service_list( locClientServiceObject, NULL, NULL,
|
rc = qmi_client_get_service_list( locClientServiceObject, NULL, NULL,
|
||||||
&num_services);
|
&num_services);
|
||||||
LOC_LOGV("%s:%d]: qmi_client_get_service_list() returned %d "
|
LOC_LOGV("%s:%d]: qmi_client_get_service_list() first try rc %d, "
|
||||||
"num_services = %d\n", __func__, __LINE__, rc,
|
"num_services %d", __func__, __LINE__, rc, num_services);
|
||||||
num_services);
|
|
||||||
|
|
||||||
if(rc != QMI_NO_ERR)
|
if (rc != QMI_NO_ERR) {
|
||||||
{
|
// bummer, service list is not up.
|
||||||
|
// We need to try again after a timed wait
|
||||||
|
qmi_client_os_params os_params;
|
||||||
|
int timeout = 0;
|
||||||
|
|
||||||
|
// register for service notification
|
||||||
|
rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
|
||||||
|
notifierInitFlag = (NULL != notifier);
|
||||||
|
|
||||||
|
if (rc != QMI_NO_ERR) {
|
||||||
|
LOC_LOGE("%s:%d]: qmi_client_notifier_init failed %d\n",
|
||||||
|
__func__, __LINE__, rc);
|
||||||
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
QMI_CCI_OS_SIGNAL_CLEAR(&os_params);
|
||||||
|
/* If service is not up wait on a signal until the service is up
|
||||||
|
* or a timeout occurs. */
|
||||||
|
QMI_CCI_OS_SIGNAL_WAIT(&os_params, LOC_CLIENT_SERVICE_TIMEOUT_UNIT);
|
||||||
|
nosignal = QMI_CCI_OS_SIGNAL_TIMED_OUT(&os_params);
|
||||||
|
|
||||||
|
// get the service addressing information
|
||||||
|
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
||||||
|
&num_services);
|
||||||
|
|
||||||
|
timeout += LOC_CLIENT_SERVICE_TIMEOUT_UNIT;
|
||||||
|
|
||||||
|
LOC_LOGV("%s:%d]: qmi_client_get_service_list() rc %d, nosignal %d, "
|
||||||
|
"total timeout %d", __func__, __LINE__, rc, nosignal, timeout);
|
||||||
|
} while (timeout < LOC_CLIENT_SERVICE_TIMEOUT_TOTAL && nosignal && rc != QMI_NO_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == num_services || rc != QMI_NO_ERR) {
|
||||||
|
if (!nosignal) {
|
||||||
LOC_LOGE("%s:%d]: qmi_client_get_service_list failed even though"
|
LOC_LOGE("%s:%d]: qmi_client_get_service_list failed even though"
|
||||||
"service is up !!!\n", __func__, __LINE__);
|
"service is up !!! Error %d \n", __func__, __LINE__, rc);
|
||||||
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
return(eLOC_CLIENT_FAILURE_INTERNAL);
|
} else {
|
||||||
|
LOC_LOGE("%s:%d]: qmi_client_get_service_list failed after retries,"
|
||||||
|
" final Err %d", __func__, __LINE__, rc);
|
||||||
|
status = eLOC_CLIENT_FAILURE_TIMEOUT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pServiceInfo =
|
||||||
|
(qmi_service_info *)malloc(num_services * sizeof(qmi_service_info));
|
||||||
|
|
||||||
|
if(NULL == pServiceInfo)
|
||||||
|
{
|
||||||
|
LOC_LOGE("%s:%d]: could not allocate memory for serviceInfo !!\n",
|
||||||
|
__func__, __LINE__);
|
||||||
|
|
||||||
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get service info to be used in qmi_client_init
|
//set the number of entries to get equal to the total number of
|
||||||
rc = qmi_client_get_service_list( locClientServiceObject, serviceInfo,
|
//services.
|
||||||
|
num_entries = num_services;
|
||||||
|
//populate the serviceInfo
|
||||||
|
rc = qmi_client_get_service_list( locClientServiceObject, pServiceInfo,
|
||||||
&num_entries, &num_services);
|
&num_entries, &num_services);
|
||||||
|
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: qmi_client_get_service_list()"
|
LOC_LOGV("%s:%d]: qmi_client_get_service_list()"
|
||||||
" returned %d num_entries = %d num_services = %d\n",
|
" returned %d num_entries = %d num_services = %d\n",
|
||||||
__func__, __LINE__,
|
__func__, __LINE__,
|
||||||
|
@ -1479,13 +1641,19 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
LOC_LOGE("%s:%d]: qmi_client_get_service_list Error %d \n",
|
LOC_LOGE("%s:%d]: qmi_client_get_service_list Error %d \n",
|
||||||
__func__, __LINE__, rc);
|
__func__, __LINE__, rc);
|
||||||
|
|
||||||
return(eLOC_CLIENT_FAILURE_INTERNAL);
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: passing the pointer %p to qmi_client_init \n",
|
LOC_LOGV("%s:%d]: passing the pointer %p to qmi_client_init \n",
|
||||||
__func__, __LINE__, pLocClientCbData);
|
__func__, __LINE__, pLocClientCbData);
|
||||||
|
|
||||||
// initialize the client
|
// initialize the client
|
||||||
rc = qmi_client_init(&serviceInfo[0], locClientServiceObject,
|
//sent the address of the first service found
|
||||||
|
// if IPC router is present, this will go to the service instance
|
||||||
|
// enumerated over IPC router, else it will go over the next transport where
|
||||||
|
// the service was enumerated.
|
||||||
|
rc = qmi_client_init(&pServiceInfo[0], locClientServiceObject,
|
||||||
locClientIndCb, (void *) pLocClientCbData,
|
locClientIndCb, (void *) pLocClientCbData,
|
||||||
NULL, &clnt);
|
NULL, &clnt);
|
||||||
|
|
||||||
|
@ -1493,7 +1661,9 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
{
|
{
|
||||||
LOC_LOGE("%s:%d]: qmi_client_init error %d\n",
|
LOC_LOGE("%s:%d]: qmi_client_init error %d\n",
|
||||||
__func__, __LINE__, rc);
|
__func__, __LINE__, rc);
|
||||||
return(eLOC_CLIENT_FAILURE_INTERNAL);
|
|
||||||
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: passing the pointer %p to"
|
LOC_LOGV("%s:%d]: passing the pointer %p to"
|
||||||
|
@ -1508,14 +1678,30 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
{
|
{
|
||||||
LOC_LOGE("%s:%d]: could not register QCCI error callback error:%d\n",
|
LOC_LOGE("%s:%d]: could not register QCCI error callback error:%d\n",
|
||||||
__func__, __LINE__, rc);
|
__func__, __LINE__, rc);
|
||||||
return (eLOC_CLIENT_FAILURE_INTERNAL);
|
|
||||||
|
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the clnt handle returned in qmi_client_init
|
// copy the clnt handle returned in qmi_client_init
|
||||||
memcpy(&(pLocClientCbData->userHandle), &clnt, sizeof(qmi_client_type));
|
memcpy(&(pLocClientCbData->userHandle), &clnt, sizeof(qmi_client_type));
|
||||||
|
|
||||||
return(eLOC_CLIENT_SUCCESS);
|
status = eLOC_CLIENT_SUCCESS;
|
||||||
|
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
/* release the notifier handle */
|
||||||
|
if(true == notifierInitFlag)
|
||||||
|
{
|
||||||
|
qmi_client_release(notifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(NULL != pServiceInfo)
|
||||||
|
{
|
||||||
|
free((void *)pServiceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
//----------------------- END INTERNAL FUNCTIONS ----------------------------------------
|
//----------------------- END INTERNAL FUNCTIONS ----------------------------------------
|
||||||
|
|
||||||
|
@ -1592,6 +1778,8 @@ locClientStatusEnumType locClientOpen (
|
||||||
{
|
{
|
||||||
free(pCallbackData);
|
free(pCallbackData);
|
||||||
pCallbackData = NULL;
|
pCallbackData = NULL;
|
||||||
|
LOC_LOGE ("%s:%d] locClientQmiCtrlPointInit returned %d\n",
|
||||||
|
__func__, __LINE__, status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,6 +1826,7 @@ locClientStatusEnumType locClientOpen (
|
||||||
if(eLOC_CLIENT_SUCCESS != status)
|
if(eLOC_CLIENT_SUCCESS != status)
|
||||||
{
|
{
|
||||||
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
||||||
|
LOC_LOGE("%s:%d]: Error! status = %d\n", __func__, __LINE__,status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(status);
|
return(status);
|
||||||
|
@ -1684,7 +1873,7 @@ locClientStatusEnumType locClientClose(
|
||||||
return(eLOC_CLIENT_FAILURE_INVALID_HANDLE);
|
return(eLOC_CLIENT_FAILURE_INVALID_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOC_LOGV("locClientClose releasing handle 0x%x, user handle 0x%x\n",
|
LOC_LOGV("locClientClose releasing handle %p, user handle %p\n",
|
||||||
*pLocClientHandle, pCallbackData->userHandle );
|
*pLocClientHandle, pCallbackData->userHandle );
|
||||||
|
|
||||||
// NEXT call goes out to modem. We log the callflow before it
|
// NEXT call goes out to modem. We log the callflow before it
|
||||||
|
@ -1692,6 +1881,7 @@ locClientStatusEnumType locClientClose(
|
||||||
// back from the modem, to avoid confusing log order. We trust
|
// back from the modem, to avoid confusing log order. We trust
|
||||||
// that the QMI framework is robust.
|
// that the QMI framework is robust.
|
||||||
EXIT_LOG_CALLFLOW(%s, "loc client close");
|
EXIT_LOG_CALLFLOW(%s, "loc client close");
|
||||||
|
|
||||||
// release the handle
|
// release the handle
|
||||||
rc = qmi_client_release(pCallbackData->userHandle);
|
rc = qmi_client_release(pCallbackData->userHandle);
|
||||||
if(QMI_NO_ERR != rc )
|
if(QMI_NO_ERR != rc )
|
||||||
|
@ -1713,7 +1903,6 @@ locClientStatusEnumType locClientClose(
|
||||||
|
|
||||||
// set the handle to invalid value
|
// set the handle to invalid value
|
||||||
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
return eLOC_CLIENT_SUCCESS;
|
return eLOC_CLIENT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1779,7 +1968,6 @@ locClientStatusEnumType locClientSendReq(
|
||||||
// back from the modem, to avoid confusing log order. We trust
|
// back from the modem, to avoid confusing log order. We trust
|
||||||
// that the QMI framework is robust.
|
// that the QMI framework is robust.
|
||||||
EXIT_LOG_CALLFLOW(%s, loc_get_v02_event_name(reqId));
|
EXIT_LOG_CALLFLOW(%s, loc_get_v02_event_name(reqId));
|
||||||
|
|
||||||
rc = qmi_client_send_msg_sync(
|
rc = qmi_client_send_msg_sync(
|
||||||
pCallbackData->userHandle,
|
pCallbackData->userHandle,
|
||||||
reqId,
|
reqId,
|
||||||
|
@ -1801,6 +1989,17 @@ locClientStatusEnumType locClientSendReq(
|
||||||
// map the QCCI response to Loc API v02 status
|
// map the QCCI response to Loc API v02 status
|
||||||
status = convertQmiResponseToLocStatus(&resp);
|
status = convertQmiResponseToLocStatus(&resp);
|
||||||
|
|
||||||
|
// if the request is to change registered events, update the
|
||||||
|
// loc api copy of that
|
||||||
|
if(eLOC_CLIENT_SUCCESS == status &&
|
||||||
|
QMI_LOC_REG_EVENTS_REQ_V02 == reqId)
|
||||||
|
{
|
||||||
|
if(NULL != reqPayload.pRegEventsReq )
|
||||||
|
{
|
||||||
|
pCallbackData->eventRegMask =
|
||||||
|
(locClientEventMaskType)(reqPayload.pRegEventsReq->eventRegMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
142
loc_api/loc_api_v02/loc_api_v02_client.h
Executable file → Normal file
142
loc_api/loc_api_v02/loc_api_v02_client.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -112,9 +112,12 @@ typedef enum
|
||||||
eLOC_CLIENT_FAILURE_INTERNAL = 11,
|
eLOC_CLIENT_FAILURE_INTERNAL = 11,
|
||||||
/**< Failed because of an internal error in the service. */
|
/**< Failed because of an internal error in the service. */
|
||||||
|
|
||||||
eLOC_CLIENT_FAILURE_NOT_INITIALIZED = 12
|
eLOC_CLIENT_FAILURE_NOT_INITIALIZED = 12,
|
||||||
/**< Failed because the service has not been initialized. */
|
/**< Failed because the service has not been initialized. */
|
||||||
|
|
||||||
|
eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY = 13
|
||||||
|
/**< Failed because not rnough memory to do the operation.*/
|
||||||
|
|
||||||
}locClientStatusEnumType;
|
}locClientStatusEnumType;
|
||||||
|
|
||||||
/** Loc Client error values
|
/** Loc Client error values
|
||||||
|
@ -154,6 +157,8 @@ typedef enum
|
||||||
- GetOperationMode
|
- GetOperationMode
|
||||||
- GetCradleMountConfig
|
- GetCradleMountConfig
|
||||||
- GetExternalPowerConfig
|
- GetExternalPowerConfig
|
||||||
|
- GetSensorControlConfig
|
||||||
|
- GetSensorPerformanceControlConfiguration
|
||||||
*/
|
*/
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
|
@ -451,6 +456,17 @@ typedef union
|
||||||
QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02.
|
QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02.
|
||||||
@newpage */
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocGetSensorPropertiesReqMsgT_v02* pGetSensorPropertiesReq;
|
||||||
|
/**< Retrieves the sensor properties from the engine.
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_GET_SENSOR_PROPERTIES_IND_V02.
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02.
|
||||||
|
@newpage */
|
||||||
|
|
||||||
const qmiLocSetSensorPropertiesReqMsgT_v02* pSetSensorPropertiesReq;
|
const qmiLocSetSensorPropertiesReqMsgT_v02* pSetSensorPropertiesReq;
|
||||||
/**< Sets the sensor properties in the engine.
|
/**< Sets the sensor properties in the engine.
|
||||||
|
|
||||||
|
@ -508,6 +524,65 @@ typedef union
|
||||||
QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02.
|
QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02.
|
||||||
@newpage */
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocAddCircularGeofenceReqMsgT_v02* pAddCircularGeofenceReq;
|
||||||
|
/**< Adds a Circular Geofence.
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02.
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocDeleteGeofenceReqMsgT_v02* pDeleteGeofenceReq;
|
||||||
|
/**< Deletes a Geofence.
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_DELETE_GEOFENCE_IND_V02.
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_DELETE_GEOFENCE_REQ_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocQueryGeofenceReqMsgT_v02* pQueryGeofenceReq;
|
||||||
|
/**< Queries a Geofence.
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_QUERY_GEOFENCE_IND_V02
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_QUERY_GEOFENCE_REQ_V02
|
||||||
|
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocEditGeofenceReqMsgT_v02* pEditGeofenceReq;
|
||||||
|
/**< Edits Geofence Parameters.
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_EDIT_GEOFENCE_IND_V02
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_EDIT_GEOFENCE_REQ_V02
|
||||||
|
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocGetBestAvailablePositionReqMsgT_v02*
|
||||||
|
pGetBestAvailablePositionReq;
|
||||||
|
/**< Get the best available position from location engine
|
||||||
|
|
||||||
|
If the request is accepted by the service, the client receives the
|
||||||
|
following indication containing a response:
|
||||||
|
QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02
|
||||||
|
|
||||||
|
To send this request, set the reqId field in locClientSendReq() to
|
||||||
|
QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02
|
||||||
|
|
||||||
|
@newpage */
|
||||||
|
|
||||||
}locClientReqUnionType;
|
}locClientReqUnionType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -636,6 +711,31 @@ typedef union
|
||||||
QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02.
|
QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02.
|
||||||
@newpage */
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocEventNiGeofenceNotificationIndMsgT_v02*
|
||||||
|
pNiGeofenceNotificationEvent;
|
||||||
|
/**< Sent by the engine to notify the client about changes to a
|
||||||
|
Network Initiated Geofence.
|
||||||
|
|
||||||
|
The eventIndId field in the event indication callback is set to
|
||||||
|
QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02.
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocEventGeofenceGenAlertIndMsgT_v02* pGeofenceGenAlertEvent;
|
||||||
|
/**< Sent by the engine to notify the client about updates that may
|
||||||
|
affect a Geofence operation.
|
||||||
|
|
||||||
|
The eventIndId field in the event indication callback is set to
|
||||||
|
QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02.
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocEventGeofenceBreachIndMsgT_v02* pGeofenceBreachEvent;
|
||||||
|
/**< Sent by the engine to notify the client about a Geofence Breach
|
||||||
|
Event.
|
||||||
|
|
||||||
|
The eventIndId field in the event indication callback is set to
|
||||||
|
QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02.
|
||||||
|
@newpage */
|
||||||
|
|
||||||
}locClientEventIndUnionType;
|
}locClientEventIndUnionType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -951,7 +1051,43 @@ typedef union
|
||||||
/**< Response to the request,
|
/**< Response to the request,
|
||||||
QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02
|
QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02
|
||||||
The respIndId field in the response indication callback is set to
|
The respIndId field in the response indication callback is set to
|
||||||
QMI_LOC_ET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02.
|
QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02.
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocAddCircularGeofenceIndMsgT_v02* pAddCircularGeofenceInd;
|
||||||
|
/**< Response to the request,
|
||||||
|
QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02
|
||||||
|
The respIndId field in the response indication callback is set to
|
||||||
|
QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocDeleteGeofenceIndMsgT_v02* pDeleteGeofenceInd;
|
||||||
|
/**< Response to the request,
|
||||||
|
QMI_LOC_DELETE_GEOFENCE_REQ_V02
|
||||||
|
The respIndId field in the response indication callback is set to
|
||||||
|
QMI_LOC_DELETE_GEOFENCE_IND_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocQueryGeofenceIndMsgT_v02* pQueryGeofenceInd;
|
||||||
|
/**< Response to the request,
|
||||||
|
QMI_LOC_QUERY_GEOFENCE_REQ_V02
|
||||||
|
The respIndId field in the response indication callback is set to
|
||||||
|
QMI_LOC_QUERY_GEOFENCE_IND_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocEditGeofenceIndMsgT_v02* pEditGeofenceInd;
|
||||||
|
/**< Response to the request,
|
||||||
|
QMI_LOC_EDIT_GEOFENCE_REQ_V02
|
||||||
|
The respIndId field in the response indication callback is set to
|
||||||
|
QMI_LOC_EDIT_GEOFENCE_IND_V02
|
||||||
|
@newpage */
|
||||||
|
|
||||||
|
const qmiLocGetBestAvailablePositionIndMsgT_v02*
|
||||||
|
pGetBestAvailablePositionInd;
|
||||||
|
/**< Response to the request,
|
||||||
|
QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02
|
||||||
|
The respIndId field in the response indication callback is set to
|
||||||
|
QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02
|
||||||
@newpage */
|
@newpage */
|
||||||
|
|
||||||
}locClientRespIndUnionType;
|
}locClientRespIndUnionType;
|
||||||
|
|
23
loc_api/loc_api_v02/loc_api_v02_log.c
Executable file → Normal file
23
loc_api/loc_api_v02/loc_api_v02_log.c
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -191,6 +191,24 @@ static loc_name_val_s_type loc_v02_event_name[] =
|
||||||
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
|
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
|
||||||
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02),
|
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_RESP_V02),
|
||||||
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02),
|
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02),
|
||||||
|
NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_RESP_V02),
|
||||||
|
NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_REQ_V02),
|
||||||
|
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_RESP_V02),
|
||||||
|
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_QUERY_GEOFENCE_REQ_V02),
|
||||||
|
NAME_VAL(QMI_LOC_QUERY_GEOFENCE_RESP_V02),
|
||||||
|
NAME_VAL(QMI_LOC_QUERY_GEOFENCE_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EDIT_GEOFENCE_REQ_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EDIT_GEOFENCE_RESP_V02),
|
||||||
|
NAME_VAL(QMI_LOC_EDIT_GEOFENCE_IND_V02),
|
||||||
|
NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02),
|
||||||
|
NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_RESP_V02),
|
||||||
|
NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_IND_V02),
|
||||||
};
|
};
|
||||||
static int loc_v02_event_num = sizeof(loc_v02_event_name) / sizeof(loc_name_val_s_type);
|
static int loc_v02_event_num = sizeof(loc_v02_event_name) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
@ -214,6 +232,7 @@ static loc_name_val_s_type loc_v02_client_status_name[] =
|
||||||
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
|
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
|
||||||
NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
|
NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
|
||||||
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
|
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
|
||||||
|
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY),
|
||||||
};
|
};
|
||||||
static int loc_v02_client_status_num = sizeof(loc_v02_client_status_name) / sizeof(loc_name_val_s_type);
|
static int loc_v02_client_status_num = sizeof(loc_v02_client_status_name) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
@ -233,6 +252,8 @@ static loc_name_val_s_type loc_v02_qmi_status_name[] =
|
||||||
eQMI_LOC_ENGINE_BUSY_V02,
|
eQMI_LOC_ENGINE_BUSY_V02,
|
||||||
eQMI_LOC_PHONE_OFFLINE_V02,
|
eQMI_LOC_PHONE_OFFLINE_V02,
|
||||||
eQMI_LOC_TIMEOUT_V02,
|
eQMI_LOC_TIMEOUT_V02,
|
||||||
|
eQMI_LOC_CONFIG_NOT_SUPPORTED_V02,
|
||||||
|
eQMI_LOC_INSUFFICIENT_MEMORY_V02,
|
||||||
QMILOCSTATUSENUMT_MAX_ENUM_VAL_V02
|
QMILOCSTATUSENUMT_MAX_ENUM_VAL_V02
|
||||||
};
|
};
|
||||||
static int loc_v02_qmi_status_num = sizeof(loc_v02_qmi_status_name) / sizeof(loc_name_val_s_type);
|
static int loc_v02_qmi_status_num = sizeof(loc_v02_qmi_status_name) / sizeof(loc_name_val_s_type);
|
||||||
|
|
0
loc_api/loc_api_v02/loc_api_v02_log.h
Executable file → Normal file
0
loc_api/loc_api_v02/loc_api_v02_log.h
Executable file → Normal file
40
loc_api/loc_api_v02/loc_util_log.h
Executable file → Normal file
40
loc_api/loc_api_v02/loc_util_log.h
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -24,13 +24,18 @@
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LOC_UTIL_LOG_H
|
#ifndef LOC_UTIL_LOG_H
|
||||||
#define LOC_UTIL_LOG_H
|
#define LOC_UTIL_LOG_H
|
||||||
|
|
||||||
#ifdef FEATURE_LOC_API_V02_QNX_MOD
|
#if defined(_ANDROID_)
|
||||||
|
#include "loc_api_v02_log.h"
|
||||||
|
#include <log_util.h>
|
||||||
|
|
||||||
|
#else // no _ANDROID_
|
||||||
|
|
||||||
|
// common for QNX and Griffon
|
||||||
|
|
||||||
//error logs
|
//error logs
|
||||||
#define LOC_LOGE(...) printf(__VA_ARGS__)
|
#define LOC_LOGE(...) printf(__VA_ARGS__)
|
||||||
//warning logs
|
//warning logs
|
||||||
|
@ -45,22 +50,17 @@
|
||||||
#define MODEM_LOG_CALLFLOW(SPEC, VAL)
|
#define MODEM_LOG_CALLFLOW(SPEC, VAL)
|
||||||
#define EXIT_LOG_CALLFLOW(SPEC, VAL)
|
#define EXIT_LOG_CALLFLOW(SPEC, VAL)
|
||||||
|
|
||||||
#endif //FEATURE_LOC_API_V02_QNX_MOD
|
#define loc_get_v02_event_name(X) #X
|
||||||
|
#define loc_get_v02_client_status_name(X) #X
|
||||||
|
|
||||||
|
#define loc_get_v02_qmi_status_name(X) #X
|
||||||
|
|
||||||
|
//specific to OFF TARGET
|
||||||
#ifdef LOC_UTIL_TARGET_OFF_TARGET
|
#ifdef LOC_UTIL_TARGET_OFF_TARGET
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
# include <asm/errno.h>
|
||||||
//error logs
|
# include <sys/time.h>
|
||||||
#define LOC_LOGE(...) printf(__VA_ARGS__)
|
|
||||||
//warning logs
|
|
||||||
#define LOC_LOGW(...) printf(__VA_ARGS__)
|
|
||||||
// debug logs
|
|
||||||
#define LOC_LOGD(...) printf(__VA_ARGS__)
|
|
||||||
//info logs
|
|
||||||
#define LOC_LOGI(...) printf(__VA_ARGS__)
|
|
||||||
//verbose logs
|
|
||||||
#define LOC_LOGV(...) printf(__VA_ARGS__)
|
|
||||||
|
|
||||||
// get around strl*: not found in glibc
|
// get around strl*: not found in glibc
|
||||||
// TBD:look for presence of eglibc other libraries
|
// TBD:look for presence of eglibc other libraries
|
||||||
|
@ -68,14 +68,8 @@
|
||||||
#define strlcpy(X,Y,Z) strcpy(X,Y)
|
#define strlcpy(X,Y,Z) strcpy(X,Y)
|
||||||
#define strlcat(X,Y,Z) strcat(X,Y)
|
#define strlcat(X,Y,Z) strcat(X,Y)
|
||||||
|
|
||||||
#define MODEM_LOG_CALLFLOW(SPEC, VAL)
|
|
||||||
#define EXIT_LOG_CALLFLOW(SPEC, VAL)
|
|
||||||
|
|
||||||
#elif defined(_ANDROID_)
|
|
||||||
|
|
||||||
#include <log_util.h>
|
|
||||||
|
|
||||||
#endif //LOC_UTIL_TARGET_OFF_TARGET
|
#endif //LOC_UTIL_TARGET_OFF_TARGET
|
||||||
|
|
||||||
|
#endif //_ANDROID_
|
||||||
|
|
||||||
#endif //LOC_UTIL_LOG_H
|
#endif //LOC_UTIL_LOG_H
|
||||||
|
|
999
loc_api/loc_api_v02/location_service_v02.c
Executable file → Normal file
999
loc_api/loc_api_v02/location_service_v02.c
Executable file → Normal file
File diff suppressed because it is too large
Load diff
4217
loc_api/loc_api_v02/location_service_v02.h
Executable file → Normal file
4217
loc_api/loc_api_v02/location_service_v02.h
Executable file → Normal file
File diff suppressed because it is too large
Load diff
25
loc_api/ulp/inc/ulp.h
Executable file → Normal file
25
loc_api/ulp/inc/ulp.h
Executable file → Normal file
|
@ -36,14 +36,7 @@ extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <hardware/gps.h>
|
#include <hardware/gps.h>
|
||||||
|
#include "loc_eng.h"
|
||||||
typedef int (ulp_report_position_cb)
|
|
||||||
(
|
|
||||||
void* owner,
|
|
||||||
const GpsLocation* location_report_ptr,
|
|
||||||
unsigned int ext_data_length,
|
|
||||||
unsigned char* ext_data
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Represents the standard ulp module interface. */
|
/** Represents the standard ulp module interface. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -51,24 +44,14 @@ typedef struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the ulp module. 0: success
|
* Starts the libulp module. 0: success
|
||||||
*/
|
*/
|
||||||
int (*init)( void* owner, ulp_report_position_cb* cb);
|
int (*init)(loc_eng_data_s_type &loc_eng_data);
|
||||||
|
|
||||||
/** Starts the ulp engine. 0: success */
|
}ulpInterface;
|
||||||
int (*start_fix)( void );
|
|
||||||
|
|
||||||
/** Stops the ulp engine. 0: success */
|
|
||||||
int (*stop_fix)( void );
|
|
||||||
|
|
||||||
/** Closes the interface */
|
|
||||||
int (*destroy)( void );
|
|
||||||
|
|
||||||
} ulpInterface;
|
|
||||||
|
|
||||||
typedef const ulpInterface* (get_ulp_interface) (void);
|
typedef const ulpInterface* (get_ulp_interface) (void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
2
utils/Android.mk
Executable file → Normal file
2
utils/Android.mk
Executable file → Normal file
|
@ -21,6 +21,8 @@ LOCAL_CFLAGS += \
|
||||||
-fno-short-enums \
|
-fno-short-enums \
|
||||||
-D_ANDROID_
|
-D_ANDROID_
|
||||||
|
|
||||||
|
LOCAL_LDFLAGS += -Wl,--export-dynamic
|
||||||
|
|
||||||
## Includes
|
## Includes
|
||||||
LOCAL_C_INCLUDES:=
|
LOCAL_C_INCLUDES:=
|
||||||
|
|
||||||
|
|
0
utils/linked_list.c
Executable file → Normal file
0
utils/linked_list.c
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue