gps: control session state evt from HAL, not modem

Suppress the registering for QMI_LOC_EVENT_MASK_FIX_SESSION_STATE_V02
event from modem, that is normally responsible for generating
GPS_STATUS_SESSION_BEGIN and GPS_STATUS_SESSION_END, and instead
initiate these events from hal from when we get GPS_STATUS_ENGINE_ON
and GPS_STATUS_ENGINE_OFF.

Change-Id: I9d220bef7ee4f989a3982d888ed46279861f612d
This commit is contained in:
Ajay Dudani 2012-09-12 11:20:16 -07:00 committed by Brian Muramatsu
parent 0620ede4b3
commit ac8fa07a02
2 changed files with 16 additions and 18 deletions

View file

@ -769,29 +769,24 @@ void LocApiRpcAdapter::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
void LocApiRpcAdapter::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr) void LocApiRpcAdapter::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
{ {
GpsStatusValue status = GPS_STATUS_NONE;
if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) { if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON) if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
{ {
status = GPS_STATUS_ENGINE_ON; LocApiAdapter::reportStatus(GPS_STATUS_ENGINE_ON);
LocApiAdapter::reportStatus(GPS_STATUS_SESSION_BEGIN);
} }
else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF) else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
{ {
status = GPS_STATUS_ENGINE_OFF; LocApiAdapter::reportStatus(GPS_STATUS_SESSION_END);
LocApiAdapter::reportStatus(GPS_STATUS_ENGINE_OFF);
} }
} else if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE) { else
if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state == RPC_LOC_FIX_SESSION_STATE_BEGIN)
{ {
status = GPS_STATUS_SESSION_BEGIN; LocApiAdapter::reportStatus(GPS_STATUS_NONE);
}
else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state == RPC_LOC_FIX_SESSION_STATE_END)
{
status = GPS_STATUS_SESSION_END;
} }
} }
LocApiAdapter::reportStatus(status);
} }
void LocApiRpcAdapter::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr) void LocApiRpcAdapter::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)

View file

@ -1406,8 +1406,7 @@ locClientEventMaskType LocApiV02Adapter :: convertMask(
if(mask & LOC_API_ADAPTER_BIT_STATUS_REPORT) if(mask & LOC_API_ADAPTER_BIT_STATUS_REPORT)
{ {
eventMask |= (QMI_LOC_EVENT_MASK_ENGINE_STATE_V02 | eventMask |= (QMI_LOC_EVENT_MASK_ENGINE_STATE_V02);
QMI_LOC_EVENT_MASK_FIX_SESSION_STATE_V02);
} }
if(mask & LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST) if(mask & LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST)
@ -1652,21 +1651,25 @@ void LocApiV02Adapter :: reportSv (
void LocApiV02Adapter :: reportEngineState ( void LocApiV02Adapter :: reportEngineState (
const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr) const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr)
{ {
GpsStatusValue status;
LOC_LOGV("%s:%d]: state = %d\n", __func__, __LINE__, LOC_LOGV("%s:%d]: state = %d\n", __func__, __LINE__,
engine_state_ptr->engineState); engine_state_ptr->engineState);
status = GPS_STATUS_NONE;
if (engine_state_ptr->engineState == eQMI_LOC_ENGINE_STATE_ON_V02) if (engine_state_ptr->engineState == eQMI_LOC_ENGINE_STATE_ON_V02)
{ {
status = GPS_STATUS_ENGINE_ON; LocApiAdapter::reportStatus(GPS_STATUS_ENGINE_ON);
LocApiAdapter::reportStatus(GPS_STATUS_SESSION_BEGIN);
} }
else if (engine_state_ptr->engineState == eQMI_LOC_ENGINE_STATE_OFF_V02) else if (engine_state_ptr->engineState == eQMI_LOC_ENGINE_STATE_OFF_V02)
{ {
status = GPS_STATUS_ENGINE_OFF; LocApiAdapter::reportStatus(GPS_STATUS_SESSION_END);
LocApiAdapter::reportStatus(GPS_STATUS_ENGINE_OFF);
} }
LocApiAdapter::reportStatus(status); else
{
LocApiAdapter::reportStatus(GPS_STATUS_NONE);
}
} }
/* convert fix session state report to loc eng format and send the converted /* convert fix session state report to loc eng format and send the converted