Merge "Loc_Api: Support A-GLONASS Position protocol"

This commit is contained in:
Linux Build Service Account 2012-11-20 00:58:20 -08:00 committed by Gerrit - the friendly Code Review server
commit 283899e1fe
8 changed files with 75 additions and 1 deletions

View file

@ -216,6 +216,9 @@ public:
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;}

View file

@ -105,6 +105,7 @@ static loc_param_s_type loc_parameter_table[] =
{"SENSOR_ALGORITHM_CONFIG_MASK", &gps_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
{"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'},
{"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
{"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
};
static void loc_default_parameters(void)
@ -145,6 +146,9 @@ static void loc_default_parameters(void)
/* LTE Positioning Profile configuration is disable by default*/
gps_conf.LPP_PROFILE = 0;
/*By default no positioning protocol is selected on A-GLONASS system*/
gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
}
LocEngContext::LocEngContext(gps_create_thread threadCreator) :
@ -367,6 +371,11 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q,
sensor_control_config_msg, loc_eng_free_msg);
loc_eng_msg_a_glonass_protocol *a_glonass_protocol_msg(new loc_eng_msg_a_glonass_protocol(&loc_eng_data,
gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
msg_q_snd((void*)((LocEngContext*)(loc_eng_data.context))->deferred_q,
a_glonass_protocol_msg, loc_eng_free_msg);
/* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
if( gps_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
gps_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
@ -1430,6 +1439,13 @@ static void loc_eng_deferred_action_thread(void* arg)
}
break;
case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
{
loc_eng_msg_a_glonass_protocol *svMsg = (loc_eng_msg_a_glonass_protocol*)msg;
loc_eng_data_p->client_handle->setAGLONASSProtocol(svMsg->a_glonass_protocol);
}
break;
case LOC_ENG_MSG_SUPL_VERSION:
{
loc_eng_msg_suple_version *svMsg = (loc_eng_msg_suple_version*)msg;

1
loc_api/libloc_api_50001/loc_eng.h Normal file → Executable file
View file

@ -180,6 +180,7 @@ typedef struct loc_gps_cfg_s
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;

3
loc_api/libloc_api_50001/loc_eng_log.cpp Normal file → Executable file
View file

@ -104,7 +104,8 @@ static loc_name_val_s_type loc_eng_msgs[] =
NAME_VAL( ULP_MSG_INJECT_NETWORK_POSITION ),
NAME_VAL( ULP_MSG_REPORT_QUIPC_POSITION ),
NAME_VAL( ULP_MSG_REQUEST_COARSE_POSITION ),
NAME_VAL( LOC_ENG_MSG_LPP_CONFIG )
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);

View file

@ -158,6 +158,16 @@ struct loc_eng_msg {
}
};
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) :

View file

@ -128,6 +128,9 @@ enum loc_eng_msg_ids_t {
// Message is sent by Android framework (GpsLocationProvider)
// to inject the raw command
ULP_MSG_INJECT_RAW_COMMAND,
/* Message is sent by HAL to LOC API to select A-GLONASS protocol */
LOC_ENG_MSG_A_GLONASS_PROTOCOL,
};
#ifdef __cplusplus

View file

@ -1441,6 +1441,45 @@ enum loc_api_adapter_err LocApiV02Adapter :: setExtPowerConfig(int isBatteryChar
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)

1
loc_api/loc_api_v02/LocApiV02Adapter.h Normal file → Executable file
View file

@ -161,6 +161,7 @@ public:
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