Merge "Make Loc Init Asynchronous"

This commit is contained in:
Linux Build Service Account 2013-06-28 18:11:14 -07:00 committed by Gohulan Balachandran
commit 97b0048346
4 changed files with 28 additions and 12 deletions

View file

@ -62,6 +62,9 @@
/* Logging Improvement */
#include "log_util.h"
/*Maximum number of Modem init*/
#define RPC_TRY_NUM 10
/* Uncomment to force ALOGD messages */
// #define ALOGD ALOGI
@ -308,6 +311,7 @@ rpc_loc_client_handle_type loc_open (
void* userData
)
{
int try_num = RPC_TRY_NUM;
ENTRY_LOG();
LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
@ -352,14 +356,22 @@ rpc_loc_client_handle_type loc_open (
enum clnt_stat stat = RPC_SUCCESS;
EXIT_LOG_CALLFLOW(%s, "loc client open");
stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
/*try more for rpc_loc_open_xx()*/
do
{
stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
try_num--;
}while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
LOC_GLUE_CHECK_RESULT(stat, int32);
/* save the handle in the table */
loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
return ret_val;
}

View file

@ -348,14 +348,9 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
} else {
LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.client_handle);
// call reinit to send initialization messages
int tries = 30;
while (tries > 0 &&
LOC_API_ADAPTER_ERR_SUCCESS != (ret_val = loc_eng_reinit(loc_eng_data))) {
tries--;
LOC_LOGD("loc_eng_init client open failed, %d more tries", tries);
sleep(1);
}
/*send reinit event to QMI instead of call reinit directly*/
loc_eng_msg *msg(new loc_eng_msg(locEngHandle.owner, LOC_ENG_MSG_LOC_INIT));
locEngHandle.sendMsge(locEngHandle.owner, msg);
}
EXIT_LOG(%d, ret_val);
@ -1869,6 +1864,11 @@ static void loc_eng_deferred_action_thread(void* arg)
}
break;
case LOC_ENG_MSG_LOC_INIT:
{
loc_eng_reinit(*loc_eng_data_p);
}
default:
LOC_LOGE("unsupported msgid = %d\n", msg->msgid);
break;

View file

@ -107,7 +107,8 @@ static loc_name_val_s_type loc_eng_msgs[] =
NAME_VAL( ULP_MSG_MONITOR ),
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG ),
NAME_VAL( ULP_MSG_INJECT_RAW_COMMAND ),
NAME_VAL( LOC_ENG_MSG_A_GLONASS_PROTOCOL )
NAME_VAL( LOC_ENG_MSG_A_GLONASS_PROTOCOL ),
NAME_VAL( LOC_ENG_MSG_LOC_INIT )
};
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);

View file

@ -133,6 +133,9 @@ enum loc_eng_msg_ids_t {
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
LOC_ENG_MSG_A_GLONASS_PROTOCOL,
//Message is sent by LOC to do LOC INIT
LOC_ENG_MSG_LOC_INIT,
};
#ifdef __cplusplus