Merge jb into jb_2.5
Features ULP, IPV6, DELEXT disabled Conflicts: loc_api/Android.mk loc_api/libloc_api-rpc-50001/* loc_api/libloc_api_50001/* loc_api/loc_api_v02/* loc_api/ulp/inc/ulp.h utils/* Change-Id: I846352d0addca89d4ffc3b114b774926b23e930d
This commit is contained in:
commit
7118024952
63 changed files with 11568 additions and 4589 deletions
24
loc_api/Android.mk
Executable file → Normal file
24
loc_api/Android.mk
Executable file → Normal file
|
@ -1,18 +1,12 @@
|
|||
# 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),)
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
GPS_DIR_LIST :=
|
||||
|
||||
ifeq (exists, $(shell test -d $(TOP)/vendor/qcom/proprietary/qmi-framework && echo exists))
|
||||
FEATURE_IPV6 := false
|
||||
FEATURE_DELEXT := false
|
||||
FEATURE_ULP := false
|
||||
|
||||
# add RPC dirs if RPC is available
|
||||
ifneq ($(TARGET_NO_RPC),true)
|
||||
|
@ -21,14 +15,18 @@ GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
|
|||
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc/
|
||||
GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api/
|
||||
|
||||
else
|
||||
|
||||
GPS_DIR_LIST += $(LOCAL_PATH)/loc_api_v02/
|
||||
|
||||
endif #TARGET_NO_RPC
|
||||
|
||||
ifeq (exists, $(shell test -d $(TOP)/vendor/qcom/proprietary/qmi-framework && echo exists))
|
||||
#add QMI libraries for QMI targets
|
||||
QMI_BOARD_PLATFORM_LIST := msm8960
|
||||
QMI_BOARD_PLATFORM_LIST += msm8974
|
||||
endif
|
||||
|
||||
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/
|
||||
|
||||
#call the subfolders
|
||||
|
|
0
loc_api/NOTICE
Executable file → Normal file
0
loc_api/NOTICE
Executable file → Normal file
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
8
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
Executable file → Normal file
8
loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
Executable file → Normal file
|
@ -20,6 +20,14 @@ LOCAL_CFLAGS+=$(GPS_FEATURES)
|
|||
# for loc_api_fixup.c
|
||||
LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
|
||||
|
||||
ifeq ($(FEATURE_IPV6), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_IPV6
|
||||
endif #FEATURE_IPV6
|
||||
|
||||
ifeq ($(FEATURE_ULP), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_ULP
|
||||
endif #FEATURE_ULP
|
||||
|
||||
LOCAL_SHARED_LIBRARIES:= \
|
||||
librpc \
|
||||
libutils \
|
||||
|
|
|
@ -38,6 +38,8 @@ class LocApiRpcAdapter : public LocApiAdapter {
|
|||
// RPC communication establishment
|
||||
rpc_loc_client_handle_type client_handle;
|
||||
rpc_loc_event_mask_type eMask;
|
||||
int dataEnableLastSet;
|
||||
char apnLastSet[MAX_APN_LEN];
|
||||
|
||||
static const rpc_loc_event_mask_type locBits[];
|
||||
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
|
||||
stopFix();
|
||||
virtual enum loc_api_adapter_err
|
||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
|
||||
setPositionMode(const LocPosMode *mode);
|
||||
inline virtual enum loc_api_adapter_err
|
||||
enableData(int enable) { return enableData(enable, false); }
|
||||
virtual enum loc_api_adapter_err
|
||||
enableData(int enable);
|
||||
enableData(int enable, boolean force);
|
||||
virtual enum loc_api_adapter_err
|
||||
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||
virtual enum loc_api_adapter_err
|
||||
|
@ -83,20 +86,30 @@ public:
|
|||
deleteAidingData(GpsAidingData f);
|
||||
virtual enum loc_api_adapter_err
|
||||
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
|
||||
setAPN(char* apn, int len);
|
||||
setAPN(char* apn, int len, boolean force);
|
||||
virtual enum loc_api_adapter_err
|
||||
setServer(const char* url, int len);
|
||||
virtual enum loc_api_adapter_err
|
||||
setServer(unsigned int ip, int port, LocServerType type);
|
||||
virtual enum loc_api_adapter_err
|
||||
setXtraData(char* data, int length);
|
||||
#ifdef FEATURE_IPV6
|
||||
virtual enum loc_api_adapter_err
|
||||
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, 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
|
||||
setSUPLVersion(uint32_t version);
|
||||
|
||||
virtual void setInSession(bool inSession);
|
||||
};
|
||||
|
||||
#endif //LOC_API_RPC_ADAPTER_H
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#define PRINT(x...) do { \
|
||||
fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stdout, ##x); \
|
||||
LOGD(x); \
|
||||
ALOGD(x); \
|
||||
} while(0)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -55,14 +55,14 @@
|
|||
#define E(x...) do { \
|
||||
fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, ##x); \
|
||||
LOGE(x); \
|
||||
ALOGE(x); \
|
||||
} while(0)
|
||||
|
||||
#define FAILIF(cond, msg...) do { \
|
||||
if (__builtin_expect (cond, 0)) { \
|
||||
fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, ##msg); \
|
||||
LOGE(##msg); \
|
||||
ALOGE(##msg); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -98,7 +98,7 @@ static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event eve
|
|||
}
|
||||
|
||||
|
||||
extern "C" LocApiAdapter* getLocApiAdapter(LocEng &locEng)
|
||||
LocApiAdapter* getLocApiAdapter(LocEng &locEng)
|
||||
{
|
||||
return new LocApiRpcAdapter(locEng);
|
||||
}
|
||||
|
@ -119,8 +119,10 @@ const rpc_loc_event_mask_type LocApiRpcAdapter::locBits[] =
|
|||
LocApiRpcAdapter::LocApiRpcAdapter(LocEng &locEng) :
|
||||
LocApiAdapter(locEng),
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -298,9 +300,7 @@ LocApiRpcAdapter::stopFix() {
|
|||
}
|
||||
|
||||
enum loc_api_adapter_err
|
||||
LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
||||
GpsPositionRecurrence recurrence, uint32_t min_interval,
|
||||
uint32_t preferred_accuracy, uint32_t preferred_time)
|
||||
LocApiRpcAdapter::setPositionMode(const LocPosMode *posMode)
|
||||
{
|
||||
rpc_loc_ioctl_data_u_type ioctl_data;
|
||||
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;
|
||||
int ret_val;
|
||||
|
||||
LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
|
||||
(int32) client_handle, min_interval, mode);
|
||||
if (NULL != posMode)
|
||||
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:
|
||||
op_mode = RPC_LOC_OPER_MODE_MSB;
|
||||
|
@ -329,6 +332,7 @@ LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
|||
op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
|
||||
break;
|
||||
case LOC_POSITION_MODE_RESERVED_4:
|
||||
case LOC_POSITION_MODE_RESERVED_5:
|
||||
op_mode = RPC_LOC_OPER_MODE_MSA;
|
||||
fix_criteria_ptr->preferred_response_time = 0;
|
||||
break;
|
||||
|
@ -339,29 +343,22 @@ LocApiRpcAdapter::setPositionMode(LocPositionMode mode,
|
|||
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 |
|
||||
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;
|
||||
|
||||
if (min_interval > 0) {
|
||||
fix_criteria_ptr->min_interval = min_interval;
|
||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
|
||||
}else if(min_interval == 0)
|
||||
{
|
||||
/*If the framework passes in 0 transalate it into the maximum frequency we can report positions
|
||||
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->min_interval = fixCriteria.min_interval;
|
||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
|
||||
|
||||
if (fixCriteria.preferred_accuracy > 0) {
|
||||
fix_criteria_ptr->preferred_accuracy = fixCriteria.preferred_accuracy;
|
||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
|
||||
}
|
||||
if (preferred_time > 0) {
|
||||
fix_criteria_ptr->preferred_response_time = preferred_time;
|
||||
if (fixCriteria.preferred_time > 0) {
|
||||
fix_criteria_ptr->preferred_response_time = fixCriteria.preferred_time;
|
||||
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
|
||||
}
|
||||
|
||||
switch (recurrence) {
|
||||
switch (fixCriteria.recurrence) {
|
||||
case GPS_POSITION_RECURRENCE_SINGLE:
|
||||
fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
|
||||
break;
|
||||
|
@ -484,20 +481,42 @@ LocApiRpcAdapter::informNiResponse(GpsUserResponseType userResponse,
|
|||
}
|
||||
|
||||
enum loc_api_adapter_err
|
||||
LocApiRpcAdapter::setAPN(char* apn, int len)
|
||||
LocApiRpcAdapter::setAPN(char* apn, int len, boolean force)
|
||||
{
|
||||
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].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);
|
||||
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);
|
||||
|
||||
return convertErr(
|
||||
loc_eng_ioctl (client_handle,
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
|
||||
&ioctl_data,
|
||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||
NULL)
|
||||
);
|
||||
if (false == navigating) {
|
||||
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].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
|
||||
memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
|
||||
|
||||
rtv = convertErr(
|
||||
loc_eng_ioctl (client_handle,
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
|
||||
&ioctl_data,
|
||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||
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
|
||||
|
@ -567,18 +586,26 @@ LocApiRpcAdapter::setServer(unsigned int ip, int port, LocServerType type)
|
|||
}
|
||||
|
||||
enum loc_api_adapter_err
|
||||
LocApiRpcAdapter::enableData(int enable)
|
||||
LocApiRpcAdapter::enableData(int enable, boolean force)
|
||||
{
|
||||
rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
|
||||
enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
if (force || dataEnableLastSet != enable) {
|
||||
dataEnableLastSet = enable;
|
||||
|
||||
ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
|
||||
return convertErr(
|
||||
loc_eng_ioctl (client_handle,
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE,
|
||||
&ioctl_data,
|
||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||
NULL)
|
||||
);
|
||||
if (false == navigating) {
|
||||
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;
|
||||
rtv = convertErr(
|
||||
loc_eng_ioctl (client_handle,
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE,
|
||||
&ioctl_data,
|
||||
LOC_IOCTL_DEFAULT_TIMEOUT,
|
||||
NULL)
|
||||
);
|
||||
}
|
||||
}
|
||||
return rtv;
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err
|
||||
|
@ -598,9 +625,13 @@ LocApiRpcAdapter::deleteAidingData(GpsAidingData bits)
|
|||
|
||||
void LocApiRpcAdapter::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
|
||||
{
|
||||
LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
|
||||
|
||||
GpsLocation location = {0};
|
||||
GpsLocationExtended locationExtended = {0};
|
||||
|
||||
location.size = sizeof(location);
|
||||
locationExtended.size = sizeof(locationExtended);
|
||||
if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
|
||||
{
|
||||
// Process the position from final and intermediate reports
|
||||
|
@ -653,16 +684,39 @@ void LocApiRpcAdapter::reportPosition(const rpc_loc_parsed_position_s_type *loca
|
|||
location.accuracy = location_report_ptr->hor_unc_circular;
|
||||
}
|
||||
|
||||
// Technology Mask
|
||||
|
||||
tech_Mask |= location_report_ptr->technology_mask;
|
||||
#ifdef FEATURE_ULP
|
||||
//Mark the location source as from GNSS
|
||||
location.flags |= LOCATION_HAS_SOURCE_INFO;
|
||||
location.position_source = ULP_LOCATION_IS_FROM_GNSS;
|
||||
#endif
|
||||
if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
|
||||
locationExtended.magneticDeviation = location_report_ptr->altitude_wrt_mean_sea_level;
|
||||
}
|
||||
|
||||
if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
|
||||
locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
|
||||
}
|
||||
|
||||
LOC_LOGV("reportPosition: fire callback\n");
|
||||
LocApiAdapter::reportPosition(location,
|
||||
locationExtended,
|
||||
locEngHandle.extPosInfo((void*)location_report_ptr),
|
||||
(location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS ?
|
||||
LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS));
|
||||
LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS),
|
||||
tech_Mask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LocApiAdapter::reportPosition(location,
|
||||
locationExtended,
|
||||
NULL,
|
||||
LOC_SESS_FAILURE);
|
||||
LOC_LOGV("loc_eng_report_position: ignore position report when session status = %d\n", location_report_ptr->session_status);
|
||||
|
@ -677,6 +731,8 @@ void LocApiRpcAdapter::reportPosition(const rpc_loc_parsed_position_s_type *loca
|
|||
void LocApiRpcAdapter::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
|
||||
{
|
||||
GpsSvStatus SvStatus = {0};
|
||||
GpsLocationExtended locationExtended = {0};
|
||||
locationExtended.size = sizeof(locationExtended);
|
||||
int num_svs_max = 0;
|
||||
const rpc_loc_sv_info_s_type *sv_info_ptr;
|
||||
|
||||
|
@ -760,9 +816,20 @@ void LocApiRpcAdapter::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
|
||||
(gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
|
||||
(gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
|
||||
locationExtended.pdop = gnss_report_ptr->position_dop;
|
||||
locationExtended.hdop = gnss_report_ptr->horizontal_dop;
|
||||
locationExtended.vdop = gnss_report_ptr->vertical_dop;
|
||||
}
|
||||
|
||||
if (SvStatus.num_svs >= 0)
|
||||
{
|
||||
LocApiAdapter::reportSv(SvStatus,
|
||||
locationExtended,
|
||||
locEngHandle.extSvInfo((void*)gnss_report_ptr));
|
||||
}
|
||||
}
|
||||
|
@ -881,13 +948,22 @@ LocApiRpcAdapter::setXtraData(char* data, int length)
|
|||
return convertErr(rpc_ret_val);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
enum loc_api_adapter_err
|
||||
LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
|
||||
#else
|
||||
enum loc_api_adapter_err
|
||||
LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsType agpsType)
|
||||
#endif
|
||||
{
|
||||
rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
|
||||
rpc_loc_ioctl_data_u_type ioctl_data;
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
if (AGPS_TYPE_INVALID == agpsType) {
|
||||
#else
|
||||
if (false) {
|
||||
#endif
|
||||
rpc_loc_server_open_status_s_type *conn_open_status_ptr =
|
||||
&ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
|
||||
|
||||
|
@ -924,6 +1000,7 @@ LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerTy
|
|||
conn_multi_open_status_ptr->apn_name[0] = 0;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
switch(bearer)
|
||||
{
|
||||
case AGPS_APN_BEARER_IPV4:
|
||||
|
@ -938,7 +1015,9 @@ LocApiRpcAdapter::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerTy
|
|||
default:
|
||||
conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
|
||||
}
|
||||
|
||||
#else
|
||||
conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
|
||||
#endif
|
||||
LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
|
||||
log_succ_fail_string(is_succ),
|
||||
apn,
|
||||
|
@ -992,16 +1071,22 @@ void LocApiRpcAdapter::ATLEvent(const rpc_loc_server_request_s_type *server_requ
|
|||
agps_type = AGPS_TYPE_SUPL;
|
||||
LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
|
||||
} else {
|
||||
#ifdef FEATURE_IPV6
|
||||
agps_type = AGPS_TYPE_WWAN_ANY;
|
||||
LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
requestATL(connHandle, agps_type);
|
||||
break;
|
||||
#ifdef FEATURE_IPV6
|
||||
case RPC_LOC_SERVER_REQUEST_OPEN:
|
||||
connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
|
||||
LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
|
||||
requestATL(connHandle, AGPS_TYPE_INVALID);
|
||||
break;
|
||||
#endif
|
||||
case RPC_LOC_SERVER_REQUEST_CLOSE:
|
||||
connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
|
||||
LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -62,8 +62,8 @@
|
|||
/* Logging Improvement */
|
||||
#include "log_util.h"
|
||||
|
||||
/* Uncomment to force LOGD messages */
|
||||
// #define LOGD LOGI
|
||||
/* Uncomment to force ALOGD messages */
|
||||
// #define ALOGD ALOGI
|
||||
|
||||
/*=====================================================================
|
||||
External declarations
|
||||
|
@ -316,30 +316,23 @@ rpc_loc_client_handle_type loc_open (
|
|||
rpc_loc_open_args args;
|
||||
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++)
|
||||
{
|
||||
if (loc_glue_callback_table[i].cb_func == event_callback ||
|
||||
loc_glue_callback_table[i].user == userData)
|
||||
if (loc_glue_callback_table[i].user == userData)
|
||||
{
|
||||
LOC_LOGW("Client already opened service (callback=%p)...\n",
|
||||
event_callback);
|
||||
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)
|
||||
{
|
||||
for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
i = j;
|
||||
}
|
||||
|
||||
if (i == LOC_API_CB_MAX_CLIENTS)
|
||||
|
@ -348,6 +341,10 @@ rpc_loc_client_handle_type loc_open (
|
|||
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;
|
||||
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].rpc_cb = NULL;
|
||||
loc_glue_callback_table[i].handle = -1;
|
||||
loc_glue_callback_table[i].user = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -195,7 +195,7 @@ void loc_api_callback_process_sync_call(
|
|||
{
|
||||
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++)
|
||||
{
|
||||
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;
|
||||
|
||||
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);
|
||||
slot->signal_sent = 1;
|
||||
|
||||
|
@ -252,21 +252,19 @@ static int loc_lock_a_slot()
|
|||
loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
|
||||
if (pthread_mutex_trylock(&slot->lock) == EBUSY)
|
||||
{
|
||||
LOGV("trylock EBUSY : %d", i);
|
||||
ALOGV("trylock EBUSY : %d", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!slot->in_use && !slot->not_available)
|
||||
{
|
||||
select_id = i;
|
||||
slot->in_use = 1;
|
||||
slot->signal_sent = 0;
|
||||
/* Return from here and leave the mutex locked.
|
||||
* will unlock it in loc_unlock_slot()
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -278,7 +276,7 @@ static int loc_lock_a_slot()
|
|||
FUNCTION loc_unlock_slot
|
||||
|
||||
DESCRIPTION
|
||||
Frees a buffer slot after the synchronous API call
|
||||
Unlocks a buffer slot
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
@ -292,13 +290,58 @@ SIDE EFFECTS
|
|||
===========================================================================*/
|
||||
static void loc_unlock_slot(int select_id)
|
||||
{
|
||||
loc_sync_data.slots[select_id].in_use = 0;
|
||||
|
||||
pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
FUNCTION loc_lock_slot
|
||||
|
||||
DESCRIPTION
|
||||
Locks a specific slot that was previously locked from loc_lock_a_slot
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
||||
RETURN VALUE
|
||||
None
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
static void loc_lock_slot(int select_id)
|
||||
{
|
||||
pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
FUNCTION loc_set_slot_in_use
|
||||
|
||||
DESCRIPTION
|
||||
Sets the in_use flag of slot to true or false.
|
||||
Should be called only after the slot is locked
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
||||
RETURN VALUE
|
||||
None
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
static void loc_set_slot_in_use(int select_id, boolean in_use)
|
||||
{
|
||||
loc_sync_data.slots[select_id].in_use = in_use;
|
||||
if (in_use == 1)
|
||||
loc_sync_data.slots[select_id].signal_sent = 0;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
FUNCTION loc_api_save_callback
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -399,7 +442,7 @@ static int loc_api_wait_callback(
|
|||
)
|
||||
{
|
||||
int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
|
||||
int rc; /* return code from pthread calls */
|
||||
int rc = 0; /* return code from pthread calls */
|
||||
|
||||
struct timespec expire_time;
|
||||
|
||||
|
@ -417,7 +460,7 @@ static int loc_api_wait_callback(
|
|||
if (rc == ETIMEDOUT)
|
||||
{
|
||||
ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
|
||||
LOGE("TIMEOUT: %d", select_id);
|
||||
ALOGE("TIMEOUT: %d", select_id);
|
||||
}
|
||||
else {
|
||||
/* Obtained the first awaited callback */
|
||||
|
@ -462,29 +505,38 @@ int loc_api_sync_ioctl
|
|||
|
||||
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));
|
||||
return rc;
|
||||
}
|
||||
|
||||
loc_set_slot_in_use(select_id, 1); // set slot in use to true
|
||||
|
||||
// Select the callback we are waiting for
|
||||
loc_api_save_callback(select_id, handle, 0, ioctl_type);
|
||||
|
||||
loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
|
||||
|
||||
// we want to avoid keeping the slot locked during the loc_ioctl because the rpc
|
||||
// framework will also lock a different mutex during this call, and typically
|
||||
// locking two different mutexes at the same time can lead to deadlock.
|
||||
rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
|
||||
|
||||
loc_lock_slot(select_id);
|
||||
|
||||
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));
|
||||
}
|
||||
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);
|
||||
// Wait for the callback of loc_ioctl
|
||||
if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
|
||||
{
|
||||
// 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));
|
||||
}
|
||||
else
|
||||
|
@ -493,15 +545,16 @@ int loc_api_sync_ioctl
|
|||
if (callback_data.status != RPC_LOC_API_SUCCESS)
|
||||
{
|
||||
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));
|
||||
} 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);
|
||||
}
|
||||
} /* wait callback */
|
||||
} /* loc_ioctl */
|
||||
|
||||
loc_set_slot_in_use(select_id, 0); // set slot in use to false
|
||||
loc_unlock_slot(select_id);
|
||||
|
||||
return rc;
|
||||
|
|
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
466
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
Executable file → Normal file
466
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -26,236 +26,236 @@
|
|||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/* LOC_API TOOL VERSION: 4.48 */
|
||||
/* GENERATED: TUE JUN 14 2011 */
|
||||
/*=============================================================================
|
||||
L O C _ A P I . X D R
|
||||
|
||||
GENERAL DESCRIPTION
|
||||
This is an AUTO GENERATED file that provides an xdr compatible definition of
|
||||
the loc_api API.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
/* LOC_API TOOL VERSION: 4.48 */
|
||||
/* GENERATED: TUE JUN 14 2011 */
|
||||
/*=============================================================================
|
||||
L O C _ A P I . X D R
|
||||
|
||||
GENERAL DESCRIPTION
|
||||
This is an AUTO GENERATED file that provides an xdr compatible definition of
|
||||
the loc_api API.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
=============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
AUTO GENERATED
|
||||
|
||||
Generated by following versions of Htorpc modules:
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
|
||||
|
||||
loc_api Definition File(s):
|
||||
Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
|
||||
=============================================================================*/
|
||||
/*=============================================================================
|
||||
$Header$
|
||||
=============================================================================*/
|
||||
|
||||
|
||||
|
||||
typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
|
||||
|
||||
/*
|
||||
* Declare an rpc_uint32 type for each callback type in the API
|
||||
*/
|
||||
typedef rpc_uint32 rpc_loc_event_cb_f_type;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function arguments
|
||||
*/
|
||||
|
||||
struct rpc_loc_open_args {
|
||||
rpc_loc_event_mask_type event_reg_mask;
|
||||
rpc_loc_event_cb_f_type event_callback;
|
||||
};
|
||||
|
||||
struct rpc_loc_close_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_start_fix_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_stop_fix_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_ioctl_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
rpc_loc_ioctl_e_type ioctl_type;
|
||||
rpc_loc_ioctl_data_u_type *ioctl_data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct rpc_loc_api_api_version_s_args {
|
||||
rpc_boolean len_not_null;
|
||||
};
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function results
|
||||
*/
|
||||
|
||||
struct rpc_loc_api_rpc_glue_code_info_remote_rets {
|
||||
rpc_uint32 toolvers; /* Tool version */
|
||||
rpc_uint32 features; /* Features turned on in the code.
|
||||
* 0x00000001 ONCRPC Server Cleanup Support
|
||||
*/
|
||||
rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
|
||||
rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
|
||||
};
|
||||
|
||||
struct rpc_loc_open_rets {
|
||||
rpc_loc_client_handle_type loc_open_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_close_rets {
|
||||
rpc_int32 loc_close_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_start_fix_rets {
|
||||
rpc_int32 loc_start_fix_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_stop_fix_rets {
|
||||
rpc_int32 loc_stop_fix_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_ioctl_rets {
|
||||
rpc_int32 loc_ioctl_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_api_api_versions_rets {
|
||||
rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
|
||||
rpc_uint32 *len;
|
||||
};
|
||||
|
||||
/*
|
||||
* XDR definition of the LOC_API program ( vers. 0x00050006 )
|
||||
*/
|
||||
|
||||
program LOC_APIPROG {
|
||||
version LOC_APIVERS_0001 {
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
rpc_loc_api_rpc_glue_code_info_remote_rets
|
||||
rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
|
||||
|
||||
rpc_loc_open_rets
|
||||
rpc_loc_open( rpc_loc_open_args ) = 2;
|
||||
|
||||
rpc_loc_close_rets
|
||||
rpc_loc_close( rpc_loc_close_args ) = 3;
|
||||
|
||||
rpc_loc_start_fix_rets
|
||||
rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
|
||||
|
||||
rpc_loc_stop_fix_rets
|
||||
rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
|
||||
|
||||
rpc_loc_ioctl_rets
|
||||
rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
|
||||
|
||||
rpc_loc_api_api_versions_rets
|
||||
rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
|
||||
|
||||
|
||||
|
||||
|
||||
} = 0x00050001;
|
||||
|
||||
version LOC_APIVERS_0002 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
|
||||
RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
|
||||
RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
|
||||
RPC_LOC_IOCTL_RESERVED_CMD
|
||||
RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050002;
|
||||
|
||||
version LOC_APIVERS_0003 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050003;
|
||||
|
||||
version LOC_APIVERS_0004 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
|
||||
RPC_LOC_IOCTL_GET_SUPL_VERSION
|
||||
RPC_LOC_IOCTL_SET_SUPL_VERSION
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050004;
|
||||
|
||||
version LOC_APIVERS_0005 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
|
||||
RPC_LOC_SERVER_ADDR_IPV6
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
|
||||
RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050005;
|
||||
|
||||
|
||||
|
||||
version LOC_APIVERS_0006 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
|
||||
RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
|
||||
RPC_LOC_SERVER_REQUEST_MULTI_OPEN
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050006;
|
||||
|
||||
|
||||
} = 0x3000008C;
|
||||
|
||||
const LOC_APIVERS = 0x00050006;
|
||||
---------------------------------------------------------------------------
|
||||
=============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
AUTO GENERATED
|
||||
|
||||
Generated by following versions of Htorpc modules:
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
|
||||
|
||||
loc_api Definition File(s):
|
||||
Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
|
||||
=============================================================================*/
|
||||
/*=============================================================================
|
||||
$Header$
|
||||
=============================================================================*/
|
||||
|
||||
|
||||
|
||||
typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
|
||||
|
||||
/*
|
||||
* Declare an rpc_uint32 type for each callback type in the API
|
||||
*/
|
||||
typedef rpc_uint32 rpc_loc_event_cb_f_type;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function arguments
|
||||
*/
|
||||
|
||||
struct rpc_loc_open_args {
|
||||
rpc_loc_event_mask_type event_reg_mask;
|
||||
rpc_loc_event_cb_f_type event_callback;
|
||||
};
|
||||
|
||||
struct rpc_loc_close_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_start_fix_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_stop_fix_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
};
|
||||
|
||||
struct rpc_loc_ioctl_args {
|
||||
rpc_loc_client_handle_type handle;
|
||||
rpc_loc_ioctl_e_type ioctl_type;
|
||||
rpc_loc_ioctl_data_u_type *ioctl_data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct rpc_loc_api_api_version_s_args {
|
||||
rpc_boolean len_not_null;
|
||||
};
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function results
|
||||
*/
|
||||
|
||||
struct rpc_loc_api_rpc_glue_code_info_remote_rets {
|
||||
rpc_uint32 toolvers; /* Tool version */
|
||||
rpc_uint32 features; /* Features turned on in the code.
|
||||
* 0x00000001 ONCRPC Server Cleanup Support
|
||||
*/
|
||||
rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
|
||||
rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
|
||||
};
|
||||
|
||||
struct rpc_loc_open_rets {
|
||||
rpc_loc_client_handle_type loc_open_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_close_rets {
|
||||
rpc_int32 loc_close_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_start_fix_rets {
|
||||
rpc_int32 loc_start_fix_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_stop_fix_rets {
|
||||
rpc_int32 loc_stop_fix_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_ioctl_rets {
|
||||
rpc_int32 loc_ioctl_result;
|
||||
};
|
||||
|
||||
struct rpc_loc_api_api_versions_rets {
|
||||
rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
|
||||
rpc_uint32 *len;
|
||||
};
|
||||
|
||||
/*
|
||||
* XDR definition of the LOC_API program ( vers. 0x00050006 )
|
||||
*/
|
||||
|
||||
program LOC_APIPROG {
|
||||
version LOC_APIVERS_0001 {
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
rpc_loc_api_rpc_glue_code_info_remote_rets
|
||||
rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
|
||||
|
||||
rpc_loc_open_rets
|
||||
rpc_loc_open( rpc_loc_open_args ) = 2;
|
||||
|
||||
rpc_loc_close_rets
|
||||
rpc_loc_close( rpc_loc_close_args ) = 3;
|
||||
|
||||
rpc_loc_start_fix_rets
|
||||
rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
|
||||
|
||||
rpc_loc_stop_fix_rets
|
||||
rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
|
||||
|
||||
rpc_loc_ioctl_rets
|
||||
rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
|
||||
|
||||
rpc_loc_api_api_versions_rets
|
||||
rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
|
||||
|
||||
|
||||
|
||||
|
||||
} = 0x00050001;
|
||||
|
||||
version LOC_APIVERS_0002 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
|
||||
RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
|
||||
RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
|
||||
RPC_LOC_IOCTL_RESERVED_CMD
|
||||
RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050002;
|
||||
|
||||
version LOC_APIVERS_0003 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050003;
|
||||
|
||||
version LOC_APIVERS_0004 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
|
||||
RPC_LOC_IOCTL_GET_SUPL_VERSION
|
||||
RPC_LOC_IOCTL_SET_SUPL_VERSION
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050004;
|
||||
|
||||
version LOC_APIVERS_0005 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
|
||||
RPC_LOC_SERVER_ADDR_IPV6
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
|
||||
RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050005;
|
||||
|
||||
|
||||
|
||||
version LOC_APIVERS_0006 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
|
||||
RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
|
||||
RPC_LOC_SERVER_REQUEST_MULTI_OPEN
|
||||
*/
|
||||
|
||||
void
|
||||
rpc_loc_api_null( void ) = 0;
|
||||
|
||||
} = 0x00050006;
|
||||
|
||||
|
||||
} = 0x3000008C;
|
||||
|
||||
const LOC_APIVERS = 0x00050006;
|
||||
|
|
318
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
Executable file → Normal file
318
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
Executable file → Normal file
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -26,162 +26,162 @@
|
|||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/* LOC_API TOOL VERSION: 4.48 */
|
||||
/* GENERATED: TUE JUN 14 2011 */
|
||||
/*=============================================================================
|
||||
L O C _ A P I _ C B . X D R
|
||||
|
||||
GENERAL DESCRIPTION
|
||||
This is an AUTO GENERATED file that provides an xdr compatible definition of
|
||||
an api that represents the grouping of the different callback functions the
|
||||
loc_api API supports.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
/* LOC_API TOOL VERSION: 4.48 */
|
||||
/* GENERATED: TUE JUN 14 2011 */
|
||||
/*=============================================================================
|
||||
L O C _ A P I _ C B . X D R
|
||||
|
||||
GENERAL DESCRIPTION
|
||||
This is an AUTO GENERATED file that provides an xdr compatible definition of
|
||||
an api that represents the grouping of the different callback functions the
|
||||
loc_api API supports.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
=============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
AUTO GENERATED
|
||||
|
||||
Generated by following versions of Htorpc modules:
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
|
||||
|
||||
loc_api Definition File(s):
|
||||
Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
|
||||
=============================================================================*/
|
||||
/*=============================================================================
|
||||
$Header$
|
||||
=============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function arguments
|
||||
*/
|
||||
|
||||
struct rpc_loc_event_cb_f_type_args {
|
||||
rpc_uint32 cb_id;
|
||||
rpc_loc_client_handle_type loc_handle;
|
||||
rpc_loc_event_mask_type loc_event;
|
||||
rpc_loc_event_payload_u_type *loc_event_payload;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declaratios for the function results
|
||||
*/
|
||||
|
||||
struct rpc_loc_event_cb_f_type_rets {
|
||||
rpc_int32 loc_event_cb_f_type_result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* XDR definition of the LOC_API callback program ( vers. 0x00050006 )
|
||||
*/
|
||||
|
||||
program LOC_APICBPROG {
|
||||
version LOC_APICBVERS_0001 {
|
||||
|
||||
rpc_loc_event_cb_f_type_rets
|
||||
rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
} = 0x00050001;
|
||||
|
||||
version LOC_APICBVERS_0002 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
|
||||
RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
|
||||
RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
|
||||
RPC_LOC_IOCTL_RESERVED_CMD
|
||||
RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050002;
|
||||
|
||||
version LOC_APICBVERS_0003 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050003;
|
||||
|
||||
version LOC_APICBVERS_0004 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
|
||||
RPC_LOC_IOCTL_GET_SUPL_VERSION
|
||||
RPC_LOC_IOCTL_SET_SUPL_VERSION
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050004;
|
||||
|
||||
version LOC_APICBVERS_0005 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
|
||||
RPC_LOC_SERVER_ADDR_IPV6
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
|
||||
RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050005;
|
||||
|
||||
|
||||
|
||||
version LOC_APICBVERS_0006 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
|
||||
RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
|
||||
RPC_LOC_SERVER_REQUEST_MULTI_OPEN
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050006;
|
||||
|
||||
|
||||
} = 0x3100008C;
|
||||
|
||||
const LOC_APICBVERS = 0x00050006;
|
||||
---------------------------------------------------------------------------
|
||||
=============================================================================*/
|
||||
|
||||
/*=============================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
AUTO GENERATED
|
||||
|
||||
Generated by following versions of Htorpc modules:
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
|
||||
Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
|
||||
|
||||
loc_api Definition File(s):
|
||||
Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
|
||||
=============================================================================*/
|
||||
/*=============================================================================
|
||||
$Header$
|
||||
=============================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declarations for the function arguments
|
||||
*/
|
||||
|
||||
struct rpc_loc_event_cb_f_type_args {
|
||||
rpc_uint32 cb_id;
|
||||
rpc_loc_client_handle_type loc_handle;
|
||||
rpc_loc_event_mask_type loc_event;
|
||||
rpc_loc_event_payload_u_type *loc_event_payload;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* These are struct declaratios for the function results
|
||||
*/
|
||||
|
||||
struct rpc_loc_event_cb_f_type_rets {
|
||||
rpc_int32 loc_event_cb_f_type_result;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* XDR definition of the LOC_API callback program ( vers. 0x00050006 )
|
||||
*/
|
||||
|
||||
program LOC_APICBPROG {
|
||||
version LOC_APICBVERS_0001 {
|
||||
|
||||
rpc_loc_event_cb_f_type_rets
|
||||
rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
} = 0x00050001;
|
||||
|
||||
version LOC_APICBVERS_0002 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
|
||||
RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
|
||||
RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
|
||||
RPC_LOC_IOCTL_RESERVED_CMD
|
||||
RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050002;
|
||||
|
||||
version LOC_APICBVERS_0003 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
|
||||
RPC_LOC_IOCTL_SET_DATA_ENABLE
|
||||
RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
|
||||
RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
|
||||
RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050003;
|
||||
|
||||
version LOC_APICBVERS_0004 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
|
||||
RPC_LOC_IOCTL_GET_SUPL_VERSION
|
||||
RPC_LOC_IOCTL_SET_SUPL_VERSION
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050004;
|
||||
|
||||
version LOC_APICBVERS_0005 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
|
||||
RPC_LOC_SERVER_ADDR_IPV6
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
|
||||
RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050005;
|
||||
|
||||
|
||||
|
||||
version LOC_APICBVERS_0006 {
|
||||
|
||||
/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
|
||||
RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
|
||||
*/
|
||||
/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
|
||||
RPC_LOC_SERVER_REQUEST_MULTI_OPEN
|
||||
*/
|
||||
|
||||
int
|
||||
rpc_loc_api_cb_null( void ) = 0xffffff00;
|
||||
|
||||
} = 0x00050006;
|
||||
|
||||
|
||||
} = 0x3100008C;
|
||||
|
||||
const LOC_APICBVERS = 0x00050006;
|
||||
|
|
1986
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
Executable file → Normal file
1986
loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
Executable file → Normal file
File diff suppressed because it is too large
Load diff
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.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
Executable file → Normal file
0
loc_api/libloc_api-rpc/gen-1240/loc_api_common.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/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/Android.mk
Executable file → Normal file
0
loc_api/libloc_api/Android.mk
Executable file → Normal file
37
loc_api/libloc_api_50001/Android.mk
Executable file → Normal file
37
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 += msm8660
|
||||
BIT_ENABLED_BOARD_PLATFORM_LIST += msm8960
|
||||
ifeq ($(call is-board-platform-in-list,$(BIT_ENABLED_BOARD_PLATFORM_LIST)),true)
|
||||
FEATURE_GNSS_BIT_API := true
|
||||
endif # is-board-platform-in-list
|
||||
|
@ -29,6 +30,18 @@ LOCAL_CFLAGS += \
|
|||
-fno-short-enums \
|
||||
-D_ANDROID_
|
||||
|
||||
ifeq ($(FEATURE_IPV6), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_IPV6
|
||||
endif #FEATURE_IPV6
|
||||
|
||||
ifeq ($(FEATURE_DELEXT), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_DELEXT
|
||||
endif #FEATURE_DELEXT
|
||||
|
||||
ifeq ($(FEATURE_ULP), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_ULP
|
||||
endif #FEATURE_ULP
|
||||
|
||||
LOCAL_C_INCLUDES:= \
|
||||
$(TARGET_OUT_HEADERS)/gps.utils
|
||||
|
||||
|
@ -58,15 +71,15 @@ LOCAL_SHARED_LIBRARIES := \
|
|||
libutils \
|
||||
libcutils \
|
||||
libloc_adapter \
|
||||
libgps.utils \
|
||||
libdl
|
||||
libgps.utils
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
loc_eng.cpp \
|
||||
loc_eng_agps.cpp \
|
||||
loc_eng_xtra.cpp \
|
||||
loc_eng_ni.cpp \
|
||||
loc_eng_log.cpp
|
||||
loc_eng_log.cpp \
|
||||
loc_eng_nmea.cpp
|
||||
|
||||
ifeq ($(FEATURE_GNSS_BIT_API), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_GNSS_BIT_API
|
||||
|
@ -83,6 +96,14 @@ LOCAL_CFLAGS += \
|
|||
-fno-short-enums \
|
||||
-D_ANDROID_
|
||||
|
||||
ifeq ($(FEATURE_IPV6), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_IPV6
|
||||
endif #FEATURE_IPV6
|
||||
|
||||
ifeq ($(FEATURE_ULP), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_ULP
|
||||
endif #FEATURE_ULP
|
||||
|
||||
LOCAL_C_INCLUDES:= \
|
||||
$(TARGET_OUT_HEADERS)/gps.utils \
|
||||
hardware/qcom/gps/loc_api/ulp/inc
|
||||
|
@ -103,7 +124,8 @@ LOCAL_SHARED_LIBRARIES := \
|
|||
libutils \
|
||||
libcutils \
|
||||
libloc_eng \
|
||||
libgps.utils
|
||||
libgps.utils \
|
||||
libdl
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
loc.cpp \
|
||||
|
@ -113,9 +135,14 @@ LOCAL_CFLAGS += \
|
|||
-fno-short-enums \
|
||||
-D_ANDROID_ \
|
||||
|
||||
ifeq ($(FEATURE_IPV6), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_IPV6
|
||||
endif #FEATURE_IPV6
|
||||
|
||||
## 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_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -45,11 +45,17 @@ LocEng::LocEng(void* caller,
|
|||
gps_acquire_wakelock acqwl,
|
||||
gps_release_wakelock relwl,
|
||||
loc_msg_sender msgSender,
|
||||
#ifdef FEATURE_ULP
|
||||
loc_msg_sender msgUlpSender,
|
||||
#endif
|
||||
loc_ext_parser posParser,
|
||||
loc_ext_parser svParser) :
|
||||
owner(caller),
|
||||
eventMask(emask), acquireWakelock(acqwl),
|
||||
releaseWakeLock(relwl), sendMsge(msgSender),
|
||||
#ifdef FEATURE_ULP
|
||||
sendUlpMsg(msgUlpSender),
|
||||
#endif
|
||||
extPosInfo(NULL == posParser ? noProc : posParser),
|
||||
extSvInfo(NULL == svParser ? noProc : svParser)
|
||||
{
|
||||
|
@ -57,7 +63,7 @@ LocEng::LocEng(void* caller,
|
|||
}
|
||||
|
||||
LocApiAdapter::LocApiAdapter(LocEng &locEng) :
|
||||
locEngHandle(locEng)
|
||||
locEngHandle(locEng), fixCriteria(), navigating(false)
|
||||
{
|
||||
LOC_LOGD("LocApiAdapter created");
|
||||
}
|
||||
|
@ -75,21 +81,14 @@ LocApiAdapter* LocApiAdapter::getLocApiAdapter(LocEng &locEng)
|
|||
handle = dlopen ("libloc_api_v02.so", RTLD_NOW);
|
||||
|
||||
if (!handle) {
|
||||
LOC_LOGI("%s: dlopen(libloc_api_v02.so) failed, trying to load libloc_api-rpc-qc.so", __FUNCTION__);
|
||||
handle = dlopen ("libloc_api-rpc-qc.so", RTLD_NOW);
|
||||
}
|
||||
else
|
||||
LOC_LOGE("%s: dlopen(libloc_api_v02.so) succeeded.", __FUNCTION__);
|
||||
|
||||
if (!handle) {
|
||||
LOC_LOGI("%s: dlopen(libloc_api-rpc-qc.so) failed, constructing LocApiAdapter", __FUNCTION__);
|
||||
adapter = new LocApiAdapter(locEng);
|
||||
} else {
|
||||
getLocApiAdapter_t* getHandle = (getLocApiAdapter_t*)dlsym(handle, "getLocApiAdapter");
|
||||
if (!getHandle) {
|
||||
LOC_LOGE("%s: dlsym(getLocApiAdapter) failed", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
adapter = (*getHandle)(locEng);
|
||||
}
|
||||
|
||||
|
@ -142,20 +141,43 @@ int LocApiAdapter::decodeAddress(char *addr_string, int string_size,
|
|||
}
|
||||
|
||||
void LocApiAdapter::reportPosition(GpsLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status)
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask )
|
||||
{
|
||||
loc_eng_msg_report_position *msg(new loc_eng_msg_report_position(locEngHandle.owner,
|
||||
location,
|
||||
locationExtended,
|
||||
locationExt,
|
||||
status));
|
||||
status,
|
||||
loc_technology_mask));
|
||||
#ifdef FEATURE_ULP
|
||||
if (locEngHandle.sendUlpMsg) {
|
||||
locEngHandle.sendUlpMsg(locEngHandle.owner, msg);
|
||||
} else {
|
||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||
}
|
||||
#else
|
||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LocApiAdapter::reportSv(GpsSvStatus &svStatus, void* svExt)
|
||||
void LocApiAdapter::reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, 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, locationExtended, svExt));
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
//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);
|
||||
}
|
||||
#else
|
||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LocApiAdapter::reportStatus(GpsStatusValue status)
|
||||
|
@ -192,9 +214,9 @@ void LocApiAdapter::requestXtraData()
|
|||
|
||||
void LocApiAdapter::requestTime()
|
||||
{
|
||||
LOC_LOGD("loc_event_cb: XTRA time download request... not supported");
|
||||
// loc_eng_msg *msg(new loc_eng_msg(locEngHandle.owner, LOC_ENG_MSG_REQUEST_TIME));
|
||||
// locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||
LOC_LOGD("loc_event_cb: XTRA time download request");
|
||||
loc_eng_msg *msg(new loc_eng_msg(locEngHandle.owner, LOC_ENG_MSG_REQUEST_TIME));
|
||||
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||
}
|
||||
|
||||
void LocApiAdapter::requestLocation()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -32,9 +32,13 @@
|
|||
#include <ctype.h>
|
||||
#include <hardware/gps.h>
|
||||
#include <loc.h>
|
||||
#include <loc_eng_log.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 {
|
||||
LOC_API_ADAPTER_ERR_SUCCESS = 0,
|
||||
|
@ -85,6 +89,9 @@ struct LocEng {
|
|||
const gps_acquire_wakelock acquireWakelock;
|
||||
const gps_release_wakelock releaseWakeLock;
|
||||
const loc_msg_sender sendMsge;
|
||||
#ifdef FEATURE_ULP
|
||||
const loc_msg_sender sendUlpMsg;
|
||||
#endif
|
||||
const loc_ext_parser extPosInfo;
|
||||
const loc_ext_parser extSvInfo;
|
||||
|
||||
|
@ -93,6 +100,9 @@ struct LocEng {
|
|||
gps_acquire_wakelock acqwl,
|
||||
gps_release_wakelock relwl,
|
||||
loc_msg_sender msgSender,
|
||||
#ifdef FEATURE_ULP
|
||||
loc_msg_sender msgUlpSender,
|
||||
#endif
|
||||
loc_ext_parser posParser,
|
||||
loc_ext_parser svParser);
|
||||
};
|
||||
|
@ -100,6 +110,8 @@ struct LocEng {
|
|||
class LocApiAdapter {
|
||||
protected:
|
||||
const LocEng locEngHandle;
|
||||
LocPosMode fixCriteria;
|
||||
bool navigating;
|
||||
|
||||
LocApiAdapter(LocEng &locEng);
|
||||
|
||||
|
@ -115,9 +127,13 @@ public:
|
|||
const char *data, int data_size);
|
||||
|
||||
void reportPosition(GpsLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* locationExt,
|
||||
enum loc_sess_status status);
|
||||
void reportSv(GpsSvStatus &svStatus, void* svExt);
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT);
|
||||
void reportSv(GpsSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
void reportStatus(GpsStatusValue status);
|
||||
void reportNmea(const char* nmea, int length);
|
||||
void reportAgpsStatus(AGpsStatus &agpsStatus);
|
||||
|
@ -159,7 +175,7 @@ public:
|
|||
inline virtual enum loc_api_adapter_err
|
||||
setXtraData(char* data, int length)
|
||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
inline virtual enum loc_api_adapter_err
|
||||
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;}
|
||||
|
@ -172,9 +188,7 @@ public:
|
|||
atlCloseStatus(int handle, int is_succ)
|
||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||
inline virtual enum loc_api_adapter_err
|
||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time)
|
||||
setPositionMode(const LocPosMode *posMode)
|
||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||
inline virtual enum loc_api_adapter_err
|
||||
setServer(const char* url, int len)
|
||||
|
@ -189,16 +203,37 @@ public:
|
|||
inline virtual enum loc_api_adapter_err
|
||||
setSUPLVersion(uint32_t version)
|
||||
{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
|
||||
setSensorControlConfig(int sensorUsage)
|
||||
{LOC_LOGW("%s: default implementation invoked", __func__); return LOC_API_ADAPTER_ERR_SUCCESS;}
|
||||
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;}
|
||||
inline virtual enum loc_api_adapter_err
|
||||
setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec)
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
|
||||
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
|
||||
{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 virtual enum loc_api_adapter_err
|
||||
setAGLONASSProtocol(unsigned long aGlonassProtocol)
|
||||
{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; }
|
||||
};
|
||||
|
||||
extern "C" LocApiAdapter* getLocApiAdapter(LocEng &locEng);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -33,7 +33,21 @@
|
|||
#include <hardware/gps.h>
|
||||
#include <loc_eng.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>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
//Globals defns
|
||||
static const ulpInterface * loc_eng_ulp_inf = NULL;
|
||||
static const ulpInterface * loc_eng_get_ulp_inf(void);
|
||||
#endif
|
||||
static gps_location_callback gps_loc_cb = NULL;
|
||||
static gps_sv_status_callback gps_sv_cb = NULL;
|
||||
|
||||
|
@ -52,8 +66,14 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re
|
|||
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time);
|
||||
static const void* loc_get_extension(const char* name);
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
static int loc_update_criteria(UlpLocationCriteria criteria);
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
//ULP/Hybrid provider Function definitions
|
||||
static int loc_update_criteria(UlpLocationCriteria criteria);
|
||||
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);
|
||||
#endif
|
||||
|
||||
// Defines the GpsInterface in gps.h
|
||||
|
@ -69,14 +89,14 @@ static const GpsInterface sLocEngInterface =
|
|||
loc_delete_aiding_data,
|
||||
loc_set_position_mode,
|
||||
loc_get_extension
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
,loc_update_criteria
|
||||
#endif
|
||||
};
|
||||
|
||||
// Function declarations for sLocEngAGpsInterface
|
||||
static void loc_agps_init(AGpsCallbacks* callbacks);
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
static int loc_agps_open(AGpsType agpsType,
|
||||
const char* apn, AGpsBearerType bearerType);
|
||||
static int loc_agps_closed(AGpsType agpsType);
|
||||
|
@ -136,7 +156,7 @@ static const AGpsRilInterface sLocEngAGpsRilInterface =
|
|||
loc_agps_ril_update_network_availability
|
||||
};
|
||||
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
static bool loc_inject_raw_command(char* command, int length);
|
||||
|
||||
static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
|
||||
|
@ -144,9 +164,82 @@ static const InjectRawCmdInterface sLocEngInjectRawCmdInterface =
|
|||
sizeof(InjectRawCmdInterface),
|
||||
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
|
||||
};
|
||||
#endif
|
||||
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")) || !strncmp(line, "153", strlen("153"))) {
|
||||
target_name = TARGET_NAME_APQ8064_STANDALONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return target_name;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION gps_get_hardware_interface
|
||||
|
@ -189,8 +282,39 @@ const GpsInterface* gps_get_hardware_interface ()
|
|||
// for gps.c
|
||||
extern "C" const GpsInterface* get_gps_interface()
|
||||
{
|
||||
loc_eng_read_config();
|
||||
#ifdef FEATURE_ULP
|
||||
//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();
|
||||
}
|
||||
#endif
|
||||
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));
|
||||
}
|
||||
LOC_LOGD("GSS open success! CAPABILITIES %0x\n", gps_conf.CAPABILITIES);
|
||||
}
|
||||
|
||||
return &sLocEngInterface;
|
||||
}
|
||||
|
||||
static void loc_free_msg(void* msg)
|
||||
{
|
||||
delete (loc_eng_msg*)msg;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_init
|
||||
|
||||
|
@ -210,7 +334,13 @@ SIDE EFFECTS
|
|||
===========================================================================*/
|
||||
static int loc_init(GpsCallbacks* callbacks)
|
||||
{
|
||||
int retVal = -1;
|
||||
ENTRY_LOG();
|
||||
if(callbacks == NULL) {
|
||||
LOC_LOGE("loc_init failed. cb = NULL\n");
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
}
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event =
|
||||
LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
|
||||
LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
|
||||
|
@ -229,14 +359,28 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
callbacks->release_wakelock_cb, /* release_wakelock_cb */
|
||||
callbacks->create_thread_cb, /* create_thread_cb */
|
||||
NULL, /* location_ext_parser */
|
||||
NULL /* sv_ext_parser */};
|
||||
NULL, /* sv_ext_parser */
|
||||
callbacks->request_utc_time_cb /* request_utc_time_cb */};
|
||||
gps_loc_cb = callbacks->location_cb;
|
||||
gps_sv_cb = callbacks->sv_status_cb;
|
||||
|
||||
int ret_val = loc_eng_init(loc_afw_data, &clientCallbacks, event);
|
||||
#ifdef FEATURE_ULP
|
||||
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);
|
||||
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
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);
|
||||
#else
|
||||
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
EXIT_LOG(%d, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
@ -261,6 +405,15 @@ static void loc_cleanup()
|
|||
loc_eng_cleanup(loc_afw_data);
|
||||
gps_loc_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);
|
||||
}
|
||||
|
||||
|
@ -349,9 +502,10 @@ static int loc_set_position_mode(GpsPositionMode mode,
|
|||
locMode = LOC_POSITION_MODE_STANDALONE;
|
||||
break;
|
||||
}
|
||||
int ret_val = loc_eng_set_position_mode(loc_afw_data, locMode,
|
||||
recurrence, min_interval,
|
||||
preferred_accuracy, preferred_time);
|
||||
|
||||
LocPosMode params(locMode, recurrence, min_interval,
|
||||
preferred_accuracy, preferred_time, NULL, NULL);
|
||||
int ret_val = loc_eng_set_position_mode(loc_afw_data, params);
|
||||
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
|
@ -377,7 +531,6 @@ static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertain
|
|||
{
|
||||
ENTRY_LOG();
|
||||
int ret_val = loc_eng_inject_time(loc_afw_data, time, timeReference, uncertainty);
|
||||
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -401,9 +554,32 @@ SIDE EFFECTS
|
|||
===========================================================================*/
|
||||
static int loc_inject_location(double latitude, double longitude, float accuracy)
|
||||
{
|
||||
static bool initialized = false;
|
||||
static bool enable_cpi = true;
|
||||
ENTRY_LOG();
|
||||
int ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
|
||||
|
||||
if(!initialized)
|
||||
{
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
memset(value, 0, sizeof(value));
|
||||
(void)property_get("persist.gps.qc_nlp_in_use", value, "0");
|
||||
if(0 == strcmp(value, "1"))
|
||||
{
|
||||
enable_cpi = false;
|
||||
LOC_LOGI("GPS HAL coarse position injection disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOC_LOGI("GPS HAL coarse position injection enabled");
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
int ret_val = 0;
|
||||
if(enable_cpi)
|
||||
{
|
||||
ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
|
||||
}
|
||||
EXIT_LOG(%d, ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -437,7 +613,7 @@ static void loc_delete_aiding_data(GpsAidingData f)
|
|||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
/*===========================================================================
|
||||
FUNCTION loc_update_criteria
|
||||
|
||||
|
@ -502,19 +678,34 @@ static const void* loc_get_extension(const char* name)
|
|||
|
||||
else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
|
||||
{
|
||||
ret_val = &sLocEngAGpsRilInterface;
|
||||
char baseband[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.baseband", baseband, "msm");
|
||||
if (strcmp(baseband, "csfb") == 0)
|
||||
{
|
||||
ret_val = &sLocEngAGpsRilInterface;
|
||||
}
|
||||
}
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
else if (strcmp(name, ULP_RAW_CMD_INTERFACE) == 0)
|
||||
{
|
||||
ret_val = &sLocEngInjectRawCmdInterface;
|
||||
}
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
LOC_LOGE ("get_extension: Invalid interface passed in\n");
|
||||
}
|
||||
|
||||
EXIT_LOG(%p, ret_val);
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -559,7 +750,7 @@ SIDE EFFECTS
|
|||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
static int loc_agps_open(AGpsType agpsType,
|
||||
const char* apn, AGpsBearerType bearerType)
|
||||
{
|
||||
|
@ -597,7 +788,7 @@ SIDE EFFECTS
|
|||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
static int loc_agps_closed(AGpsType agpsType)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
@ -634,7 +825,7 @@ SIDE EFFECTS
|
|||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
int loc_agps_open_failed(AGpsType agpsType)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
@ -818,7 +1009,7 @@ static void loc_agps_ril_update_network_availability(int available, const char*
|
|||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
/*===========================================================================
|
||||
FUNCTION loc_inject_raw_command
|
||||
|
||||
|
@ -844,12 +1035,11 @@ static bool loc_inject_raw_command(char* command, int length)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void loc_cb(GpsLocation* location, void* locExt)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
if (NULL != gps_loc_cb && NULL != location) {
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
|
||||
#else
|
||||
CALLBACK_LOG_CALLFLOW("location_cb - at", %llu, location->timestamp);
|
||||
|
@ -868,3 +1058,159 @@ static void sv_cb(GpsSvStatus* sv_status, void* svExt)
|
|||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
/*===========================================================================
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -38,6 +38,8 @@ extern "C" {
|
|||
#include <cutils/properties.h>
|
||||
#include <hardware/gps.h>
|
||||
|
||||
#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
|
||||
|
||||
typedef enum loc_server_type {
|
||||
LOC_AGPS_CDMA_PDE_SERVER,
|
||||
LOC_AGPS_CUSTOM_PDE_SERVER,
|
||||
|
@ -52,7 +54,8 @@ typedef enum loc_position_mode_type {
|
|||
LOC_POSITION_MODE_RESERVED_1,
|
||||
LOC_POSITION_MODE_RESERVED_2,
|
||||
LOC_POSITION_MODE_RESERVED_3,
|
||||
LOC_POSITION_MODE_RESERVED_4
|
||||
LOC_POSITION_MODE_RESERVED_4,
|
||||
LOC_POSITION_MODE_RESERVED_5
|
||||
} LocPositionMode;
|
||||
|
||||
typedef void (*loc_location_cb_ext) (GpsLocation* location, void* locExt);
|
||||
|
@ -70,6 +73,7 @@ typedef struct {
|
|||
gps_create_thread create_thread_cb;
|
||||
loc_ext_parser location_ext_parser;
|
||||
loc_ext_parser sv_ext_parser;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
} LocCallbacks;
|
||||
|
||||
enum loc_sess_status {
|
||||
|
@ -78,6 +82,18 @@ enum loc_sess_status {
|
|||
LOC_SESS_FAILURE
|
||||
};
|
||||
|
||||
typedef uint32_t LocPosTechMask;
|
||||
#define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000)
|
||||
#define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001)
|
||||
#define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002)
|
||||
#define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004)
|
||||
#define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008)
|
||||
#define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010)
|
||||
#define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020)
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
void loc_ulp_msg_sender(void* loc_eng_data_p, void* msg);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
|
||||
// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
|
||||
#define MAX_NUM_ATL_CONNECTIONS 2
|
||||
|
||||
// Define boolean type to be used by libgps on loc api module
|
||||
typedef unsigned char boolean;
|
||||
|
||||
|
@ -67,9 +68,10 @@ typedef unsigned char boolean;
|
|||
#define FAILURE FALSE
|
||||
#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_nmea_provider_e_type {
|
||||
NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
|
||||
NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
|
||||
};
|
||||
|
||||
enum loc_mute_session_e_type {
|
||||
LOC_MUTE_SESS_NONE = 0,
|
||||
|
@ -77,6 +79,23 @@ enum loc_mute_session_e_type {
|
|||
LOC_MUTE_SESS_IN_SESSION
|
||||
};
|
||||
|
||||
struct LocEngContext {
|
||||
// Data variables used by deferred action thread
|
||||
const void* deferred_q;
|
||||
#ifdef FEATURE_ULP
|
||||
const void* ulp_q;
|
||||
#endif
|
||||
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
|
||||
typedef struct
|
||||
{
|
||||
|
@ -89,6 +108,11 @@ typedef struct
|
|||
gps_ni_notify_callback ni_notify_cb;
|
||||
gps_acquire_wakelock acquire_wakelock_cb;
|
||||
gps_release_wakelock release_wakelock_cb;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
#ifdef FEATURE_ULP
|
||||
ulp_network_location_request ulp_network_callback;
|
||||
ulp_request_phone_context ulp_phone_context_req_cb;
|
||||
#endif
|
||||
boolean intermediateFix;
|
||||
AGpsStatusValue agps_status;
|
||||
// used to defer stopping the GPS engine until AGPS data calls are done
|
||||
|
@ -97,11 +121,12 @@ typedef struct
|
|||
loc_eng_xtra_data_s_type xtra_module_data;
|
||||
loc_eng_ni_data_s_type loc_eng_ni_data;
|
||||
|
||||
boolean navigating;
|
||||
|
||||
// AGPS state machines
|
||||
AgpsStateMachine* agnss_nif;
|
||||
#ifdef FEATURE_IPV6
|
||||
AgpsStateMachine* internet_nif;
|
||||
AgpsStateMachine* wifi_nif;
|
||||
#endif
|
||||
|
||||
// GPS engine status
|
||||
GpsStatusValue engine_status;
|
||||
|
@ -112,11 +137,16 @@ typedef struct
|
|||
|
||||
void* context;
|
||||
|
||||
loc_eng_msg_position_mode position_mode;
|
||||
|
||||
// For muting session broadcast
|
||||
loc_mute_session_e_type mute_session_state;
|
||||
|
||||
// For nmea generation
|
||||
boolean generateNmea;
|
||||
uint32_t sv_used_mask;
|
||||
float hdop;
|
||||
float pdop;
|
||||
float vdop;
|
||||
|
||||
// Address buffers, for addressing setting before init
|
||||
int supl_host_set;
|
||||
char supl_host_buf[101];
|
||||
|
@ -127,12 +157,59 @@ typedef struct
|
|||
int mpc_host_set;
|
||||
char mpc_host_buf[101];
|
||||
int mpc_port_buf;
|
||||
#ifdef FEATURE_ULP
|
||||
bool ulp_initialized;
|
||||
#endif
|
||||
} loc_eng_data_s_type;
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
#include "ulp.h"
|
||||
#endif
|
||||
|
||||
/* GPS.conf support */
|
||||
typedef struct loc_gps_cfg_s
|
||||
{
|
||||
unsigned long INTERMEDIATE_POS;
|
||||
unsigned long ACCURACY_THRES;
|
||||
unsigned long ENABLE_WIPER;
|
||||
uint8_t NMEA_PROVIDER;
|
||||
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_ACCEL_BATCHES_PER_SEC_HIGH;
|
||||
unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
|
||||
unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
|
||||
unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
|
||||
unsigned long SENSOR_CONTROL_MODE;
|
||||
unsigned long SENSOR_USAGE;
|
||||
unsigned long QUIPC_ENABLED;
|
||||
unsigned long LPP_PROFILE;
|
||||
unsigned long SENSOR_ALGORITHM_CONFIG_MASK;
|
||||
unsigned long A_GLONASS_POS_PROTOCOL_SELECT;
|
||||
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,
|
||||
LocCallbacks* callbacks,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event);
|
||||
LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
void (*loc_external_msg_sender) (void*, void*));
|
||||
#ifdef FEATURE_ULP
|
||||
int loc_eng_ulp_init(loc_eng_data_s_type &loc_eng_data, const ulpInterface * loc_eng_ulpInf);
|
||||
#endif
|
||||
int loc_eng_start(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);
|
||||
|
@ -145,19 +222,17 @@ 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,
|
||||
GpsAidingData f);
|
||||
int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
|
||||
LocPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time);
|
||||
LocPosMode ¶ms);
|
||||
const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
|
||||
const char* name);
|
||||
#ifdef QCOM_FEATURE_ULP
|
||||
#ifdef FEATURE_ULP
|
||||
int loc_eng_update_criteria(loc_eng_data_s_type &loc_eng_data,
|
||||
UlpLocationCriteria criteria);
|
||||
#endif
|
||||
|
||||
void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
|
||||
AGpsCallbacks* callbacks);
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType,
|
||||
const char* apn, AGpsBearerType bearerType);
|
||||
int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsType agpsType);
|
||||
|
@ -196,7 +271,17 @@ extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
|
|||
const GpsNiNotification *notif,
|
||||
const void* passThrough);
|
||||
extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
|
||||
#ifdef FEATURE_ULP
|
||||
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);
|
||||
#endif
|
||||
int loc_eng_read_config(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ const int Notification::BROADCAST_INACTIVE = 0x80000002;
|
|||
|
||||
|
||||
//======================================================================
|
||||
// Subscriber: BITSubscriber / ATLSubscriber
|
||||
// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
|
||||
//======================================================================
|
||||
bool Subscriber::forMe(Notification ¬ification)
|
||||
{
|
||||
|
@ -120,14 +120,17 @@ bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
|
|||
case RSRC_UNSUBSCRIBE:
|
||||
case RSRC_RELEASED:
|
||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||
GPSONE_LOC_API_IF_RELEASE_SUCCESS);
|
||||
break;
|
||||
case RSRC_DENIED:
|
||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||
GPSONE_LOC_API_IF_FAILURE);
|
||||
break;
|
||||
case RSRC_GRANTED:
|
||||
loc_eng_dmn_conn_loc_api_server_data_conn(
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||
GPSONE_LOC_API_IF_REQUEST_SUCCESS);
|
||||
break;
|
||||
default:
|
||||
|
@ -150,20 +153,38 @@ bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
|
|||
((LocApiAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
|
||||
break;
|
||||
case RSRC_DENIED:
|
||||
{
|
||||
#ifdef FEATURE_IPV6
|
||||
AGpsType type = mBackwardCompatibleMode ?
|
||||
AGPS_TYPE_INVALID : mStateMachine->getType();
|
||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
|
||||
(char*)mStateMachine->getAPN(),
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
mStateMachine->getBearer(),
|
||||
type);
|
||||
#else
|
||||
AGpsType type = mStateMachine->getType();
|
||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
|
||||
(char*)mStateMachine->getAPN(),
|
||||
type);
|
||||
#endif
|
||||
mStateMachine->getType());
|
||||
}
|
||||
break;
|
||||
case RSRC_GRANTED:
|
||||
{
|
||||
#ifdef FEATURE_IPV6
|
||||
AGpsType type = mBackwardCompatibleMode ?
|
||||
AGPS_TYPE_INVALID : mStateMachine->getType();
|
||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
|
||||
(char*)mStateMachine->getAPN(),
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
mStateMachine->getBearer(),
|
||||
type);
|
||||
#else
|
||||
AGpsType type = mStateMachine->getType();
|
||||
((LocApiAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
|
||||
(char*)mStateMachine->getAPN(),
|
||||
type);
|
||||
#endif
|
||||
mStateMachine->getType());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
notify = false;
|
||||
|
@ -173,6 +194,39 @@ bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
|
|||
return notify;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
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;
|
||||
default:
|
||||
notify = false;
|
||||
}
|
||||
}
|
||||
|
||||
return notify;
|
||||
}
|
||||
#endif
|
||||
|
||||
//======================================================================
|
||||
// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
|
||||
|
@ -276,23 +330,25 @@ AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
|||
Subscriber* subscriber = (Subscriber*) data;
|
||||
if (subscriber->waitForCloseComplete()) {
|
||||
subscriber->setInactive();
|
||||
if (!mStateMachine->hasActiveSubscribers()) {
|
||||
// no more subscribers, move to RELEASED state
|
||||
nextState = mReleasingState;
|
||||
}
|
||||
} else {
|
||||
// auto notify this subscriber of the unsubscribe
|
||||
Notification notification(subscriber, event, true);
|
||||
mStateMachine->notifySubscribers(notification);
|
||||
}
|
||||
|
||||
// now check if there is any subscribers left
|
||||
if (!mStateMachine->hasSubscribers()) {
|
||||
// no more subscribers, move to RELEASED state
|
||||
nextState = mReleasedState;
|
||||
// now check if there is any subscribers left
|
||||
if (!mStateMachine->hasSubscribers()) {
|
||||
// no more subscribers, move to RELEASED state
|
||||
nextState = mReleasedState;
|
||||
|
||||
// tell connecivity service we can release NIF
|
||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||
}
|
||||
// tell connecivity service we can release NIF
|
||||
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;
|
||||
|
@ -381,13 +437,13 @@ AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
|||
// now check if there is any subscribers left
|
||||
if (!mStateMachine->hasSubscribers()) {
|
||||
// no more subscribers, move to RELEASED state
|
||||
nextState = mReleasingState;
|
||||
nextState = mReleasedState;
|
||||
|
||||
// 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
|
||||
nextState = mReleasedState;
|
||||
// only inactive subscribers, move to RELEASING state
|
||||
nextState = mReleasingState;
|
||||
|
||||
// tell connecivity service we can release NIF
|
||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||
|
@ -469,21 +525,14 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
|||
|
||||
// now check if there is any subscribers left
|
||||
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
|
||||
nextState = mReleasedState;
|
||||
|
||||
// tell connecivity service we can release NIF
|
||||
mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RSRC_DENIED:
|
||||
// A race condition subscriber unsubscribes before AFW denies resource.
|
||||
case RSRC_RELEASED:
|
||||
{
|
||||
nextState = mAcquiredState;
|
||||
|
@ -503,7 +552,6 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
|||
break;
|
||||
|
||||
case RSRC_GRANTED:
|
||||
case RSRC_DENIED:
|
||||
default:
|
||||
LOC_LOGE("%s: unrecognized event %d", whoami(), event);
|
||||
// no state change.
|
||||
|
@ -520,11 +568,13 @@ AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
|
|||
//======================================================================
|
||||
|
||||
AgpsStateMachine::AgpsStateMachine(void (*servicer)(AGpsStatus* status),
|
||||
AGpsType type) :
|
||||
AGpsType type,
|
||||
bool enforceSingleSubscriber) :
|
||||
mServicer(servicer), mType(type),
|
||||
mStatePtr(new AgpsReleasedState(this)),
|
||||
mAPN(NULL),
|
||||
mAPNLen(0)
|
||||
mAPNLen(0),
|
||||
mEnforceSingleSubscriber(enforceSingleSubscriber)
|
||||
{
|
||||
linked_list_init(&mSubscribers);
|
||||
|
||||
|
@ -643,7 +693,7 @@ void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
|
|||
void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
||||
{
|
||||
Subscriber* s = NULL;
|
||||
Notification notification(Notification::BROADCAST_ALL);
|
||||
Notification notification(Notification::BROADCAST_ACTIVE);
|
||||
linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
|
||||
(void*)¬ification, false);
|
||||
|
||||
|
@ -653,12 +703,15 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
|||
nifRequest.type = mType;
|
||||
nifRequest.status = action;
|
||||
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
if (s == NULL) {
|
||||
nifRequest.ipv4_addr = INADDR_NONE;
|
||||
nifRequest.ipv6_addr[0] = 0;
|
||||
nifRequest.ssid[0] = '\0';
|
||||
nifRequest.password[0] = '\0';
|
||||
} else {
|
||||
s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr);
|
||||
s->setWifiInfo(nifRequest.ssid, nifRequest.password);
|
||||
}
|
||||
#else
|
||||
if (s == NULL) {
|
||||
|
@ -675,7 +728,12 @@ void AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
|
|||
|
||||
void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
|
||||
{
|
||||
mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
|
||||
if (mEnforceSingleSubscriber && hasSubscribers()) {
|
||||
Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
|
||||
notifySubscriber(¬ification, subscriber);
|
||||
} else {
|
||||
mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include <hardware/gps.h>
|
||||
#include <linked_list.h>
|
||||
#include <LocApiAdapter.h>
|
||||
#include "loc_eng_msg.h"
|
||||
|
||||
// forward declaration
|
||||
class AgpsStateMachine;
|
||||
|
@ -149,20 +150,21 @@ class AgpsStateMachine {
|
|||
char* mAPN;
|
||||
// for convenience, we don't do strlen each time.
|
||||
unsigned int mAPNLen;
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
// bear
|
||||
AGpsBearerType mBearer;
|
||||
#endif
|
||||
// ipv4 address for routing
|
||||
bool mEnforceSingleSubscriber;
|
||||
|
||||
public:
|
||||
AgpsStateMachine(void (*servicer)(AGpsStatus* status), AGpsType type);
|
||||
AgpsStateMachine(void (*servicer)(AGpsStatus* status), AGpsType type, bool enforceSingleSubscriber);
|
||||
virtual ~AgpsStateMachine();
|
||||
|
||||
// self explanatory methods below
|
||||
void setAPN(const char* apn, unsigned int len);
|
||||
inline const char* getAPN() const { return (const char*)mAPN; }
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
|
||||
inline AGpsBearerType getBearer() const { return mBearer; }
|
||||
#endif
|
||||
|
@ -198,14 +200,16 @@ public:
|
|||
// multiple clients from modem. In the case of BIT, there is only one
|
||||
// cilent from BIT daemon.
|
||||
struct Subscriber {
|
||||
const int ID;
|
||||
const uint32_t ID;
|
||||
const AgpsStateMachine* mStateMachine;
|
||||
inline Subscriber(const int id,
|
||||
const AgpsStateMachine* stateMachine) :
|
||||
ID(id), mStateMachine(stateMachine) {}
|
||||
inline virtual ~Subscriber() {}
|
||||
|
||||
virtual void setIPAddresses(int &v4, char* v6) = 0;
|
||||
virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
|
||||
inline virtual void setWifiInfo(char* ssid, char* password)
|
||||
{ ssid[0] = 0; password[0] = 0; }
|
||||
|
||||
inline virtual bool equals(const Subscriber *s) const
|
||||
{ return ID == s->ID; }
|
||||
|
@ -239,7 +243,7 @@ struct BITSubscriber : public Subscriber {
|
|||
|
||||
virtual bool notifyRsrcStatus(Notification ¬ification);
|
||||
|
||||
inline virtual void setIPAddresses(int &v4, char* v6)
|
||||
inline virtual void setIPAddresses(uint32_t &v4, char* v6)
|
||||
{ v4 = ID; memcpy(v6, ipv6Addr, sizeof(ipv6Addr)); }
|
||||
|
||||
virtual Subscriber* clone()
|
||||
|
@ -256,19 +260,72 @@ private:
|
|||
// ATLSubscriber, created with requests from ATL
|
||||
struct ATLSubscriber : public Subscriber {
|
||||
const LocApiAdapter* mLocAdapter;
|
||||
const bool mBackwardCompatibleMode;
|
||||
inline ATLSubscriber(const int id,
|
||||
const AgpsStateMachine* stateMachine,
|
||||
const LocApiAdapter* adapter) :
|
||||
Subscriber(id, stateMachine), mLocAdapter(adapter) {}
|
||||
const LocApiAdapter* adapter,
|
||||
const bool compatibleMode) :
|
||||
Subscriber(id, stateMachine), mLocAdapter(adapter),
|
||||
mBackwardCompatibleMode(compatibleMode){}
|
||||
virtual bool notifyRsrcStatus(Notification ¬ification);
|
||||
|
||||
inline virtual void setIPAddresses(int &v4, char* v6)
|
||||
inline virtual void setIPAddresses(uint32_t &v4, char* v6)
|
||||
{ v4 = INADDR_NONE; v6[0] = 0; }
|
||||
|
||||
inline virtual Subscriber* clone()
|
||||
{
|
||||
return new ATLSubscriber(ID, mStateMachine, mLocAdapter);
|
||||
return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
|
||||
mBackwardCompatibleMode);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
// 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(uint32_t &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);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif //__LOC_ENG_AGPS_H__
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -33,24 +33,78 @@
|
|||
#include <fcntl.h>
|
||||
#include <linux/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "log_util.h"
|
||||
|
||||
#include "loc_eng_dmn_conn_glue_msg.h"
|
||||
#include "loc_eng_dmn_conn_handler.h"
|
||||
#include "loc_eng_dmn_conn.h"
|
||||
#include "loc_eng_msg.h"
|
||||
|
||||
static int loc_api_server_msgqid;
|
||||
static int loc_api_resp_msgqid;
|
||||
static int quipc_msgqid;
|
||||
static int msapm_msgqid;
|
||||
static int msapu_msgqid;
|
||||
|
||||
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_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
|
||||
static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
|
||||
static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
|
||||
|
||||
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);
|
||||
//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, pipe %s, gid = %d, result = %d, error = %s\n",
|
||||
global_loc_api_q_path, 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);
|
||||
|
||||
//change mode/group for the global_loc_api_resp_q_path pipe
|
||||
result = chmod (global_loc_api_resp_q_path, 0660);
|
||||
if (result != 0)
|
||||
{
|
||||
LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
|
||||
}
|
||||
|
||||
if (gps_group != NULL)
|
||||
{
|
||||
result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
|
||||
if (result != 0)
|
||||
{
|
||||
LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
|
||||
global_loc_api_resp_q_path,
|
||||
gps_group->gr_gid, result, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
|
||||
|
||||
LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
|
||||
return 0;
|
||||
}
|
||||
|
@ -80,6 +134,7 @@ static int loc_api_server_proc(void *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);
|
||||
if (length <= 0) {
|
||||
free(p_cmsgbuf);
|
||||
LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
|
||||
usleep(1000);
|
||||
return 0;
|
||||
|
@ -114,6 +169,9 @@ static int loc_api_server_proc_post(void *context)
|
|||
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_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);
|
||||
loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -165,16 +223,48 @@ int loc_eng_dmn_conn_loc_api_server_join(void)
|
|||
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;
|
||||
LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
|
||||
cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
|
||||
cmsgbuf.cmsg.cmsg_response.result = status;
|
||||
LOC_LOGD("%s:%d] status = %d",__func__, __LINE__, status);
|
||||
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__);
|
||||
return -1;
|
||||
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_MSAPU: {
|
||||
LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
|
||||
if (loc_eng_dmn_conn_glue_msgsnd(msapu_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) {
|
||||
LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -35,11 +35,17 @@
|
|||
|
||||
#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 QUIPC_CTRL_Q_PATH "/data/misc/gpsone_d/quipc_ctrl_q"
|
||||
#define MSAPM_CTRL_Q_PATH "/data/misc/gpsone_d/msapm_ctrl_q"
|
||||
#define MSAPU_CTRL_Q_PATH "/data/misc/gpsone_d/msapu_ctrl_q"
|
||||
|
||||
#else
|
||||
|
||||
#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 QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
|
||||
#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
|
||||
#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -47,7 +53,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);
|
||||
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_data_conn(int);
|
||||
int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
|
||||
|
||||
#endif /* LOC_ENG_DATA_SERVER_H */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -64,13 +64,21 @@ int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
|
|||
int result;
|
||||
|
||||
LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
|
||||
result = mkfifo(pipe_name, 0666);
|
||||
result = mkfifo(pipe_name, 0660);
|
||||
|
||||
if ((result == -1) && (errno != EEXIST)) {
|
||||
LOC_LOGE("failed: %s\n", strerror(errno));
|
||||
return result;
|
||||
}
|
||||
|
||||
// The mode in mkfifo is not honoured and does not provide the
|
||||
// group permissions. Doing chmod to add group permissions.
|
||||
result = chmod (pipe_name, 0660);
|
||||
if (result != 0){
|
||||
LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
|
||||
pipe_name, strerror(errno));
|
||||
}
|
||||
|
||||
fd = open(pipe_name, mode);
|
||||
if (fd <= 0)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -47,15 +47,91 @@ int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg,
|
|||
return 1;
|
||||
}
|
||||
|
||||
loc_eng_msg_request_bit *msg(
|
||||
new loc_eng_msg_request_bit(loc_api_handle,
|
||||
pmsg->cmsg.cmsg_if_request.is_supl,
|
||||
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
||||
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
||||
loc_eng_msg_sender(loc_api_handle, msg);
|
||||
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_MSAPU:
|
||||
{
|
||||
LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
|
||||
loc_eng_msg_request_wifi *msg(
|
||||
new loc_eng_msg_request_wifi(loc_api_handle,
|
||||
type,
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
|
||||
(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(
|
||||
new loc_eng_msg_request_bit(loc_api_handle,
|
||||
type,
|
||||
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
||||
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
||||
loc_eng_msg_sender(loc_api_handle, msg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
return 0;
|
||||
}
|
||||
|
@ -64,14 +140,88 @@ int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg,
|
|||
{
|
||||
LOC_LOGD("%s:%d]\n", __func__, __LINE__);
|
||||
#ifndef DEBUG_DMN_LOC_API
|
||||
loc_eng_msg_release_bit *msg(
|
||||
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_MSAPU:
|
||||
{
|
||||
LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
|
||||
loc_eng_msg_release_wifi *msg(
|
||||
new loc_eng_msg_release_wifi(loc_api_handle,
|
||||
type,
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
|
||||
(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(
|
||||
new loc_eng_msg_release_bit(loc_api_handle,
|
||||
pmsg->cmsg.cmsg_if_request.is_supl,
|
||||
type,
|
||||
pmsg->cmsg.cmsg_if_request.ipv4_addr,
|
||||
(char*)pmsg->cmsg.cmsg_if_request.ipv6_addr));
|
||||
loc_eng_msg_sender(loc_api_handle, msg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#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
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -32,6 +32,13 @@
|
|||
#include <linux/types.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
//for SSID_BUF_SIZE
|
||||
#include <hardware/gps.h>
|
||||
|
||||
#ifndef SSID_BUF_SIZE
|
||||
#define SSID_BUF_SIZE (32+1)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
/* 0x0 - 0xEF is reserved for daemon internal */
|
||||
GPSONE_LOC_API_IF_REQUEST = 0xF0,
|
||||
|
@ -55,10 +62,27 @@ struct ctrl_msg_unblock {
|
|||
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_MSAPU,
|
||||
IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
|
||||
IF_REQUEST_SENDER_ID_MODEM
|
||||
} ctrl_if_req_sender_id_e_type;
|
||||
|
||||
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 char ipv6_addr[16];
|
||||
char ssid[SSID_BUF_SIZE];
|
||||
char password[SSID_BUF_SIZE];
|
||||
};
|
||||
|
||||
/* do not change this structure */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -31,7 +31,6 @@
|
|||
#define LOG_TAG "LocSvc_eng"
|
||||
|
||||
#include "hardware/gps.h"
|
||||
#include "loc.h"
|
||||
#include "loc_log.h"
|
||||
#include "loc_eng_log.h"
|
||||
#include "loc_eng_msg_id.h"
|
||||
|
@ -88,10 +87,27 @@ static loc_name_val_s_type loc_eng_msgs[] =
|
|||
NAME_VAL( LOC_ENG_MSG_RELEASE_ATL ),
|
||||
NAME_VAL( LOC_ENG_MSG_REQUEST_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_INFORM_NI_RESPONSE ),
|
||||
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 ),
|
||||
#ifdef FEATURE_ULP
|
||||
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 ),
|
||||
#endif
|
||||
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG ),
|
||||
NAME_VAL( LOC_ENG_MSG_A_GLONASS_PROTOCOL )
|
||||
};
|
||||
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);
|
||||
|
||||
|
@ -111,7 +127,8 @@ static loc_name_val_s_type loc_eng_position_modes[] =
|
|||
NAME_VAL( LOC_POSITION_MODE_RESERVED_1 ),
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_2 ),
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_3 ),
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_4 )
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_4 ),
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_5 )
|
||||
};
|
||||
static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
|
||||
|
||||
|
@ -150,7 +167,7 @@ static loc_name_val_s_type loc_eng_aiding_data_bits[] =
|
|||
NAME_VAL( GPS_DELETE_SADATA ),
|
||||
NAME_VAL( GPS_DELETE_RTI ),
|
||||
NAME_VAL( GPS_DELETE_CELLDB_INFO )
|
||||
#ifdef QCOM_FEATURE_DELEXT
|
||||
#ifdef FEATURE_DELEXT
|
||||
,NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
|
||||
NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
|
||||
NAME_VAL( GPS_DELETE_EPHEMERIS_GLO ),
|
||||
|
@ -172,13 +189,13 @@ const char* loc_get_aiding_data_mask_names(GpsAidingData data)
|
|||
|
||||
static loc_name_val_s_type loc_eng_agps_types[] =
|
||||
{
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
NAME_VAL( AGPS_TYPE_INVALID ),
|
||||
NAME_VAL( AGPS_TYPE_ANY ),
|
||||
#endif
|
||||
NAME_VAL( AGPS_TYPE_SUPL ),
|
||||
NAME_VAL( AGPS_TYPE_C2K )
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
,NAME_VAL( AGPS_TYPE_WWAN_ANY )
|
||||
#endif
|
||||
};
|
||||
|
@ -233,7 +250,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);
|
||||
}
|
||||
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
static loc_name_val_s_type loc_eng_agps_bears[] =
|
||||
{
|
||||
NAME_VAL( AGPS_APN_BEARER_INVALID ),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -37,7 +37,7 @@ extern "C"
|
|||
|
||||
#include <ctype.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_msg_name(int id);
|
||||
|
@ -48,7 +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_response_name(GpsUserResponseType response);
|
||||
const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding);
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
const char* loc_get_agps_bear_name(AGpsBearerType bear);
|
||||
#endif
|
||||
const char* loc_get_server_type_name(LocServerType type);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -35,14 +35,117 @@
|
|||
#include <string.h>
|
||||
#include "log_util.h"
|
||||
#include "loc.h"
|
||||
#include "loc_eng_log.h"
|
||||
#include <loc_eng_log.h>
|
||||
#include "loc_eng_msg_id.h"
|
||||
|
||||
#ifndef SSID_BUF_SIZE
|
||||
#define SSID_BUF_SIZE (32+1)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#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);
|
||||
}
|
||||
};
|
||||
|
||||
/** Flags to indicate which values are valid in a GpsLocationExtended. */
|
||||
typedef uint16_t GpsLocationExtendedFlags;
|
||||
/** GpsLocationExtended has valid pdop, hdop, vdop. */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001
|
||||
/** GpsLocationExtended has valid altitude mean sea level. */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002
|
||||
/** GpsLocation has valid magnetic deviation. */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004
|
||||
/** GpsLocation has valid mode indicator. */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008
|
||||
|
||||
/** Represents gps location extended. */
|
||||
typedef struct {
|
||||
/** set to sizeof(GpsLocationExtended) */
|
||||
size_t size;
|
||||
/** Contains GpsLocationExtendedFlags bits. */
|
||||
uint16_t flags;
|
||||
/** Contains the Altitude wrt mean sea level */
|
||||
float altitudeMeanSeaLevel;
|
||||
/** Contains Position Dilusion of Precision. */
|
||||
float pdop;
|
||||
/** Contains Horizontal Dilusion of Precision. */
|
||||
float hdop;
|
||||
/** Contains Vertical Dilusion of Precision. */
|
||||
float vdop;
|
||||
/** Contains Magnetic Deviation. */
|
||||
float magneticDeviation;
|
||||
} GpsLocationExtended;
|
||||
|
||||
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_MSAPU,
|
||||
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 {
|
||||
const void* owner;
|
||||
const int msgid;
|
||||
|
@ -50,13 +153,25 @@ struct loc_eng_msg {
|
|||
owner(instance), msgid(id)
|
||||
{
|
||||
LOC_LOGV("creating msg %s", loc_get_msg_name(msgid));
|
||||
LOC_LOGV("creating msg ox%x", msgid);
|
||||
}
|
||||
virtual ~loc_eng_msg()
|
||||
{
|
||||
LOC_LOGV("deleting msg %s", loc_get_msg_name(msgid));
|
||||
LOC_LOGV("deleting msg ox%x", msgid);
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_a_glonass_protocol : public loc_eng_msg {
|
||||
const unsigned long a_glonass_protocol;
|
||||
inline loc_eng_msg_a_glonass_protocol(void* instance, unsigned long protocol) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_A_GLONASS_PROTOCOL),
|
||||
a_glonass_protocol(protocol)
|
||||
{
|
||||
LOC_LOGV("A-GLONASS protocol: 0x%lx", protocol);
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_suple_version : public loc_eng_msg {
|
||||
const int supl_version;
|
||||
inline loc_eng_msg_suple_version(void* instance, int version) :
|
||||
|
@ -67,6 +182,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 {
|
||||
const int sensorsDisabled;
|
||||
inline loc_eng_msg_sensor_control_config(void* instance, int disabled) :
|
||||
|
@ -78,12 +213,51 @@ struct loc_eng_msg_sensor_control_config : public loc_eng_msg {
|
|||
};
|
||||
|
||||
struct loc_eng_msg_sensor_properties : public loc_eng_msg {
|
||||
const bool gyroBiasVarianceRandomWalk_valid;
|
||||
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),
|
||||
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 +267,56 @@ struct loc_eng_msg_sensor_perf_control_config : public loc_eng_msg {
|
|||
const int accelBatchesPerSec;
|
||||
const int gyroSamplesPerBatch;
|
||||
const int gyroBatchesPerSec;
|
||||
const int accelSamplesPerBatchHigh;
|
||||
const int accelBatchesPerSecHigh;
|
||||
const int gyroSamplesPerBatchHigh;
|
||||
const int gyroBatchesPerSecHigh;
|
||||
const int algorithmConfig;
|
||||
inline loc_eng_msg_sensor_perf_control_config(void* instance, int controlMode,
|
||||
int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec) :
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
|
||||
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh,
|
||||
int algorithmConfig) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG),
|
||||
controlMode(controlMode),
|
||||
accelSamplesPerBatch(accelSamplesPerBatch),
|
||||
accelBatchesPerSec(accelBatchesPerSec),
|
||||
gyroSamplesPerBatch(gyroSamplesPerBatch),
|
||||
gyroBatchesPerSec(gyroBatchesPerSec)
|
||||
gyroBatchesPerSec(gyroBatchesPerSec),
|
||||
accelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
|
||||
accelBatchesPerSecHigh(accelBatchesPerSecHigh),
|
||||
gyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
|
||||
gyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
|
||||
algorithmConfig(algorithmConfig)
|
||||
{
|
||||
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), "
|
||||
"accel_high(#smp,#batches) (%u,%u) gyro_high(#smp,#batches) (%u,%u), "
|
||||
"algorithmConfig(%u)\n",
|
||||
controlMode,
|
||||
accelSamplesPerBatch,
|
||||
accelBatchesPerSec,
|
||||
gyroSamplesPerBatch,
|
||||
gyroBatchesPerSec
|
||||
gyroBatchesPerSec,
|
||||
accelSamplesPerBatchHigh,
|
||||
accelBatchesPerSecHigh,
|
||||
gyroSamplesPerBatchHigh,
|
||||
gyroBatchesPerSecHigh,
|
||||
algorithmConfig
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct loc_eng_msg_position_mode : public loc_eng_msg {
|
||||
const LocPositionMode 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) {}
|
||||
const LocPosMode pMode;
|
||||
inline loc_eng_msg_position_mode(void* instance,
|
||||
LocPositionMode mode,
|
||||
GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval,
|
||||
uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time) :
|
||||
LocPosMode &mode) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_SET_POSITION_MODE),
|
||||
pMode(mode), pRecurrence(recurrence), minInterval(min_interval),
|
||||
preferredAccuracy(preferred_accuracy), preferredTime(preferred_time)
|
||||
pMode(mode)
|
||||
{
|
||||
LOC_LOGV("Position mode: %s\n Position recurrence: %s\n min interval: %d\n preferred accuracy: %d\n preferred time: %d",
|
||||
loc_get_position_mode_name(pMode),
|
||||
loc_get_position_recurrence_name(pRecurrence),
|
||||
minInterval,
|
||||
preferredAccuracy,
|
||||
preferredTime);
|
||||
pMode.logv();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -186,33 +361,52 @@ struct loc_eng_msg_delete_aiding_data : public loc_eng_msg {
|
|||
|
||||
struct loc_eng_msg_report_position : public loc_eng_msg {
|
||||
const GpsLocation location;
|
||||
const GpsLocationExtended locationExtended;
|
||||
const void* locationExt;
|
||||
const enum loc_sess_status status;
|
||||
inline loc_eng_msg_report_position(void* instance, GpsLocation &loc, void* locExt,
|
||||
const LocPosTechMask technology_mask;
|
||||
inline loc_eng_msg_report_position(void* instance, GpsLocation &loc, GpsLocationExtended &locExtended, void* locExt,
|
||||
enum loc_sess_status st) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
||||
location(loc), locationExt(locExt), status(st)
|
||||
location(loc), locationExtended(locExtended), locationExt(locExt), status(st), technology_mask(LOC_POS_TECH_MASK_DEFAULT)
|
||||
{
|
||||
#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: %s",
|
||||
#ifdef 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\n Technology mask: %u",
|
||||
location.flags, location.position_source, location.latitude, location.longitude,
|
||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||
location.timestamp, location.rawDataSize, location.rawData,
|
||||
loc_get_position_sess_status_name(status));
|
||||
location.timestamp, location.rawDataSize, location.rawData,status,technology_mask);
|
||||
#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",
|
||||
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: %d\n Technology mask: %u",
|
||||
location.flags, location.latitude, location.longitude,
|
||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||
location.timestamp, loc_get_position_sess_status_name(status));
|
||||
location.timestamp, status,technology_mask);
|
||||
#endif
|
||||
}
|
||||
inline loc_eng_msg_report_position(void* instance, GpsLocation &loc, GpsLocationExtended &locExtended, void* locExt,
|
||||
enum loc_sess_status st, LocPosTechMask technology) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_POSITION),
|
||||
location(loc), locationExtended(locExtended), locationExt(locExt), status(st), technology_mask(technology)
|
||||
{
|
||||
#ifdef 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\n Technology mask: %u",
|
||||
location.flags, location.position_source, location.latitude, location.longitude,
|
||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||
location.timestamp, location.rawDataSize, location.rawData,status,technology_mask);
|
||||
#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: %d\n Technology mask: %u",
|
||||
location.flags, location.latitude, location.longitude,
|
||||
location.altitude, location.speed, location.bearing, location.accuracy,
|
||||
location.timestamp, status,technology_mask);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
struct loc_eng_msg_report_sv : public loc_eng_msg {
|
||||
const GpsSvStatus svStatus;
|
||||
const GpsLocationExtended locationExtended;
|
||||
const void* svExt;
|
||||
inline loc_eng_msg_report_sv(void* instance, GpsSvStatus &sv, void* ext) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_SV), svStatus(sv), svExt(ext)
|
||||
inline loc_eng_msg_report_sv(void* instance, GpsSvStatus &sv, GpsLocationExtended &locExtended, void* ext) :
|
||||
loc_eng_msg(instance, LOC_ENG_MSG_REPORT_SV), svStatus(sv), locationExtended(locExtended), svExt(ext)
|
||||
{
|
||||
LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n used in fix mask: %x\n sv: prn snr elevation azimuth",
|
||||
svStatus.num_svs, svStatus.ephemeris_mask, svStatus.almanac_mask, svStatus.used_in_fix_mask);
|
||||
|
@ -256,23 +450,23 @@ struct loc_eng_msg_report_nmea : 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;
|
||||
char* const ipv6Addr;
|
||||
inline loc_eng_msg_request_bit(void* instance,
|
||||
unsigned int is_supl,
|
||||
loc_if_req_type_e_type type,
|
||||
int ipv4,
|
||||
char* ipv6) :
|
||||
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])
|
||||
{
|
||||
if (NULL != ipv6Addr)
|
||||
memcpy(ipv6Addr, ipv6, 16);
|
||||
LOC_LOGV("isSupl: %d, ipv4: %d.%d.%d.%d, ipv6: %s", isSupl,
|
||||
(unsigned char)ipv4>>24,
|
||||
(unsigned char)ipv4>>16,
|
||||
(unsigned char)ipv4>>8,
|
||||
LOC_LOGV("ifType: %d, ipv4: %d.%d.%d.%d, ipv6: %s", ifType,
|
||||
(unsigned char)(ipv4>>24),
|
||||
(unsigned char)(ipv4>>16),
|
||||
(unsigned char)(ipv4>>8),
|
||||
(unsigned char)ipv4,
|
||||
NULL != ipv6Addr ? ipv6Addr : "");
|
||||
}
|
||||
|
@ -285,24 +479,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 {
|
||||
const unsigned int isSupl;
|
||||
const loc_if_req_type_e_type ifType;
|
||||
const int ipv4Addr;
|
||||
char* const ipv6Addr;
|
||||
inline loc_eng_msg_release_bit(void* instance,
|
||||
unsigned int is_supl,
|
||||
loc_if_req_type_e_type type,
|
||||
int ipv4,
|
||||
char* ipv6) :
|
||||
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])
|
||||
{
|
||||
if (NULL != ipv6Addr)
|
||||
memcpy(ipv6Addr, ipv6, 16);
|
||||
LOC_LOGV("isSupl: %d, ipv4: %d.%d.%d.%d, ipv6: %s", isSupl,
|
||||
(unsigned char)ipv4>>24,
|
||||
(unsigned char)ipv4>>16,
|
||||
(unsigned char)ipv4>>8,
|
||||
LOC_LOGV("ifType: %d, ipv4: %d.%d.%d.%d, ipv6: %s", ifType,
|
||||
(unsigned char)(ipv4>>24),
|
||||
(unsigned char)(ipv4>>16),
|
||||
(unsigned char)(ipv4>>8),
|
||||
(unsigned char)ipv4,
|
||||
NULL != ipv6Addr ? ipv6Addr : "");
|
||||
}
|
||||
|
@ -315,6 +546,43 @@ 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 {
|
||||
const int handle;
|
||||
const AGpsType type;
|
||||
|
@ -452,7 +720,7 @@ struct loc_eng_msg_inject_xtra_data : public loc_eng_msg {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
||||
const AGpsStatusValue agpsType;
|
||||
const int length;
|
||||
|
@ -502,7 +770,7 @@ struct loc_eng_msg_atl_open_success : public loc_eng_msg {
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
||||
const AGpsStatusValue agpsType;
|
||||
inline loc_eng_msg_atl_open_failed(void* instance,
|
||||
|
@ -524,7 +792,7 @@ struct loc_eng_msg_atl_open_failed : public loc_eng_msg {
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
struct loc_eng_msg_atl_closed : public loc_eng_msg {
|
||||
const AGpsStatusValue agpsType;
|
||||
inline loc_eng_msg_atl_closed(void* instance,
|
||||
|
@ -567,6 +835,120 @@ struct loc_eng_msg_set_data_enable : public loc_eng_msg {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
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_raw_command : public loc_eng_msg {
|
||||
const char* rawCommand;
|
||||
const int rawCommandLength;
|
||||
inline ulp_msg_inject_raw_command (void* instance, char* command, int length) :
|
||||
loc_eng_msg(instance, ULP_MSG_INJECT_RAW_COMMAND),
|
||||
rawCommand(new char[length]),
|
||||
rawCommandLength(length)
|
||||
{
|
||||
memcpy((void*)rawCommand, (void*)command, length);
|
||||
LOC_LOGV("inject raw command: command %s\n command length: %d\n ",
|
||||
rawCommand,
|
||||
rawCommandLength);
|
||||
}
|
||||
|
||||
inline ~ulp_msg_inject_raw_command()
|
||||
{
|
||||
delete[] rawCommand;
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
void loc_eng_msg_sender(void* loc_eng_data_p, void* msg);
|
||||
int loc_eng_msgget(int * p_req_msgq);
|
||||
int loc_eng_msgremove(int req_msgq);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -76,11 +76,64 @@ enum loc_eng_msg_ids_t {
|
|||
LOC_ENG_MSG_RELEASE_BIT,
|
||||
LOC_ENG_MSG_REQUEST_ATL,
|
||||
LOC_ENG_MSG_RELEASE_ATL,
|
||||
LOC_ENG_MSG_REQUEST_WIFI,
|
||||
LOC_ENG_MSG_RELEASE_WIFI,
|
||||
LOC_ENG_MSG_REQUEST_NI,
|
||||
LOC_ENG_MSG_INFORM_NI_RESPONSE,
|
||||
LOC_ENG_MSG_REQUEST_XTRA_DATA,
|
||||
LOC_ENG_MSG_REQUEST_TIME,
|
||||
LOC_ENG_MSG_REQUEST_POSITION
|
||||
LOC_ENG_MSG_REQUEST_POSITION,
|
||||
LOC_ENG_MSG_EXT_POWER_CONFIG,
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
// 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 to ULP module to re-evaluate its subsystems
|
||||
ULP_MSG_MONITOR,
|
||||
|
||||
// Last ULP MSG
|
||||
ULP_MSG_LAST = 0x700,
|
||||
#endif
|
||||
/* Message is sent by HAL to LOC API to configure LTE Positioning
|
||||
Profile in modem */
|
||||
LOC_ENG_MSG_LPP_CONFIG,
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
// Message is sent by Android framework (GpsLocationProvider)
|
||||
// to inject the raw command
|
||||
ULP_MSG_INJECT_RAW_COMMAND,
|
||||
#endif
|
||||
|
||||
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
|
||||
LOC_ENG_MSG_A_GLONASS_PROTOCOL,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -249,7 +249,9 @@ void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiCallbacks *callback
|
|||
{
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
|
||||
if (NULL == callbacks->notify_cb) {
|
||||
if(callbacks == NULL)
|
||||
EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
|
||||
else if (NULL == callbacks->notify_cb) {
|
||||
EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
|
||||
} else if (NULL != loc_eng_data.ni_notify_cb) {
|
||||
EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
|
||||
|
|
703
loc_api/libloc_api_50001/loc_eng_nmea.cpp
Normal file
703
loc_api/libloc_api_50001/loc_eng_nmea.cpp
Normal file
|
@ -0,0 +1,703 @@
|
|||
/* Copyright (c) 2012, The Linux Foundation. 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 Code Aurora Forum, 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 "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define LOG_NDDEBUG 0
|
||||
#define LOG_TAG "LocSvc_eng_nmea"
|
||||
|
||||
#include <loc_eng.h>
|
||||
#include <loc_eng_nmea.h>
|
||||
#include <math.h>
|
||||
#include "log_util.h"
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_nmea_send
|
||||
|
||||
DESCRIPTION
|
||||
send out NMEA sentence
|
||||
|
||||
DEPENDENCIES
|
||||
NONE
|
||||
|
||||
RETURN VALUE
|
||||
Total length of the nmea sentence
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, (struct timezone *) NULL);
|
||||
int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
|
||||
CALLBACK_LOG_CALLFLOW("nmea_cb", %p, pNmea);
|
||||
loc_eng_data_p->nmea_cb(now, pNmea, length);
|
||||
LOC_LOGD("NMEA <%s", pNmea);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_nmea_put_checksum
|
||||
|
||||
DESCRIPTION
|
||||
Generate NMEA sentences generated based on position report
|
||||
|
||||
DEPENDENCIES
|
||||
NONE
|
||||
|
||||
RETURN VALUE
|
||||
Total length of the nmea sentence
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
|
||||
{
|
||||
uint8_t checksum = 0;
|
||||
int length = 0;
|
||||
|
||||
pNmea++; //skip the $
|
||||
while (*pNmea != '\0')
|
||||
{
|
||||
checksum ^= *pNmea++;
|
||||
length++;
|
||||
}
|
||||
|
||||
int checksumLength = snprintf(pNmea, maxSize,"*%02X\r\n", checksum);
|
||||
return (length + checksumLength);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_nmea_generate_pos
|
||||
|
||||
DESCRIPTION
|
||||
Generate NMEA sentences generated based on position report
|
||||
|
||||
DEPENDENCIES
|
||||
NONE
|
||||
|
||||
RETURN VALUE
|
||||
0
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
|
||||
const GpsLocation &location, const GpsLocationExtended &locationExtended)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
||||
char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
|
||||
char* pMarker = sentence;
|
||||
int lengthRemaining = sizeof(sentence);
|
||||
int length = 0;
|
||||
|
||||
time_t utcTime(location.timestamp/1000);
|
||||
tm * pTm = gmtime(&utcTime);
|
||||
int utcYear = pTm->tm_year % 100; // 2 digit year
|
||||
int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero
|
||||
int utcDay = pTm->tm_mday;
|
||||
int utcHours = pTm->tm_hour;
|
||||
int utcMinutes = pTm->tm_min;
|
||||
int utcSeconds = pTm->tm_sec;
|
||||
|
||||
// ------------------
|
||||
// ------$GPGSA------
|
||||
// ------------------
|
||||
|
||||
uint32_t svUsedCount = 0;
|
||||
uint32_t svUsedList[32] = {0};
|
||||
uint32_t mask = loc_eng_data_p->sv_used_mask;
|
||||
for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
|
||||
{
|
||||
if (mask & 1)
|
||||
svUsedList[svUsedCount++] = i;
|
||||
mask = mask >> 1;
|
||||
}
|
||||
// clear the cache so they can't be used again
|
||||
loc_eng_data_p->sv_used_mask = 0;
|
||||
|
||||
char fixType;
|
||||
if (svUsedCount == 0)
|
||||
fixType = '1'; // no fix
|
||||
else if (svUsedCount <= 3)
|
||||
fixType = '2'; // 2D fix
|
||||
else
|
||||
fixType = '3'; // 3D fix
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
|
||||
{
|
||||
if (i < svUsedCount)
|
||||
length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[i]);
|
||||
else
|
||||
length = snprintf(pMarker, lengthRemaining, ",");
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
}
|
||||
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
|
||||
{ // dop is in locationExtended, (QMI)
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
|
||||
locationExtended.pdop,
|
||||
locationExtended.hdop,
|
||||
locationExtended.vdop);
|
||||
}
|
||||
else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
|
||||
{ // dop was cached from sv report (RPC)
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
|
||||
loc_eng_data_p->pdop,
|
||||
loc_eng_data_p->hdop,
|
||||
loc_eng_data_p->vdop);
|
||||
}
|
||||
else
|
||||
{ // no dop
|
||||
length = snprintf(pMarker, lengthRemaining, ",,");
|
||||
}
|
||||
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
// ------------------
|
||||
// ------$GPVTG------
|
||||
// ------------------
|
||||
|
||||
pMarker = sentence;
|
||||
lengthRemaining = sizeof(sentence);
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_BEARING)
|
||||
{
|
||||
float magTrack = location.bearing;
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
|
||||
{
|
||||
float magTrack = location.bearing - locationExtended.magneticDeviation;
|
||||
if (magTrack < 0.0)
|
||||
magTrack += 360.0;
|
||||
else if (magTrack > 360.0)
|
||||
magTrack -= 360.0;
|
||||
}
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPVTG,%.1lf,T,%.1lf,M,", location.bearing, magTrack);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_SPEED)
|
||||
{
|
||||
float speedKnots = location.speed * (3600.0/1852.0);
|
||||
float speedKmPerHour = location.speed * 3.6;
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,N,%.1lf,K,", speedKnots, speedKmPerHour);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, ",N,,K,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (!(location.flags & GPS_LOCATION_HAS_LAT_LONG))
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
|
||||
else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->client_handle->getPositionMode().mode)
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
|
||||
else
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
|
||||
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
// ------------------
|
||||
// ------$GPRMC------
|
||||
// ------------------
|
||||
|
||||
pMarker = sentence;
|
||||
lengthRemaining = sizeof(sentence);
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
|
||||
utcHours, utcMinutes, utcSeconds);
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_LAT_LONG)
|
||||
{
|
||||
double latitude = location.latitude;
|
||||
double longitude = location.longitude;
|
||||
char latHemisphere;
|
||||
char lonHemisphere;
|
||||
double latMinutes;
|
||||
double lonMinutes;
|
||||
|
||||
if (latitude > 0)
|
||||
{
|
||||
latHemisphere = 'N';
|
||||
}
|
||||
else
|
||||
{
|
||||
latHemisphere = 'S';
|
||||
latitude *= -1.0;
|
||||
}
|
||||
|
||||
if (longitude < 0)
|
||||
{
|
||||
lonHemisphere = 'W';
|
||||
longitude *= -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lonHemisphere = 'E';
|
||||
}
|
||||
|
||||
latMinutes = fmod(latitude * 60.0 , 60.0);
|
||||
lonMinutes = fmod(longitude * 60.0 , 60.0);
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,",
|
||||
(uint8_t)floor(latitude), latMinutes, latHemisphere,
|
||||
(uint8_t)floor(longitude),lonMinutes, lonHemisphere);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",,,,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_SPEED)
|
||||
{
|
||||
float speedKnots = location.speed * (3600.0/1852.0);
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,", speedKnots);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, ",");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_BEARING)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,", location.bearing);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, ",");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "%2.2d%2.2d%2.2d,",
|
||||
utcDay, utcMonth, utcYear);
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
|
||||
{
|
||||
float magneticVariation = locationExtended.magneticDeviation;
|
||||
char direction;
|
||||
if (magneticVariation < 0.0)
|
||||
{
|
||||
direction = 'W';
|
||||
magneticVariation *= -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = 'E';
|
||||
}
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,%c,",
|
||||
magneticVariation, direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, ",,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (!(location.flags & GPS_LOCATION_HAS_LAT_LONG))
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
|
||||
else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->client_handle->getPositionMode().mode)
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
|
||||
else
|
||||
length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
|
||||
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
// ------------------
|
||||
// ------$GPGGA------
|
||||
// ------------------
|
||||
|
||||
pMarker = sentence;
|
||||
lengthRemaining = sizeof(sentence);
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
|
||||
utcHours, utcMinutes, utcSeconds);
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (location.flags & GPS_LOCATION_HAS_LAT_LONG)
|
||||
{
|
||||
double latitude = location.latitude;
|
||||
double longitude = location.longitude;
|
||||
char latHemisphere;
|
||||
char lonHemisphere;
|
||||
double latMinutes;
|
||||
double lonMinutes;
|
||||
|
||||
if (latitude > 0)
|
||||
{
|
||||
latHemisphere = 'N';
|
||||
}
|
||||
else
|
||||
{
|
||||
latHemisphere = 'S';
|
||||
latitude *= -1.0;
|
||||
}
|
||||
|
||||
if (longitude < 0)
|
||||
{
|
||||
lonHemisphere = 'W';
|
||||
longitude *= -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lonHemisphere = 'E';
|
||||
}
|
||||
|
||||
latMinutes = fmod(latitude * 60.0 , 60.0);
|
||||
lonMinutes = fmod(longitude * 60.0 , 60.0);
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "%02d%09.6lf,%c,%03d%09.6lf,%c,",
|
||||
(uint8_t)floor(latitude), latMinutes, latHemisphere,
|
||||
(uint8_t)floor(longitude),lonMinutes, lonHemisphere);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",,,,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
char gpsQuality;
|
||||
if (!(location.flags & GPS_LOCATION_HAS_LAT_LONG))
|
||||
gpsQuality = '0'; // 0 means no fix
|
||||
else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->client_handle->getPositionMode().mode)
|
||||
gpsQuality = '1'; // 1 means GPS fix
|
||||
else
|
||||
gpsQuality = '2'; // 2 means DGPS fix
|
||||
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
|
||||
{ // dop is in locationExtended, (QMI)
|
||||
length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
|
||||
gpsQuality, svUsedCount, locationExtended.hdop);
|
||||
}
|
||||
else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
|
||||
{ // dop was cached from sv report (RPC)
|
||||
length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
|
||||
gpsQuality, svUsedCount, loc_eng_data_p->hdop);
|
||||
}
|
||||
else
|
||||
{ // no hdop
|
||||
length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
|
||||
gpsQuality, svUsedCount);
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,M,",
|
||||
locationExtended.altitudeMeanSeaLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",,");
|
||||
}
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if ((location.flags & GPS_LOCATION_HAS_ALTITUDE) &&
|
||||
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
|
||||
location.altitude - locationExtended.altitudeMeanSeaLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",,,");
|
||||
}
|
||||
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
// clear the dop cache so they can't be used again
|
||||
loc_eng_data_p->pdop = 0;
|
||||
loc_eng_data_p->hdop = 0;
|
||||
loc_eng_data_p->vdop = 0;
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_nmea_generate_sv
|
||||
|
||||
DESCRIPTION
|
||||
Generate NMEA sentences generated based on sv report
|
||||
|
||||
DEPENDENCIES
|
||||
NONE
|
||||
|
||||
RETURN VALUE
|
||||
0
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
|
||||
===========================================================================*/
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
||||
const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
||||
char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
|
||||
char* pMarker = sentence;
|
||||
int lengthRemaining = sizeof(sentence);
|
||||
int length = 0;
|
||||
|
||||
// ------------------
|
||||
// ------$GPGSV------
|
||||
// ------------------
|
||||
|
||||
if (svStatus.num_svs <= 0)
|
||||
{
|
||||
// no svs in view, so just send a blank $GPGSV sentence
|
||||
strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
int svCount = svStatus.num_svs;
|
||||
int sentenceCount = svCount / 4;
|
||||
if (svStatus.num_svs % 4)
|
||||
sentenceCount++;
|
||||
int sentenceNumber = 1;
|
||||
int svNumber = 1;
|
||||
|
||||
while (sentenceNumber <= sentenceCount)
|
||||
{
|
||||
pMarker = sentence;
|
||||
lengthRemaining = sizeof(sentence);
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
|
||||
sentenceCount, sentenceNumber, svCount);
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
for (int i=0; (svNumber <= svCount) && (i < 4); i++, svNumber++)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
|
||||
svStatus.sv_list[svNumber-1].prn,
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (svStatus.sv_list[svNumber-1].snr > 0)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,"%02d",
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
LOC_LOGE("NMEA Error in string formatting");
|
||||
return;
|
||||
}
|
||||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
}
|
||||
}
|
||||
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
sentenceNumber++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (svStatus.used_in_fix_mask == 0)
|
||||
{ // No sv used, so there will be no position report, so send
|
||||
// blank NMEA sentences
|
||||
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
||||
strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
}
|
||||
else
|
||||
{ // cache the used in fix mask, as it will be needed to send $GPGSA
|
||||
// during the position report
|
||||
loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask;
|
||||
|
||||
// For RPC, the DOP are sent during sv report, so cache them
|
||||
// now to be sent during position report.
|
||||
// For QMI, the DOP will be in position report.
|
||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
|
||||
{
|
||||
loc_eng_data_p->pdop = locationExtended.pdop;
|
||||
loc_eng_data_p->hdop = locationExtended.hdop;
|
||||
loc_eng_data_p->vdop = locationExtended.vdop;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc_eng_data_p->pdop = 0;
|
||||
loc_eng_data_p->hdop = 0;
|
||||
loc_eng_data_p->vdop = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
}
|
42
loc_api/libloc_api_50001/loc_eng_nmea.h
Normal file
42
loc_api/libloc_api_50001/loc_eng_nmea.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* Copyright (c) 2012, The Linux Foundation. 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 Code Aurora Forum, 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 "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LOC_ENG_NMEA_H
|
||||
#define LOC_ENG_NMEA_H
|
||||
|
||||
#include <hardware/gps.h>
|
||||
|
||||
#define NMEA_SENTENCE_MAX_LENGTH 200
|
||||
|
||||
void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
|
||||
int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended);
|
||||
void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const GpsLocation &location, const GpsLocationExtended &locationExtended);
|
||||
|
||||
#endif // LOC_ENG_NMEA_H
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -54,12 +54,17 @@ SIDE EFFECTS
|
|||
int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
|
||||
GpsXtraCallbacks* callbacks)
|
||||
{
|
||||
loc_eng_xtra_data_s_type *xtra_module_data_ptr;
|
||||
int ret_val = -1;
|
||||
loc_eng_xtra_data_s_type *xtra_module_data_ptr;
|
||||
|
||||
xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
|
||||
xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
|
||||
|
||||
return 0;
|
||||
if(callbacks == NULL)
|
||||
LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
|
||||
else {
|
||||
xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
|
||||
xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
|
||||
ret_val = 0;
|
||||
}
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
|
17
loc_api/loc_api_v02/Android.mk
Executable file → Normal file
17
loc_api/loc_api_v02/Android.mk
Executable file → Normal file
|
@ -28,12 +28,23 @@ LOCAL_CFLAGS += \
|
|||
-fno-short-enums \
|
||||
-D_ANDROID_
|
||||
|
||||
ifeq ($(FEATURE_IPV6), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_IPV6
|
||||
endif #FEATURE_IPV6
|
||||
|
||||
ifeq ($(FEATURE_DELEXT), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_DELEXT
|
||||
endif #FEATURE_DELEXT
|
||||
|
||||
ifeq ($(FEATURE_ULP), true)
|
||||
LOCAL_CFLAGS += -DFEATURE_ULP
|
||||
endif #FEATURE_ULP
|
||||
|
||||
## Includes
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(TOP)/vendor/qcom/proprietary/qmi-framework/inc \
|
||||
$(TOP)/vendor/qcom/proprietary/qmi-framework/qcci/inc \
|
||||
$(TOP)/vendor/qcom/proprietary/qmi-framework/common/inc \
|
||||
$(TARGET_OUT_HEADERS)/libloc_eng \
|
||||
$(TARGET_OUT_HEADERS)/qmi-framework/inc \
|
||||
$(TARGET_OUT_HEADERS)/qmi/inc \
|
||||
$(TARGET_OUT_HEADERS)/gps.utils
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundatoin, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -26,6 +26,9 @@
|
|||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "LocSvc_adapter"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -40,9 +43,6 @@
|
|||
#include "loc_api_v02_log.h"
|
||||
#include "loc_api_sync_req.h"
|
||||
#include "LocApiAdapter.h"
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "LocSvc_adapter"
|
||||
#include "loc_util_log.h"
|
||||
|
||||
|
||||
|
@ -161,10 +161,7 @@ locClientCallbacksType globalCallbacks =
|
|||
/* Constructor for LocApiV02Adapter */
|
||||
LocApiV02Adapter :: LocApiV02Adapter(LocEng &locEng):
|
||||
LocApiAdapter(locEng), clientHandle( LOC_CLIENT_INVALID_HANDLE_VALUE),
|
||||
eventMask(convertMask(locEng.eventMask)), navigating(false),
|
||||
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 )
|
||||
eventMask(convertMask(locEng.eventMask))
|
||||
{
|
||||
// initialize loc_sync_req interface
|
||||
loc_sync_req_init();
|
||||
|
@ -236,6 +233,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
|||
memset (&set_mode_ind, 0, sizeof(set_mode_ind));
|
||||
|
||||
LOC_LOGV("%s:%d]: start \n", __func__, __LINE__);
|
||||
fixCriteria.logv();
|
||||
|
||||
// fill in the start request
|
||||
switch(fixCriteria.mode)
|
||||
|
@ -252,6 +250,10 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
|||
set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_CELL_ID_V02;
|
||||
break;
|
||||
|
||||
case LOC_POSITION_MODE_RESERVED_5:
|
||||
set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_WWAN_V02;
|
||||
break;
|
||||
|
||||
default:
|
||||
set_mode_msg.operationMode = eQMI_LOC_OPER_MODE_STANDALONE_V02;
|
||||
break;
|
||||
|
@ -277,28 +279,27 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
|||
return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; // error
|
||||
}
|
||||
|
||||
if(fixCriteria.min_interval > 0)
|
||||
{
|
||||
start_msg.minInterval_valid = 1;
|
||||
start_msg.minInterval = fixCriteria.min_interval;
|
||||
}
|
||||
start_msg.minInterval_valid = 1;
|
||||
start_msg.minInterval = fixCriteria.min_interval;
|
||||
|
||||
start_msg.horizontalAccuracyLevel_valid = 1;
|
||||
if (fixCriteria.preferred_accuracy > 0) {
|
||||
start_msg.horizontalAccuracyLevel_valid = 1;
|
||||
|
||||
if (fixCriteria.preferred_accuracy <= 100)
|
||||
{
|
||||
// fix needs high accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_HIGH_V02;
|
||||
}
|
||||
else if (fixCriteria.preferred_accuracy <= 1000)
|
||||
{
|
||||
//fix needs med accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_MED_V02;
|
||||
}
|
||||
else
|
||||
{
|
||||
//fix needs low accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
|
||||
if (fixCriteria.preferred_accuracy <= 100)
|
||||
{
|
||||
// fix needs high accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_HIGH_V02;
|
||||
}
|
||||
else if (fixCriteria.preferred_accuracy <= 1000)
|
||||
{
|
||||
//fix needs med accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_MED_V02;
|
||||
}
|
||||
else
|
||||
{
|
||||
//fix needs low accuracy
|
||||
start_msg.horizontalAccuracyLevel = eQMI_LOC_ACCURACY_LOW_V02;
|
||||
}
|
||||
}
|
||||
|
||||
start_msg.fixRecurrence_valid = 1;
|
||||
|
@ -313,7 +314,25 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
|||
|
||||
//dummy session id
|
||||
// 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;
|
||||
|
||||
|
@ -322,13 +341,9 @@ enum loc_api_adapter_err LocApiV02Adapter :: startFix()
|
|||
|
||||
if( eLOC_CLIENT_SUCCESS == status)
|
||||
{
|
||||
navigating = true;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -355,7 +370,6 @@ enum loc_api_adapter_err LocApiV02Adapter :: stopFix()
|
|||
|
||||
if( eLOC_CLIENT_SUCCESS == status)
|
||||
{
|
||||
navigating = false;
|
||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -366,42 +380,28 @@ enum loc_api_adapter_err LocApiV02Adapter :: stopFix()
|
|||
|
||||
/* set the positioning fix criteria */
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: setPositionMode(
|
||||
LocPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time)
|
||||
const LocPosMode *posMode)
|
||||
{
|
||||
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__,
|
||||
min_interval, mode, recurrence, preferred_accuracy);
|
||||
if (NULL != posMode &&
|
||||
!fixCriteria.equals(*posMode)) {
|
||||
//making a copy of the fix criteria
|
||||
fixCriteria = *posMode;
|
||||
|
||||
//store the fix criteria
|
||||
fixCriteria.mode = mode;
|
||||
LOC_LOGD ("%s:%d]: new fix criteria", __func__, __LINE__);
|
||||
|
||||
fixCriteria.recurrence = recurrence;
|
||||
if(true == navigating)
|
||||
{
|
||||
//fix is in progress, send a restart
|
||||
LOC_LOGD ("%s:%d]: fix is in progress restarting the fix with new "
|
||||
"criteria\n", __func__, __LINE__);
|
||||
|
||||
if(min_interval == 0)
|
||||
{
|
||||
fixCriteria.min_interval = MIN_POSSIBLE_FIX_INTERVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixCriteria.min_interval = min_interval;
|
||||
}
|
||||
return( startFix());
|
||||
}
|
||||
}
|
||||
|
||||
fixCriteria.preferred_accuracy = preferred_accuracy;
|
||||
|
||||
fixCriteria.preferred_time = preferred_time;
|
||||
|
||||
if(true == navigating)
|
||||
{
|
||||
//fix is in progress, send a restart
|
||||
LOC_LOGD ("%s:%d]: fix is in progress restarting the fix with new "
|
||||
"criteria\n", __func__, __LINE__);
|
||||
|
||||
return( startFix());
|
||||
}
|
||||
|
||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* inject time into the position engine */
|
||||
|
@ -563,13 +563,14 @@ enum loc_api_adapter_err LocApiV02Adapter :: deleteAidingData(GpsAidingData f)
|
|||
|
||||
}
|
||||
|
||||
#ifdef QCOM_FEATURE_DELEXT
|
||||
#ifdef FEATURE_DELEXT
|
||||
if( f & GPS_DELETE_TIME_GPS )
|
||||
{
|
||||
delete_req.deleteGnssDataMask_valid = 1;
|
||||
delete_req.deleteGnssDataMask |= QMI_LOC_MASK_DELETE_GPS_TIME_V02;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(f & GPS_DELETE_POSITION )
|
||||
{
|
||||
delete_req.deleteGnssDataMask_valid = 1;
|
||||
|
@ -631,7 +632,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: deleteAidingData(GpsAidingData f)
|
|||
QMI_LOC_MASK_DELETE_CELLDB_NEIGHBOR_INFO_V02) ;
|
||||
|
||||
}
|
||||
#ifdef QCOM_FEATURE_DELEXT
|
||||
#ifdef FEATURE_DELEXT
|
||||
if(f & GPS_DELETE_ALMANAC_CORR )
|
||||
{
|
||||
delete_req.deleteGnssDataMask_valid = 1;
|
||||
|
@ -1002,19 +1003,31 @@ enum loc_api_adapter_err LocApiV02Adapter :: setXtraData(
|
|||
|
||||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
}
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
||||
int handle, int is_succ, char* apn, AGpsBearerType bear,
|
||||
AGpsType agpsType)
|
||||
#else
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
||||
int handle, int is_succ, char* apn,
|
||||
AGpsType agpsType)
|
||||
#endif
|
||||
{
|
||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||
locClientReqUnionType req_union;
|
||||
qmiLocInformLocationServerConnStatusReqMsgT_v02 conn_status_req;
|
||||
qmiLocInformLocationServerConnStatusIndMsgT_v02 conn_status_ind;
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
LOC_LOGD("%s:%d]: ATL open handle = %d, is_succ = %d, "
|
||||
"APN = [%s], bearer = %d \n", __func__, __LINE__,
|
||||
handle, is_succ, apn, bear);
|
||||
#else
|
||||
LOC_LOGD("%s:%d]: ATL open handle = %d, is_succ = %d, "
|
||||
"APN = [%s] \n", __func__, __LINE__,
|
||||
handle, is_succ, apn);
|
||||
#endif
|
||||
|
||||
memset(&conn_status_req, 0, sizeof(conn_status_req));
|
||||
memset(&conn_status_ind, 0, sizeof(conn_status_ind));
|
||||
|
@ -1031,6 +1044,7 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
|||
strlcpy(conn_status_req.apnProfile.apnName, apn,
|
||||
sizeof(conn_status_req.apnProfile.apnName) );
|
||||
|
||||
#ifdef FEATURE_IPV6
|
||||
switch(bear)
|
||||
{
|
||||
case AGPS_APN_BEARER_IPV4:
|
||||
|
@ -1052,67 +1066,10 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
|||
LOC_LOGE("%s:%d]:invalid bearer type\n",__func__,__LINE__);
|
||||
return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
#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;
|
||||
#endif
|
||||
|
||||
conn_status_req.apnProfile_valid = 1;
|
||||
}
|
||||
|
@ -1143,7 +1100,8 @@ enum loc_api_adapter_err LocApiV02Adapter :: atlOpenStatus(
|
|||
return LOC_API_ADAPTER_ERR_SUCCESS;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* close atl connection */
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: atlCloseStatus(
|
||||
int handle, int is_succ)
|
||||
|
@ -1239,6 +1197,44 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSUPLVersion(uint32_t version)
|
|||
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;
|
||||
|
||||
lpp_config_req.lppConfig = profile;
|
||||
|
||||
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 */
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: setSensorControlConfig(int sensorsDisabled)
|
||||
{
|
||||
|
@ -1280,7 +1276,11 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorControlConfig(int sensorsD
|
|||
}
|
||||
|
||||
/* 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;
|
||||
locClientReqUnionType req_union;
|
||||
|
@ -1288,15 +1288,30 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(float gyroBiasV
|
|||
qmiLocSetSensorPropertiesReqMsgT_v02 sensor_prop_req;
|
||||
qmiLocSetSensorPropertiesIndMsgT_v02 sensor_prop_ind;
|
||||
|
||||
LOC_LOGI("%s:%d]: sensors prop gyroBiasRandomWalk = %f\n",
|
||||
__func__, __LINE__, gyroBiasVarianceRandomWalk);
|
||||
LOC_LOGI("%s:%d]: sensors prop: gyroBiasRandomWalk = %f, accelRandomWalk = %f, "
|
||||
"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_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.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;
|
||||
|
||||
result = loc_sync_send_req(clientHandle,
|
||||
|
@ -1322,7 +1337,10 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorProperties(float gyroBiasV
|
|||
/* set the Sensor Performance Config */
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int controlMode,
|
||||
int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec)
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
|
||||
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh,
|
||||
int algorithmConfig)
|
||||
{
|
||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||
locClientReqUnionType req_union;
|
||||
|
@ -1331,14 +1349,21 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
|||
qmiLocSetSensorPerformanceControlConfigIndMsgT_v02 sensor_perf_config_ind;
|
||||
|
||||
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) "
|
||||
"accel_high(#smp,#batches) (%u,%u) gyro_high(#smp,#batches) (%u,%u) "
|
||||
"algorithmConfig(%u)\n",
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
controlMode,
|
||||
accelSamplesPerBatch,
|
||||
accelBatchesPerSec,
|
||||
gyroSamplesPerBatch,
|
||||
gyroBatchesPerSec
|
||||
gyroBatchesPerSec,
|
||||
accelSamplesPerBatchHigh,
|
||||
accelBatchesPerSecHigh,
|
||||
gyroSamplesPerBatchHigh,
|
||||
gyroBatchesPerSecHigh,
|
||||
algorithmConfig
|
||||
);
|
||||
|
||||
memset(&sensor_perf_config_req, 0, sizeof(sensor_perf_config_req));
|
||||
|
@ -1352,6 +1377,14 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
|||
sensor_perf_config_req.gyroSamplingSpec_valid = 1;
|
||||
sensor_perf_config_req.gyroSamplingSpec.batchesPerSecond = gyroBatchesPerSec;
|
||||
sensor_perf_config_req.gyroSamplingSpec.samplesPerBatch = gyroSamplesPerBatch;
|
||||
sensor_perf_config_req.accelSamplingSpecHigh_valid = 1;
|
||||
sensor_perf_config_req.accelSamplingSpecHigh.batchesPerSecond = accelBatchesPerSecHigh;
|
||||
sensor_perf_config_req.accelSamplingSpecHigh.samplesPerBatch = accelSamplesPerBatchHigh;
|
||||
sensor_perf_config_req.gyroSamplingSpecHigh_valid = 1;
|
||||
sensor_perf_config_req.gyroSamplingSpecHigh.batchesPerSecond = gyroBatchesPerSecHigh;
|
||||
sensor_perf_config_req.gyroSamplingSpecHigh.samplesPerBatch = gyroSamplesPerBatchHigh;
|
||||
sensor_perf_config_req.algorithmConfig_valid = 1;
|
||||
sensor_perf_config_req.algorithmConfig = algorithmConfig;
|
||||
|
||||
req_union.pSetSensorPerformanceControlConfigReq = &sensor_perf_config_req;
|
||||
|
||||
|
@ -1375,6 +1408,104 @@ enum loc_api_adapter_err LocApiV02Adapter :: setSensorPerfControlConfig(int cont
|
|||
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;
|
||||
}
|
||||
|
||||
/* set the Positioning Protocol on A-GLONASS system */
|
||||
enum loc_api_adapter_err LocApiV02Adapter :: setAGLONASSProtocol(unsigned long aGlonassProtocol)
|
||||
{
|
||||
locClientStatusEnumType result = eLOC_CLIENT_SUCCESS;
|
||||
locClientReqUnionType req_union;
|
||||
qmiLocSetProtocolConfigParametersReqMsgT_v02 aGlonassProtocol_req;
|
||||
qmiLocSetProtocolConfigParametersIndMsgT_v02 aGlonassProtocol_ind;
|
||||
|
||||
memset(&aGlonassProtocol_req, 0, sizeof(aGlonassProtocol_req));
|
||||
memset(&aGlonassProtocol_ind, 0, sizeof(aGlonassProtocol_ind));
|
||||
|
||||
aGlonassProtocol_req.assistedGlonassProtocolMask_valid = 1;
|
||||
aGlonassProtocol_req.assistedGlonassProtocolMask = aGlonassProtocol;
|
||||
|
||||
req_union.pSetProtocolConfigParametersReq = &aGlonassProtocol_req;
|
||||
|
||||
LOC_LOGD("%s:%d]: aGlonassProtocolMask = 0x%lx\n", __func__, __LINE__,
|
||||
aGlonassProtocol_req.assistedGlonassProtocolMask);
|
||||
|
||||
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,
|
||||
&aGlonassProtocol_ind);
|
||||
|
||||
if(result != eLOC_CLIENT_SUCCESS ||
|
||||
eQMI_LOC_SUCCESS_V02 != aGlonassProtocol_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(aGlonassProtocol_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 */
|
||||
locClientEventMaskType LocApiV02Adapter :: convertMask(
|
||||
LOC_API_ADAPTER_EVENT_MASK_T mask)
|
||||
|
@ -1460,9 +1591,13 @@ void LocApiV02Adapter :: reportPosition (
|
|||
const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr)
|
||||
{
|
||||
GpsLocation location;
|
||||
|
||||
LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
|
||||
LOC_LOGD("Reporting postion from V2 Adapter\n");
|
||||
memset(&location, 0, sizeof (GpsLocation));
|
||||
location.size = sizeof(location);
|
||||
GpsLocationExtended locationExtended;
|
||||
memset(&locationExtended, 0, sizeof (GpsLocationExtended));
|
||||
locationExtended.size = sizeof(locationExtended);
|
||||
// Process the position from final and intermediate reports
|
||||
|
||||
if( (location_report_ptr->sessionStatus == eQMI_LOC_SESS_STATUS_SUCCESS_V02) ||
|
||||
|
@ -1518,16 +1653,47 @@ void LocApiV02Adapter :: reportPosition (
|
|||
location.accuracy = location_report_ptr->horUncCircular;
|
||||
}
|
||||
|
||||
// Technology Mask
|
||||
tech_Mask |= location_report_ptr->technologyMask;
|
||||
|
||||
#ifdef FEATURE_ULP
|
||||
//Mark the location source as from GNSS
|
||||
location.flags |= LOCATION_HAS_SOURCE_INFO;
|
||||
location.position_source = ULP_LOCATION_IS_FROM_GNSS;
|
||||
#endif
|
||||
if (location_report_ptr->magneticDeviation_valid)
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
|
||||
locationExtended.magneticDeviation = location_report_ptr->magneticDeviation;
|
||||
}
|
||||
|
||||
if (location_report_ptr->DOP_valid)
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
|
||||
locationExtended.pdop = location_report_ptr->DOP.PDOP;
|
||||
locationExtended.hdop = location_report_ptr->DOP.HDOP;
|
||||
locationExtended.vdop = location_report_ptr->DOP.VDOP;
|
||||
}
|
||||
|
||||
if (location_report_ptr->altitudeWrtMeanSeaLevel_valid)
|
||||
{
|
||||
locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
|
||||
locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitudeWrtMeanSeaLevel;
|
||||
}
|
||||
|
||||
LocApiAdapter::reportPosition( location,
|
||||
locationExtended,
|
||||
locEngHandle.extPosInfo((void*)location_report_ptr),
|
||||
(location_report_ptr->sessionStatus
|
||||
== eQMI_LOC_SESS_STATUS_IN_PROGRESS_V02 ?
|
||||
LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS));
|
||||
LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS),
|
||||
tech_Mask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LocApiAdapter::reportPosition(location,
|
||||
locationExtended,
|
||||
NULL,
|
||||
LOC_SESS_FAILURE);
|
||||
|
||||
|
@ -1544,6 +1710,7 @@ void LocApiV02Adapter :: reportSv (
|
|||
const qmiLocEventGnssSvInfoIndMsgT_v02 *gnss_report_ptr)
|
||||
{
|
||||
GpsSvStatus SvStatus;
|
||||
GpsLocationExtended locationExtended;
|
||||
int num_svs_max, i;
|
||||
const qmiLocSvInfoStructT_v02 *sv_info_ptr;
|
||||
|
||||
|
@ -1552,6 +1719,8 @@ void LocApiV02Adapter :: reportSv (
|
|||
|
||||
num_svs_max = 0;
|
||||
memset (&SvStatus, 0, sizeof (GpsSvStatus));
|
||||
memset(&locationExtended, 0, sizeof (GpsLocationExtended));
|
||||
locationExtended.size = sizeof(locationExtended);
|
||||
if(gnss_report_ptr->svList_valid == 1)
|
||||
{
|
||||
num_svs_max = gnss_report_ptr->svList_len;
|
||||
|
@ -1638,10 +1807,11 @@ void LocApiV02Adapter :: reportSv (
|
|||
}
|
||||
}
|
||||
|
||||
if (SvStatus.num_svs != 0)
|
||||
if (SvStatus.num_svs >= 0)
|
||||
{
|
||||
LOC_LOGV ("%s:%d]: firing SV callback\n", __func__, __LINE__);
|
||||
LocApiAdapter::reportSv(SvStatus,
|
||||
locationExtended,
|
||||
locEngHandle.extSvInfo((void*)gnss_report_ptr));
|
||||
}
|
||||
}
|
||||
|
@ -1717,7 +1887,7 @@ void LocApiV02Adapter :: reportAtlRequest(
|
|||
if(server_request_ptr->requestType == eQMI_LOC_SERVER_REQUEST_OPEN_V02 )
|
||||
{
|
||||
AGpsType agpsType;
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
switch(server_request_ptr->wwanType)
|
||||
{
|
||||
case eQMI_LOC_WWAN_TYPE_INTERNET_V02:
|
||||
|
@ -2053,7 +2223,7 @@ void LocApiV02Adapter :: errorCb(locClientHandleType handle,
|
|||
}
|
||||
|
||||
/* return a Loc API adapter */
|
||||
extern "C" LocApiAdapter* getLocApiAdapter(LocEng &locEng)
|
||||
LocApiAdapter* getLocApiAdapter(LocEng &locEng)
|
||||
{
|
||||
return(new LocApiV02Adapter(locEng));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -34,25 +34,6 @@
|
|||
#include <stdint.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.
|
||||
The members of this class are responsible for converting
|
||||
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 */
|
||||
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 */
|
||||
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
|
||||
setPositionMode(LocPositionMode mode, GpsPositionRecurrence recurrence,
|
||||
uint32_t min_interval, uint32_t preferred_accuracy,
|
||||
uint32_t preferred_time);
|
||||
setPositionMode(const LocPosMode *mode);
|
||||
|
||||
virtual enum loc_api_adapter_err
|
||||
setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
|
||||
|
@ -168,7 +138,7 @@ public:
|
|||
setServer(unsigned int ip, int port, LocServerType type);
|
||||
virtual enum loc_api_adapter_err
|
||||
setXtraData(char* data, int length);
|
||||
#ifdef QCOM_FEATURE_IPV6
|
||||
#ifdef FEATURE_IPV6
|
||||
virtual enum loc_api_adapter_err
|
||||
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear,
|
||||
AGpsType agpsType);
|
||||
|
@ -179,19 +149,25 @@ public:
|
|||
#endif
|
||||
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 setLPPConfig(uint32_t profile);
|
||||
|
||||
virtual enum loc_api_adapter_err
|
||||
setSensorControlConfig(int sensorUsage);
|
||||
|
||||
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
|
||||
setSensorPerfControlConfig(int controlMode,
|
||||
int accelSamplesPerBatch,
|
||||
int accelBatchesPerSec,
|
||||
int gyroSamplesPerBatch,
|
||||
int gyroBatchesPerSec);
|
||||
setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
|
||||
int gyroSamplesPerBatch, int gyroBatchesPerSec,
|
||||
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
|
||||
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
|
||||
virtual enum loc_api_adapter_err setExtPowerConfig(int isBatteryCharging);
|
||||
virtual enum loc_api_adapter_err setAGLONASSProtocol(unsigned long aGlonassProtocol);
|
||||
};
|
||||
|
||||
#endif //LOC_API_V_0_2_ADAPTER_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -25,7 +25,6 @@
|
|||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
@ -36,7 +35,6 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "loc_api_v02_client.h"
|
||||
#include "loc_api_v02_log.h"
|
||||
#include "loc_api_sync_req.h"
|
||||
|
||||
/* 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);
|
||||
|
||||
pthread_mutex_lock(&loc_sync_call_mutex);
|
||||
|
@ -353,7 +351,7 @@ static int loc_sync_select_ind(
|
|||
{
|
||||
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);
|
||||
|
||||
if (select_id < 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -26,6 +26,13 @@
|
|||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "qmi_client.h"
|
||||
#include "qmi_idl_lib.h"
|
||||
#include "qmi_cci_target_ext.h"
|
||||
|
@ -33,23 +40,12 @@
|
|||
#if defined( _ANDROID_)
|
||||
#include "qmi_cci_target.h"
|
||||
#include "qmi_cci_common.h"
|
||||
#elif defined(LOC_UTIL_TARGET_OFF_TARGET)
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#endif //_ANDROID_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include "loc_api_v02_client.h"
|
||||
#include "loc_api_v02_log.h"
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "LocSvc_api_v02"
|
||||
#endif //_ANDROID_
|
||||
|
||||
|
||||
#include "loc_api_v02_client.h"
|
||||
#include "loc_util_log.h"
|
||||
|
||||
#ifdef LOC_UTIL_TARGET_OFF_TARGET
|
||||
|
@ -57,22 +53,17 @@
|
|||
// timeout in ms before send_msg_sync should return
|
||||
#define LOC_CLIENT_ACK_TIMEOUT (5000)
|
||||
|
||||
// timeout in ms before a sync request should return
|
||||
#define LOC_CLIENT_SYNC_REQ_TIMEOUT (5000)
|
||||
|
||||
#else
|
||||
|
||||
// timeout in ms before send_msg_sync should return
|
||||
#define LOC_CLIENT_ACK_TIMEOUT (1000)
|
||||
|
||||
// timeout in ms before a sync request should return
|
||||
#define LOC_CLIENT_SYNC_REQ_TIMEOUT (1000)
|
||||
|
||||
#endif //LOC_UTIL_TARGET_OFF_TARGET
|
||||
|
||||
//timeout in ms to wait for the service to come up
|
||||
//timeout in ms that the service waits for qmi-fw notification
|
||||
#define LOC_CLIENT_SERVICE_TIMEOUT_UNIT (4000)
|
||||
#define LOC_CLIENT_SERVICE_TIMEOUT_TOTAL (60000)
|
||||
// total timeout for the service to come up
|
||||
#define LOC_CLIENT_SERVICE_TIMEOUT_TOTAL (40000)
|
||||
|
||||
/* Table to relate eventId, size and mask value used to enable the event*/
|
||||
typedef struct
|
||||
|
@ -153,7 +144,32 @@ static locClientEventIndTableStructT locClientEventIndTable[]= {
|
|||
//Location Server Connection Request event
|
||||
{ QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_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},
|
||||
|
||||
//Pedometer Control event
|
||||
{ QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02,
|
||||
sizeof(qmiLocEventPedometerControlIndMsgT_v02),
|
||||
QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL_V02 },
|
||||
|
||||
//Motion Data Control event
|
||||
{ QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02,
|
||||
sizeof(qmiLocEventMotionDataControlIndMsgT_v02),
|
||||
QMI_LOC_EVENT_MASK_MOTION_DATA_CONTROL_V02 }
|
||||
};
|
||||
|
||||
/* table to relate the respInd Id with its size */
|
||||
|
@ -346,8 +362,51 @@ static locClientRespIndTableStructT locClientRespIndTable[]= {
|
|||
|
||||
// Get Position Engine Config
|
||||
{ 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)},
|
||||
|
||||
//Inject motion data
|
||||
{ QMI_LOC_INJECT_MOTION_DATA_IND_V02,
|
||||
sizeof(qmiLocInjectMotionDataIndMsgT_v02)},
|
||||
|
||||
//Get NI Geofence list
|
||||
{ QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02,
|
||||
sizeof(qmiLocGetNiGeofenceIdListIndMsgT_v02)},
|
||||
|
||||
//Inject GSM Cell Info
|
||||
{ QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02,
|
||||
sizeof(qmiLocInjectGSMCellInfoIndMsgT_v02)},
|
||||
|
||||
//Inject Network Initiated Message
|
||||
{ QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02,
|
||||
sizeof(qmiLocInjectNetworkInitiatedMessageIndMsgT_v02)},
|
||||
|
||||
//WWAN Out of Service Notification
|
||||
{ QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02,
|
||||
sizeof(qmiLocWWANOutOfServiceNotificationIndMsgT_v02)},
|
||||
|
||||
//Pedomete Report
|
||||
{ QMI_LOC_PEDOMETER_REPORT_IND_V02,
|
||||
sizeof(qmiLocPedometerReportIndMsgT_v02)}
|
||||
};
|
||||
|
||||
|
||||
|
@ -358,7 +417,9 @@ typedef enum { eventIndType =0, respIndType = 1 } locClientIndEnumT;
|
|||
/** @struct locClientInternalState
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
typedef struct locClientCbDataStructT locClientCallbackDataType;
|
||||
|
||||
struct locClientCbDataStructT
|
||||
{
|
||||
// client cookie
|
||||
void *pClientCookie;
|
||||
|
@ -373,7 +434,10 @@ typedef struct
|
|||
// the event mask the client has registered for
|
||||
locClientEventMaskType eventRegMask;
|
||||
|
||||
}locClientCallbackDataType;
|
||||
//pointer to itself for checking consistency data
|
||||
locClientCallbackDataType *pMe;
|
||||
};
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
*
|
||||
|
@ -439,10 +503,12 @@ static bool isClientRegisteredForEvent(
|
|||
{
|
||||
if(eventIndId == locClientEventIndTable[idx].eventId)
|
||||
{
|
||||
LOC_LOGV("%s:%d]: eventId %d registered mask = %llu, "
|
||||
"eventMask = %llu\n", __func__, __LINE__,
|
||||
eventIndId, eventRegMask,
|
||||
locClientEventIndTable[idx].eventMask);
|
||||
LOC_LOGV("%s:%d]: eventId %d registered mask = 0x%04x%04x, "
|
||||
"eventMask = 0x%04x%04x\n", __func__, __LINE__,
|
||||
eventIndId,(uint32_t)(eventRegMask>>32),
|
||||
(uint32_t)(eventRegMask & 0xFFFFFFFF),
|
||||
(uint32_t)(locClientEventIndTable[idx].eventMask >> 32),
|
||||
(uint32_t)(locClientEventIndTable[idx].eventMask & 0xFFFFFFFF));
|
||||
|
||||
return((
|
||||
eventRegMask & locClientEventIndTable[idx].eventMask)?
|
||||
|
@ -468,7 +534,7 @@ static locClientStatusEnumType convertQmiResponseToLocStatus(
|
|||
locClientStatusEnumType status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -477,6 +543,7 @@ static locClientStatusEnumType convertQmiResponseToLocStatus(
|
|||
switch(pResponse->resp.error)
|
||||
{
|
||||
case QMI_ERR_MALFORMED_MSG_V01:
|
||||
case QMI_ERR_INVALID_ARG_V01:
|
||||
status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
|
||||
break;
|
||||
|
||||
|
@ -750,6 +817,41 @@ static bool locClientHandleIndication(
|
|||
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;
|
||||
}
|
||||
|
||||
case QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02 :
|
||||
{
|
||||
//locClientHandlePedometerControlInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02:
|
||||
{
|
||||
//locClientHandleMotionDataControlInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// handle the response indications
|
||||
|
@ -762,6 +864,13 @@ static bool locClientHandleIndication(
|
|||
indBuffer, indSize);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_GET_FIX_CRITERIA_IND_V02:
|
||||
{
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// predicted orbits data response indication
|
||||
case QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_IND_V02:
|
||||
{
|
||||
|
@ -770,6 +879,22 @@ static bool locClientHandleIndication(
|
|||
break;
|
||||
}
|
||||
|
||||
// get predicted orbits source response indication
|
||||
case QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_IND_V02:
|
||||
{
|
||||
//locClientHandleGetPredictedOrbitsSourceInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// get predicted orbits validity response indication
|
||||
case QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_IND_V02:
|
||||
{
|
||||
//locClientHandleGetPredictedOrbitsDataValidityInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_INJECT_SENSOR_DATA_IND_V02 :
|
||||
{
|
||||
//locClientHandleInjectSensorDataInd(user_handle, msg_id, ind_buf, ind_buf_len);
|
||||
|
@ -848,6 +973,62 @@ static bool locClientHandleIndication(
|
|||
status = true;
|
||||
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;
|
||||
}
|
||||
|
||||
case QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02:
|
||||
{
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_PEDOMETER_REPORT_IND_V02:
|
||||
{
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// for indications that only have a "status" field
|
||||
case QMI_LOC_NI_USER_RESPONSE_IND_V02:
|
||||
case QMI_LOC_INJECT_UTC_TIME_IND_V02:
|
||||
|
@ -871,6 +1052,10 @@ static bool locClientHandleIndication(
|
|||
case QMI_LOC_SET_SENSOR_PROPERTIES_IND_V02:
|
||||
case QMI_LOC_INJECT_SUPL_CERTIFICATE_IND_V02:
|
||||
case QMI_LOC_DELETE_SUPL_CERTIFICATE_IND_V02:
|
||||
case QMI_LOC_INJECT_MOTION_DATA_IND_V02:
|
||||
case QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02:
|
||||
case QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02:
|
||||
case QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02:
|
||||
{
|
||||
status = true;
|
||||
break;
|
||||
|
@ -903,13 +1088,16 @@ static void locClientErrorCb
|
|||
{
|
||||
locClientCallbackDataType* pCallbackData =
|
||||
(locClientCallbackDataType *)err_cb_data;
|
||||
locClientErrorCbType localErrorCallback = NULL;
|
||||
|
||||
/* copy the errorCallback function pointer from the callback
|
||||
* data to local variable. This is to protect against the race
|
||||
* condition between open/close and error callback.
|
||||
*/
|
||||
locClientErrorCbType localErrorCallback =
|
||||
pCallbackData->errorCallback;
|
||||
if(NULL != pCallbackData)
|
||||
{
|
||||
localErrorCallback = pCallbackData->errorCallback;
|
||||
}
|
||||
|
||||
LOC_LOGD("%s:%d]: Service Error %d received, pCallbackData = %p\n",
|
||||
__func__, __LINE__, error, err_cb_data);
|
||||
|
@ -921,7 +1109,8 @@ static void locClientErrorCb
|
|||
|
||||
if( (NULL != pCallbackData) &&
|
||||
(NULL != localErrorCallback) &&
|
||||
(NULL != pCallbackData->errorCallback) )
|
||||
(NULL != pCallbackData->errorCallback) &&
|
||||
(pCallbackData == pCallbackData->pMe) )
|
||||
{
|
||||
//invoke the error callback for the corresponding client
|
||||
localErrorCallback(
|
||||
|
@ -963,7 +1152,7 @@ static void locClientIndCb
|
|||
pCallbackData);
|
||||
|
||||
// check callback data
|
||||
if(NULL == pCallbackData)
|
||||
if(NULL == pCallbackData ||(pCallbackData != pCallbackData->pMe))
|
||||
{
|
||||
LOC_LOGE("%s:%d]: invalid callback data", __func__, __LINE__);
|
||||
return;
|
||||
|
@ -972,7 +1161,7 @@ static void locClientIndCb
|
|||
// check 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__,
|
||||
user_handle, pCallbackData->userHandle);
|
||||
return;
|
||||
|
@ -1316,6 +1505,12 @@ static bool validateRequest(
|
|||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocGetSensorPropertiesReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocSetSensorPropertiesReqMsgT_v02);
|
||||
|
@ -1348,6 +1543,61 @@ static bool validateRequest(
|
|||
*pOutLen = sizeof(qmiLocGetPositionEngineConfigParametersReqMsgT_v02);
|
||||
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;
|
||||
}
|
||||
|
||||
case QMI_LOC_INJECT_MOTION_DATA_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocInjectMotionDataReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocGetNiGeofenceIdListReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocInjectGSMCellInfoReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocInjectNetworkInitiatedMessageReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
case QMI_LOC_PEDOMETER_REPORT_REQ_V02:
|
||||
{
|
||||
*pOutLen = sizeof(qmiLocPedometerReportReqMsgT_v02);
|
||||
break;
|
||||
}
|
||||
|
||||
// ALL requests with no payload
|
||||
case QMI_LOC_GET_SERVICE_REVISION_REQ_V02:
|
||||
|
@ -1365,8 +1615,8 @@ static bool validateRequest(
|
|||
case QMI_LOC_GET_CRADLE_MOUNT_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_PROPERTIES_REQ_V02:
|
||||
case QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02:
|
||||
case QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02:
|
||||
{
|
||||
noPayloadFlag = true;
|
||||
break;
|
||||
|
@ -1410,63 +1660,56 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
|||
|
||||
do
|
||||
{
|
||||
uint32_t num_services = 0, num_entries = 0;
|
||||
qmi_client_error_type rc = QMI_NO_ERR;
|
||||
bool nosignal = false;
|
||||
uint32_t num_services = 0, num_entries = 0;
|
||||
qmi_client_error_type rc = QMI_NO_ERR;
|
||||
bool nosignal = false;
|
||||
qmi_client_os_params os_params;
|
||||
int timeout = 0;
|
||||
|
||||
// Get the service object for the qmiLoc Service
|
||||
qmi_idl_service_object_type locClientServiceObject =
|
||||
loc_get_service_object_v02();
|
||||
// Get the service object for the qmiLoc Service
|
||||
qmi_idl_service_object_type locClientServiceObject =
|
||||
loc_get_service_object_v02();
|
||||
|
||||
// Verify that qmiLoc_get_service_object did not return NULL
|
||||
if (NULL == locClientServiceObject)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: qmiLoc_get_service_object_v02 failed\n" ,
|
||||
__func__, __LINE__ );
|
||||
// Verify that qmiLoc_get_service_object did not return NULL
|
||||
if (NULL == locClientServiceObject)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: qmiLoc_get_service_object_v02 failed\n" ,
|
||||
__func__, __LINE__ );
|
||||
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// get the service addressing information
|
||||
rc = qmi_client_get_service_list( locClientServiceObject, NULL, NULL,
|
||||
&num_services);
|
||||
LOC_LOGV("%s:%d]: qmi_client_get_service_list() first try rc %d, "
|
||||
"num_services %d", __func__, __LINE__, rc, num_services);
|
||||
// register for service notification
|
||||
rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
|
||||
notifierInitFlag = (NULL != notifier);
|
||||
|
||||
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);
|
||||
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);
|
||||
// get the service addressing information
|
||||
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
||||
&num_services);
|
||||
/* If service is not up wait on a signal until the service is up
|
||||
* or a timeout occurs. */
|
||||
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);
|
||||
if (!nosignal)
|
||||
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
||||
&num_services);
|
||||
}
|
||||
|
||||
// get the service addressing information
|
||||
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
||||
&num_services);
|
||||
timeout += LOC_CLIENT_SERVICE_TIMEOUT_UNIT;
|
||||
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
|
@ -1515,46 +1758,46 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
|||
break;
|
||||
}
|
||||
|
||||
LOC_LOGV("%s:%d]: passing the pointer %p to qmi_client_init \n",
|
||||
__func__, __LINE__, pLocClientCbData);
|
||||
LOC_LOGV("%s:%d]: passing the pointer %p to qmi_client_init \n",
|
||||
__func__, __LINE__, pLocClientCbData);
|
||||
|
||||
// initialize the client
|
||||
// initialize the client
|
||||
//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,
|
||||
NULL, &clnt);
|
||||
locClientIndCb, (void *) pLocClientCbData,
|
||||
NULL, &clnt);
|
||||
|
||||
if(rc != QMI_NO_ERR)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: qmi_client_init error %d\n",
|
||||
__func__, __LINE__, rc);
|
||||
if(rc != QMI_NO_ERR)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: qmi_client_init error %d\n",
|
||||
__func__, __LINE__, rc);
|
||||
|
||||
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOC_LOGV("%s:%d]: passing the pointer %p to"
|
||||
"qmi_client_register_error_cb \n",
|
||||
__func__, __LINE__, pLocClientCbData);
|
||||
LOC_LOGV("%s:%d]: passing the pointer %p to"
|
||||
"qmi_client_register_error_cb \n",
|
||||
__func__, __LINE__, pLocClientCbData);
|
||||
|
||||
// register error callback
|
||||
rc = qmi_client_register_error_cb(clnt,
|
||||
locClientErrorCb, (void *) pLocClientCbData);
|
||||
// register error callback
|
||||
rc = qmi_client_register_error_cb(clnt,
|
||||
locClientErrorCb, (void *) pLocClientCbData);
|
||||
|
||||
if( QMI_NO_ERR != rc)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: could not register QCCI error callback error:%d\n",
|
||||
__func__, __LINE__, rc);
|
||||
if( QMI_NO_ERR != rc)
|
||||
{
|
||||
LOC_LOGE("%s:%d]: could not register QCCI error callback error:%d\n",
|
||||
__func__, __LINE__, rc);
|
||||
|
||||
status = eLOC_CLIENT_FAILURE_INTERNAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// copy the clnt handle returned in qmi_client_init
|
||||
memcpy(&(pLocClientCbData->userHandle), &clnt, sizeof(qmi_client_type));
|
||||
// copy the clnt handle returned in qmi_client_init
|
||||
memcpy(&(pLocClientCbData->userHandle), &clnt, sizeof(qmi_client_type));
|
||||
|
||||
status = eLOC_CLIENT_SUCCESS;
|
||||
|
||||
|
@ -1603,21 +1846,18 @@ locClientStatusEnumType locClientOpen (
|
|||
locClientStatusEnumType status = eLOC_CLIENT_SUCCESS;
|
||||
locClientCallbackDataType *pCallbackData = NULL;
|
||||
|
||||
LOC_LOGV("%s:%d] \n", __func__, __LINE__);
|
||||
// check input parameters
|
||||
if( (NULL == pLocClientCallbacks) || (NULL == pLocClientHandle)
|
||||
|| (NULL == pLocClientCallbacks->respIndCb) ||
|
||||
(pLocClientCallbacks->size != sizeof(locClientCallbacksType)))
|
||||
{
|
||||
LOC_LOGE("%s:%d]: Invalid parameters in locClientOpen\n",
|
||||
__func__, __LINE__);
|
||||
return eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
// check input parameters
|
||||
if( (NULL == pLocClientCallbacks) || (NULL == pLocClientHandle)
|
||||
|| (NULL == pLocClientCallbacks->respIndCb) ||
|
||||
(pLocClientCallbacks->size != sizeof(locClientCallbacksType)))
|
||||
{
|
||||
LOC_LOGE("%s:%d]: Invalid parameters in locClientOpen\n",
|
||||
__func__, __LINE__);
|
||||
status = eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
// Allocate memory for the callback data
|
||||
pCallbackData =
|
||||
( locClientCallbackDataType*)calloc(
|
||||
|
@ -1648,9 +1888,12 @@ locClientStatusEnumType locClientOpen (
|
|||
{
|
||||
free(pCallbackData);
|
||||
pCallbackData = NULL;
|
||||
LOC_LOGE ("%s:%d] locClientQmiCtrlPointInit returned %d\n",
|
||||
__func__, __LINE__, status);
|
||||
break;
|
||||
}
|
||||
|
||||
// set the self pointer
|
||||
pCallbackData->pMe = pCallbackData;
|
||||
// set the handle to the callback data
|
||||
*pLocClientHandle = (locClientHandleType)pCallbackData;
|
||||
|
||||
|
@ -1685,15 +1928,19 @@ locClientStatusEnumType locClientOpen (
|
|||
// set the client cookie
|
||||
pCallbackData->pClientCookie = (void *)pClientCookie;
|
||||
|
||||
LOC_LOGD("%s:%d]: returning handle = 0x%x, user_handle=0x%x, status = %d\n",
|
||||
__func__, __LINE__, *pLocClientHandle,
|
||||
pCallbackData->userHandle, status);
|
||||
|
||||
}while(0);
|
||||
|
||||
if(eLOC_CLIENT_SUCCESS != status)
|
||||
{
|
||||
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
||||
LOC_LOGE("%s:%d]: Error! status = %d\n", __func__, __LINE__,status);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
LOC_LOGD("%s:%d]: returning handle = %p, user_handle=%p, status = %d\n",
|
||||
__func__, __LINE__, *pLocClientHandle,
|
||||
pCallbackData->userHandle, status);
|
||||
}
|
||||
|
||||
return(status);
|
||||
|
@ -1712,6 +1959,8 @@ locClientStatusEnumType locClientOpen (
|
|||
locClientStatusEnumType locClientClose(
|
||||
locClientHandleType* pLocClientHandle)
|
||||
{
|
||||
// convert handle to callback data
|
||||
locClientCallbackDataType *pCallbackData;
|
||||
qmi_client_error_type rc = QMI_NO_ERR; //No error
|
||||
|
||||
if(NULL == pLocClientHandle)
|
||||
|
@ -1723,15 +1972,12 @@ locClientStatusEnumType locClientClose(
|
|||
return(eLOC_CLIENT_FAILURE_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
// convert handle to callback data
|
||||
locClientCallbackDataType *pCallbackData =
|
||||
(locClientCallbackDataType *)(*pLocClientHandle);
|
||||
|
||||
LOC_LOGV("%s:%d]:\n", __func__, __LINE__ );
|
||||
pCallbackData = (locClientCallbackDataType *)(*pLocClientHandle);
|
||||
|
||||
// check the input handle for sanity
|
||||
if(NULL == pCallbackData ||
|
||||
NULL == pCallbackData->userHandle)
|
||||
NULL == pCallbackData->userHandle ||
|
||||
pCallbackData != pCallbackData->pMe )
|
||||
{
|
||||
// invalid handle
|
||||
LOC_LOGE("%s:%d]: invalid handle \n",
|
||||
|
@ -1740,7 +1986,7 @@ locClientStatusEnumType locClientClose(
|
|||
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 );
|
||||
|
||||
// NEXT call goes out to modem. We log the callflow before it
|
||||
|
@ -1748,6 +1994,7 @@ locClientStatusEnumType locClientClose(
|
|||
// back from the modem, to avoid confusing log order. We trust
|
||||
// that the QMI framework is robust.
|
||||
EXIT_LOG_CALLFLOW(%s, "loc client close");
|
||||
|
||||
// release the handle
|
||||
rc = qmi_client_release(pCallbackData->userHandle);
|
||||
if(QMI_NO_ERR != rc )
|
||||
|
@ -1769,7 +2016,6 @@ locClientStatusEnumType locClientClose(
|
|||
|
||||
// set the handle to invalid value
|
||||
*pLocClientHandle = LOC_CLIENT_INVALID_HANDLE_VALUE;
|
||||
|
||||
return eLOC_CLIENT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1808,7 +2054,8 @@ locClientStatusEnumType locClientSendReq(
|
|||
|
||||
// check the input handle for sanity
|
||||
if(NULL == pCallbackData ||
|
||||
NULL == pCallbackData->userHandle )
|
||||
NULL == pCallbackData->userHandle ||
|
||||
pCallbackData != pCallbackData->pMe )
|
||||
{
|
||||
// did not find the handle in the client List
|
||||
LOC_LOGE("%s:%d]: invalid handle \n",
|
||||
|
@ -1835,7 +2082,6 @@ locClientStatusEnumType locClientSendReq(
|
|||
// back from the modem, to avoid confusing log order. We trust
|
||||
// that the QMI framework is robust.
|
||||
EXIT_LOG_CALLFLOW(%s, loc_get_v02_event_name(reqId));
|
||||
|
||||
rc = qmi_client_send_msg_sync(
|
||||
pCallbackData->userHandle,
|
||||
reqId,
|
||||
|
@ -1857,6 +2103,17 @@ locClientStatusEnumType locClientSendReq(
|
|||
// map the QCCI response to Loc API v02 status
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -191,6 +191,44 @@ 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_RESP_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),
|
||||
NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_IND_V02),
|
||||
NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_IND_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_IND_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_IND_V02),
|
||||
NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_IND_V02),
|
||||
NAME_VAL(QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02),
|
||||
NAME_VAL(QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02),
|
||||
NAME_VAL(QMI_LOC_PEDOMETER_REPORT_REQ_V02),
|
||||
NAME_VAL(QMI_LOC_PEDOMETER_REPORT_RESP_V02),
|
||||
NAME_VAL(QMI_LOC_PEDOMETER_REPORT_IND_V02)
|
||||
};
|
||||
static int loc_v02_event_num = sizeof(loc_v02_event_name) / sizeof(loc_name_val_s_type);
|
||||
|
||||
|
@ -214,6 +252,7 @@ static loc_name_val_s_type loc_v02_client_status_name[] =
|
|||
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
|
||||
NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
|
||||
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);
|
||||
|
||||
|
@ -233,6 +272,8 @@ static loc_name_val_s_type loc_v02_qmi_status_name[] =
|
|||
eQMI_LOC_ENGINE_BUSY_V02,
|
||||
eQMI_LOC_PHONE_OFFLINE_V02,
|
||||
eQMI_LOC_TIMEOUT_V02,
|
||||
eQMI_LOC_CONFIG_NOT_SUPPORTED_V02,
|
||||
eQMI_LOC_INSUFFICIENT_MEMORY_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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -24,13 +24,18 @@
|
|||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef 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
|
||||
#define LOC_LOGE(...) printf(__VA_ARGS__)
|
||||
//warning logs
|
||||
|
@ -45,22 +50,17 @@
|
|||
#define MODEM_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
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//error logs
|
||||
#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__)
|
||||
# include <asm/errno.h>
|
||||
# include <sys/time.h>
|
||||
|
||||
// get around strl*: not found in glibc
|
||||
// TBD:look for presence of eglibc other libraries
|
||||
|
@ -68,14 +68,8 @@
|
|||
#define strlcpy(X,Y,Z) strcpy(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 //_ANDROID_
|
||||
|
||||
#endif //LOC_UTIL_LOG_H
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -36,14 +36,7 @@ extern "C"
|
|||
#endif
|
||||
|
||||
#include <hardware/gps.h>
|
||||
|
||||
typedef int (ulp_report_position_cb)
|
||||
(
|
||||
void* owner,
|
||||
const GpsLocation* location_report_ptr,
|
||||
unsigned int ext_data_length,
|
||||
unsigned char* ext_data
|
||||
);
|
||||
#include "loc_eng.h"
|
||||
|
||||
/** Represents the standard ulp module interface. */
|
||||
typedef struct {
|
||||
|
@ -51,24 +44,14 @@ typedef struct {
|
|||
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 */
|
||||
int (*start_fix)( void );
|
||||
|
||||
/** Stops the ulp engine. 0: success */
|
||||
int (*stop_fix)( void );
|
||||
|
||||
/** Closes the interface */
|
||||
int (*destroy)( void );
|
||||
|
||||
} ulpInterface;
|
||||
}ulpInterface;
|
||||
|
||||
typedef const ulpInterface* (get_ulp_interface) (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#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 \
|
||||
-D_ANDROID_
|
||||
|
||||
LOCAL_LDFLAGS += -Wl,--export-dynamic
|
||||
|
||||
## Includes
|
||||
LOCAL_C_INCLUDES:=
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -47,28 +47,14 @@
|
|||
*============================================================================*/
|
||||
|
||||
/* Parameter data */
|
||||
loc_gps_cfg_s_type gps_conf;
|
||||
static uint8_t DEBUG_LEVEL = 3;
|
||||
static uint8_t TIMESTAMP = 0;
|
||||
|
||||
/* Parameter spec table */
|
||||
|
||||
loc_param_s_type loc_parameter_table[] =
|
||||
static loc_param_s_type loc_parameter_table[] =
|
||||
{
|
||||
{"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, 'n'},
|
||||
{"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, 'n'},
|
||||
{"ENABLE_WIPER", &gps_conf.ENABLE_WIPER, 'n'},
|
||||
/* DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
|
||||
4 - Debug, 5 - Verbose */
|
||||
{"DEBUG_LEVEL", &gps_conf.DEBUG_LEVEL, 'n'},
|
||||
{"SUPL_VER", &gps_conf.SUPL_VER, 'n'},
|
||||
{"CAPABILITIES", &gps_conf.CAPABILITIES, 'n'},
|
||||
{"TIMESTAMP", &gps_conf.TIMESTAMP, 'n'},
|
||||
{"GYRO_BIAS_RANDOM_WALK", &gps_conf.GYRO_BIAS_RANDOM_WALK, 'f'},
|
||||
{"SENSOR_ACCEL_BATCHES_PER_SEC", &gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC, 'n'},
|
||||
{"SENSOR_ACCEL_SAMPLES_PER_BATCH", &gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, 'n'},
|
||||
{"SENSOR_GYRO_BATCHES_PER_SEC", &gps_conf.SENSOR_GYRO_BATCHES_PER_SEC, 'n'},
|
||||
{"SENSOR_GYRO_SAMPLES_PER_BATCH", &gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, 'n'},
|
||||
{"SENSOR_CONTROL_MODE", &gps_conf.SENSOR_CONTROL_MODE, 'n'},
|
||||
{"SENSOR_USAGE", &gps_conf.SENSOR_USAGE, 'n'},
|
||||
{"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
|
||||
{"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
|
||||
};
|
||||
|
||||
int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type);
|
||||
|
@ -92,29 +78,11 @@ SIDE EFFECTS
|
|||
static void loc_default_parameters()
|
||||
{
|
||||
/* defaults */
|
||||
gps_conf.INTERMEDIATE_POS = 0;
|
||||
gps_conf.ACCURACY_THRES = 0;
|
||||
gps_conf.ENABLE_WIPER = 0;
|
||||
gps_conf.DEBUG_LEVEL = 3; /* debug level */
|
||||
gps_conf.SUPL_VER = 0x10000;
|
||||
gps_conf.CAPABILITIES = 0x7;
|
||||
gps_conf.TIMESTAMP = 0;
|
||||
|
||||
gps_conf.GYRO_BIAS_RANDOM_WALK = 0;
|
||||
|
||||
gps_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
|
||||
gps_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
|
||||
gps_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
|
||||
gps_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
|
||||
gps_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
|
||||
gps_conf.SENSOR_USAGE = 0; /* Enabled */
|
||||
|
||||
/* Value MUST be set by OEMs in configuration for sensor-assisted
|
||||
navigation to work. There is NO default value */
|
||||
gps_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
|
||||
DEBUG_LEVEL = 3; /* debug level */
|
||||
TIMESTAMP = 0;
|
||||
|
||||
/* reset logging mechanism */
|
||||
loc_logger_init(gps_conf.DEBUG_LEVEL, 0);
|
||||
loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
@ -161,11 +129,26 @@ void trim_space(char *org_string)
|
|||
if (last_nonspace) { *last_nonspace = '\0'; }
|
||||
}
|
||||
|
||||
typedef struct loc_param_v_type
|
||||
{
|
||||
char* param_name;
|
||||
|
||||
char* param_str_value;
|
||||
int param_int_value;
|
||||
double param_double_value;
|
||||
}loc_param_v_type;
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_read_gps_conf
|
||||
FUNCTION loc_set_config_entry
|
||||
|
||||
DESCRIPTION
|
||||
Reads the gps.conf file and sets global parameter data
|
||||
Potentially sets a given configuration table entry based on the passed in
|
||||
configuration value. This is done by using a string comparison of the
|
||||
parameter names and those found in the configuration file.
|
||||
|
||||
PARAMETERS:
|
||||
config_entry: configuration entry in the table to possibly set
|
||||
config_value: value to store in the entry if the parameter names match
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
@ -176,97 +159,152 @@ RETURN VALUE
|
|||
SIDE EFFECTS
|
||||
N/A
|
||||
===========================================================================*/
|
||||
void loc_read_gps_conf(void)
|
||||
void loc_set_config_entry(loc_param_s_type* config_entry, loc_param_v_type* config_value)
|
||||
{
|
||||
if(NULL == config_entry || NULL == config_value)
|
||||
{
|
||||
LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(config_entry->param_name, config_value->param_name) == 0 &&
|
||||
config_entry->param_ptr)
|
||||
{
|
||||
switch (config_entry->param_type)
|
||||
{
|
||||
case 's':
|
||||
if (strcmp(config_value->param_str_value, "NULL") == 0)
|
||||
{
|
||||
*((char*)config_entry->param_ptr) = '\0';
|
||||
}
|
||||
else {
|
||||
strlcpy((char*) config_entry->param_ptr,
|
||||
config_value->param_str_value,
|
||||
LOC_MAX_PARAM_STRING + 1);
|
||||
}
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, config_entry->param_name, (char*)config_entry->param_ptr);
|
||||
|
||||
if(NULL != config_entry->param_set)
|
||||
{
|
||||
*(config_entry->param_set) = 1;
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
*((int *)config_entry->param_ptr) = config_value->param_int_value;
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, config_entry->param_name, config_value->param_int_value);
|
||||
|
||||
if(NULL != config_entry->param_set)
|
||||
{
|
||||
*(config_entry->param_set) = 1;
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
*((double *)config_entry->param_ptr) = config_value->param_double_value;
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, config_entry->param_name, config_value->param_double_value);
|
||||
|
||||
if(NULL != config_entry->param_set)
|
||||
{
|
||||
*(config_entry->param_set) = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", __FUNCTION__, config_entry->param_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_read_conf
|
||||
|
||||
DESCRIPTION
|
||||
Reads the specified configuration file and sets defined values based on
|
||||
the passed in configuration table. This table maps strings to values to
|
||||
set along with the type of each of these values.
|
||||
|
||||
PARAMETERS:
|
||||
conf_file_name: configuration file to read
|
||||
config_table: table definition of strings to places to store information
|
||||
table_length: length of the configuration table
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
||||
RETURN VALUE
|
||||
None
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
===========================================================================*/
|
||||
void loc_read_conf(const char* conf_file_name, loc_param_s_type* config_table, uint32_t table_length)
|
||||
{
|
||||
FILE *gps_conf_fp = NULL;
|
||||
char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */
|
||||
char *lasts;
|
||||
char *param_name, *param_str_value;
|
||||
int param_int_value = 0;
|
||||
double param_double_value = 0;
|
||||
int i;
|
||||
loc_param_v_type config_value;
|
||||
uint32_t i;
|
||||
|
||||
loc_default_parameters();
|
||||
|
||||
if((gps_conf_fp = fopen(GPS_CONF_FILE, "r")) != NULL)
|
||||
if((gps_conf_fp = fopen(conf_file_name, "r")) != NULL)
|
||||
{
|
||||
LOC_LOGD("%s: using %s", __FUNCTION__, GPS_CONF_FILE);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOC_LOGW("%s: no %s file, using defaults", __FUNCTION__, GPS_CONF_FILE);
|
||||
LOC_LOGW("%s: no %s file found", __FUNCTION__, GPS_CONF_FILE);
|
||||
return; /* no parameter file */
|
||||
}
|
||||
|
||||
/* Clear all validity bits */
|
||||
for(i = 0; NULL != config_table && i < table_length; i++)
|
||||
{
|
||||
if(NULL != config_table[i].param_set)
|
||||
{
|
||||
*(config_table[i].param_set) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
while(fgets(input_buf, LOC_MAX_PARAM_LINE, gps_conf_fp) != NULL)
|
||||
{
|
||||
memset(&config_value, 0, sizeof(config_value));
|
||||
|
||||
/* Separate variable and value */
|
||||
param_name = strtok_r(input_buf, "=", &lasts);
|
||||
if (param_name == NULL) continue; /* skip lines that do not contain "=" */
|
||||
param_str_value = strtok_r(NULL, "=", &lasts);
|
||||
if (param_str_value == NULL) continue; /* skip lines that do not contain two operands */
|
||||
config_value.param_name = strtok_r(input_buf, "=", &lasts);
|
||||
if (config_value.param_name == NULL) continue; /* skip lines that do not contain "=" */
|
||||
config_value.param_str_value = strtok_r(NULL, "=", &lasts);
|
||||
if (config_value.param_str_value == NULL) continue; /* skip lines that do not contain two operands */
|
||||
|
||||
/* Trim leading and trailing spaces */
|
||||
trim_space(param_name);
|
||||
trim_space(param_str_value);
|
||||
|
||||
// printf("*(%s) = (%s)\n", param_name, param_str_value);
|
||||
trim_space(config_value.param_name);
|
||||
trim_space(config_value.param_str_value);
|
||||
|
||||
/* Parse numerical value */
|
||||
if (param_str_value[0] == '0' && tolower(param_str_value[1]) == 'x')
|
||||
if (config_value.param_str_value[0] == '0' && tolower(config_value.param_str_value[1]) == 'x')
|
||||
{
|
||||
/* hex */
|
||||
param_int_value = (int) strtol(¶m_str_value[2], (char**) NULL, 16);
|
||||
config_value.param_int_value = (int) strtol(&config_value.param_str_value[2], (char**) NULL, 16);
|
||||
}
|
||||
else {
|
||||
param_double_value = (double) atof(param_str_value); /* float */
|
||||
param_int_value = atoi(param_str_value); /* dec */
|
||||
config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */
|
||||
config_value.param_int_value = atoi(config_value.param_str_value); /* dec */
|
||||
}
|
||||
|
||||
if (strcmp("GYRO_BIAS_RANDOM_WALK", param_name) == 0)
|
||||
for(i = 0; NULL != config_table && i < table_length; i++)
|
||||
{
|
||||
gps_conf.GYRO_BIAS_RANDOM_WALK_VALID = 1;
|
||||
loc_set_config_entry(&config_table[i], &config_value);
|
||||
}
|
||||
|
||||
for(i = 0; i < loc_param_num; i++)
|
||||
{
|
||||
if (strcmp(loc_parameter_table[i].param_name, param_name) == 0 &&
|
||||
loc_parameter_table[i].param_ptr)
|
||||
{
|
||||
switch (loc_parameter_table[i].param_type)
|
||||
{
|
||||
case 's':
|
||||
if (strcmp(param_str_value, "NULL") == 0)
|
||||
{
|
||||
*((char*)loc_parameter_table[i].param_ptr) = '\0';
|
||||
}
|
||||
else {
|
||||
strlcpy((char*) loc_parameter_table[i].param_ptr,
|
||||
param_str_value,
|
||||
LOC_MAX_PARAM_STRING + 1);
|
||||
}
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, param_name, (char*)loc_parameter_table[i].param_ptr);
|
||||
break;
|
||||
case 'n':
|
||||
*((int *)loc_parameter_table[i].param_ptr) = param_int_value;
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, param_name, param_int_value);
|
||||
break;
|
||||
case 'f':
|
||||
*((double *)loc_parameter_table[i].param_ptr) = param_double_value;
|
||||
/* Log INI values */
|
||||
LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, param_name, param_double_value);
|
||||
break;
|
||||
default:
|
||||
LOC_LOGE("%s: PARAM %s parameter type must be n or n", __FUNCTION__, param_name);
|
||||
}
|
||||
}
|
||||
loc_set_config_entry(&loc_parameter_table[i], &config_value);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(gps_conf_fp);
|
||||
|
||||
/* Initialize logging mechanism with parsed data */
|
||||
loc_logger_init(gps_conf.DEBUG_LEVEL, gps_conf.TIMESTAMP);
|
||||
loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -30,7 +30,9 @@
|
|||
#ifndef LOC_CFG_H
|
||||
#define LOC_CFG_H
|
||||
|
||||
#define LOC_MAX_PARAM_NAME 36
|
||||
#include <stdint.h>
|
||||
|
||||
#define LOC_MAX_PARAM_NAME 48
|
||||
#define LOC_MAX_PARAM_STRING 80
|
||||
#define LOC_MAX_PARAM_LINE 80
|
||||
|
||||
|
@ -39,6 +41,12 @@
|
|||
#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
|
||||
#endif
|
||||
|
||||
#define UTIL_READ_CONF_DEFAULT(filename) \
|
||||
loc_read_conf((filename), NULL, 0);
|
||||
|
||||
#define UTIL_READ_CONF(filename, config_table) \
|
||||
loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0]))
|
||||
|
||||
/*=============================================================================
|
||||
*
|
||||
* MODULE TYPE DECLARATION
|
||||
|
@ -48,30 +56,12 @@ typedef struct
|
|||
{
|
||||
char param_name[LOC_MAX_PARAM_NAME];
|
||||
void *param_ptr;
|
||||
char param_type; /* 'n' for number; 's' for string */
|
||||
uint8_t *param_set; /* was this value set by config file? */
|
||||
char param_type; /* 'n' for number,
|
||||
's' for string,
|
||||
'f' for float */
|
||||
} loc_param_s_type;
|
||||
|
||||
/* GPS.conf support */
|
||||
typedef struct loc_gps_cfg_s
|
||||
{
|
||||
unsigned long INTERMEDIATE_POS;
|
||||
unsigned long ACCURACY_THRES;
|
||||
unsigned long ENABLE_WIPER;
|
||||
unsigned long DEBUG_LEVEL;
|
||||
unsigned long SUPL_VER;
|
||||
unsigned long CAPABILITIES;
|
||||
unsigned long TIMESTAMP;
|
||||
unsigned long 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;
|
||||
// char string_val[LOC_MAX_PARAM_STRING + 1]; /* An example string value */
|
||||
} loc_gps_cfg_s_type;
|
||||
|
||||
/*=============================================================================
|
||||
*
|
||||
* MODULE EXTERNAL DATA
|
||||
|
@ -82,14 +72,14 @@ typedef struct loc_gps_cfg_s
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern loc_gps_cfg_s_type gps_conf;
|
||||
|
||||
/*=============================================================================
|
||||
*
|
||||
* MODULE EXPORTED FUNCTIONS
|
||||
*
|
||||
*============================================================================*/
|
||||
extern void loc_read_gps_conf(void);
|
||||
extern void loc_read_conf(const char* conf_file_name,
|
||||
loc_param_s_type* config_table,
|
||||
uint32_t table_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
|
|
@ -135,7 +135,6 @@ else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGV("W/"__VA_ARGS__); }
|
|||
#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL)
|
||||
|
||||
|
||||
#ifdef DEBUG_TRACE_CALLFLOW
|
||||
// Used for logging callflow from Android Framework
|
||||
#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "")
|
||||
// Used for logging callflow to Modem
|
||||
|
@ -144,12 +143,6 @@ else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGV("W/"__VA_ARGS__); }
|
|||
#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, SPEC, VAL)
|
||||
// Used for logging callflow to Android Framework
|
||||
#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
|
||||
#else
|
||||
#define ENTRY_LOG_CALLFLOW()
|
||||
#define EXIT_LOG_CALLFLOW(SPEC, VAL)
|
||||
#define MODEM_LOG_CALLFLOW(SPEC, VAL)
|
||||
#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -9,7 +9,7 @@
|
|||
* 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 Code Aurora Forum, Inc. nor the names of its
|
||||
* * Neither the name of The Linux Foundation, nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
|
@ -249,7 +249,7 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj)
|
|||
|
||||
pthread_mutex_unlock(&p_msg_q->list_mutex);
|
||||
|
||||
LOC_LOGD("%s: Received message %p rv = %d\n", __FUNCTION__, *msg_obj, rv);
|
||||
LOC_LOGD("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue