Merge "Make Loc Init Asynchronous"
This commit is contained in:
commit
97b0048346
4 changed files with 28 additions and 12 deletions
|
@ -62,6 +62,9 @@
|
||||||
/* Logging Improvement */
|
/* Logging Improvement */
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
|
|
||||||
|
/*Maximum number of Modem init*/
|
||||||
|
#define RPC_TRY_NUM 10
|
||||||
|
|
||||||
/* Uncomment to force ALOGD messages */
|
/* Uncomment to force ALOGD messages */
|
||||||
// #define ALOGD ALOGI
|
// #define ALOGD ALOGI
|
||||||
|
|
||||||
|
@ -308,6 +311,7 @@ rpc_loc_client_handle_type loc_open (
|
||||||
void* userData
|
void* userData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
int try_num = RPC_TRY_NUM;
|
||||||
ENTRY_LOG();
|
ENTRY_LOG();
|
||||||
LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
|
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;
|
enum clnt_stat stat = RPC_SUCCESS;
|
||||||
|
|
||||||
EXIT_LOG_CALLFLOW(%s, "loc client open");
|
EXIT_LOG_CALLFLOW(%s, "loc client open");
|
||||||
|
|
||||||
|
/*try more for rpc_loc_open_xx()*/
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
|
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);
|
LOC_GLUE_CHECK_RESULT(stat, int32);
|
||||||
|
|
||||||
/* save the handle in the table */
|
/* save the handle in the table */
|
||||||
loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
|
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;
|
return ret_val;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,14 +348,9 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
||||||
} else {
|
} else {
|
||||||
LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.client_handle);
|
LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.client_handle);
|
||||||
|
|
||||||
// call reinit to send initialization messages
|
/*send reinit event to QMI instead of call reinit directly*/
|
||||||
int tries = 30;
|
loc_eng_msg *msg(new loc_eng_msg(locEngHandle.owner, LOC_ENG_MSG_LOC_INIT));
|
||||||
while (tries > 0 &&
|
locEngHandle.sendMsge(locEngHandle.owner, msg);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXIT_LOG(%d, ret_val);
|
EXIT_LOG(%d, ret_val);
|
||||||
|
@ -1869,6 +1864,11 @@ static void loc_eng_deferred_action_thread(void* arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LOC_ENG_MSG_LOC_INIT:
|
||||||
|
{
|
||||||
|
loc_eng_reinit(*loc_eng_data_p);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOC_LOGE("unsupported msgid = %d\n", msg->msgid);
|
LOC_LOGE("unsupported msgid = %d\n", msg->msgid);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -107,7 +107,8 @@ static loc_name_val_s_type loc_eng_msgs[] =
|
||||||
NAME_VAL( ULP_MSG_MONITOR ),
|
NAME_VAL( ULP_MSG_MONITOR ),
|
||||||
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG ),
|
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG ),
|
||||||
NAME_VAL( ULP_MSG_INJECT_RAW_COMMAND ),
|
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);
|
static int loc_eng_msgs_num = sizeof(loc_eng_msgs) / sizeof(loc_name_val_s_type);
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,9 @@ enum loc_eng_msg_ids_t {
|
||||||
|
|
||||||
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
|
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
|
||||||
LOC_ENG_MSG_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
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in a new issue