GPS Adapter: GNSS adapter change to go with engine hub aggregator

1: GNSS adapter change to block out position and SV report from
ULP when engine hub aggregator is used
2: Support unpropagated position report

Change-Id: Id0cacd87d3f3f8eec893d751b9f7a55a736a4023
CRs-fixed: 2210253
This commit is contained in:
Bhavna Sharma 2018-03-30 17:10:59 -07:00 committed by Gerrit - the friendly Code Review server
parent 87c52f1f37
commit 4c8f4e4e04
6 changed files with 64 additions and 19 deletions

View file

@ -92,10 +92,13 @@ typedef std::function<void(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
bool fromUlp)>
bool fromUlp,
bool fromEngineHub)>
GnssAdapterReportPositionEventCb;
typedef std::function<void(const GnssSvNotification& svNotify, bool fromUlp)>
typedef std::function<void(const GnssSvNotification& svNotify,
bool fromUlp,
bool fromEngineHub)>
GnssAdapterReportSvEventCb;
// potential parameters: message queue: MsgTask * msgTask;

View file

@ -79,7 +79,7 @@ void LocAdapterBase::
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
bool /*fromUlp*/) {
bool /*fromUlp*/, bool /*fromEngineHub*/) {
if (mLocAdapterProxyBase != NULL) {
mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
(GpsLocationExtended&)locationExtended,
@ -91,7 +91,8 @@ void LocAdapterBase::
}
void LocAdapterBase::
reportSvEvent(const GnssSvNotification& /*svNotify*/, bool /*fromUlp*/)
reportSvEvent(const GnssSvNotification& /*svNotify*/,
bool /*fromUlp*/, bool /*fromEngineHub*/)
DEFAULT_IMPL()
void LocAdapterBase::

View file

@ -131,8 +131,10 @@ public:
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
bool fromUlp=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
bool fromUlp=false,
bool fromEngineHub=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify,
bool fromUlp=false, bool fromEngineHub=false);
virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);

View file

@ -1230,6 +1230,7 @@ GnssAdapter::updateClientsEventMask()
(true == initEngHubProxy())) {
mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
LOC_LOGD("%s]: Auto usecase, Enable MEAS/POLY - mask 0x%x", __func__, mask);
}
@ -2092,22 +2093,43 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
bool fromUlp)
bool fromUlp,
bool fromEngineHub)
{
LOC_LOGD("%s]: fromUlp %u status %u", __func__, fromUlp, status);
// if this event is called from QMI LOC API, then try to call into ULP and return if successfull
// if the position is called from ULP or engine hub, then send it out directly
if (!fromUlp) {
// report QMI position to engine hub, and engine hub will be
// distributing it to the registered plugins
if (!fromUlp && !fromEngineHub) {
// report QMI position (both propagated and unpropagated) to engine hub,
// and engine hub will be distributing it to the registered plugins
mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status);
if (true == ulpLocation.unpropagatedPosition) {
return;
}
// only send propagated position report to ulp
if (mUlpProxy->reportPosition(ulpLocation, locationExtended,
status, techMask)) {
return;
}
// engine hub is loaded, do not report qmi position to client as
// final position report should come from engine hub
if (true == initEngHubProxy()){
return;
}
} else if ((true == fromUlp) && (true == initEngHubProxy())) {
LOC_LOGV("%s]: drop ULP GNSS fix as engine hub is loaded", __func__);
return;
}
// for all other cases:
// case 1: fix is from ULP and engine hub is not loaded, queue the msg
// case 2: fix is from engine hub, queue the msg
// when message is queued, the position can be dispatched to requesting client
struct MsgReportPosition : public LocMsg {
GnssAdapter& mAdapter;
const UlpLocation mUlpLocation;
@ -2208,18 +2230,28 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
void
GnssAdapter::reportSvEvent(const GnssSvNotification& svNotify,
bool fromUlp)
bool fromUlp,
bool fromEngineHub)
{
LOC_LOGD("%s]: fromUlp %u", __func__, fromUlp);
// if this event is not called from ULP, then try to call into ULP and return if successfull
if (!fromUlp) {
if (!fromUlp && !fromEngineHub) {
// report QMI SV report to eng hub
mEngHubProxy->gnssReportSv(svNotify);
if (mUlpProxy->reportSv(svNotify)) {
return;
}
// engine hub is loaded, do not report sv to client
// as sv report should come from engine hub
if (true == initEngHubProxy()){
return;
}
} else if ((true == fromUlp) && (true == initEngHubProxy())) {
LOC_LOGV("%s]: drop ULP GNSS SV event as engine hub is loaded", __func__);
return;
}
struct MsgReportSv : public LocMsg {
@ -3297,15 +3329,17 @@ GnssAdapter::initEngHubProxy() {
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
bool fromUlp) {
bool fromUlp,
bool fromEngineHub) {
// report from engine hub on behalf of PPE will be treated as fromUlp
reportPositionEvent(ulpLocation, locationExtended, status, techMask, fromUlp);
reportPositionEvent(ulpLocation, locationExtended, status,
techMask, fromUlp, fromEngineHub);
};
// callback function for engine hub to report back sv event
GnssAdapterReportSvEventCb reportSvEventCb =
[this](const GnssSvNotification& svNotify, bool fromUlp) {
reportSvEvent(svNotify, fromUlp);
[this](const GnssSvNotification& svNotify, bool fromUlp, bool fromEngineHub) {
reportSvEvent(svNotify, fromUlp, fromEngineHub);
};
getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");

View file

@ -235,8 +235,11 @@ public:
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
bool fromUlp=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
bool fromUlp=false,
bool fromEngineHub=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify,
bool fromUlp=false,
bool fromEngineHub=false);
virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data);
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,

View file

@ -127,6 +127,7 @@ typedef struct {
/* Provider indicator for HYBRID or GPS */
uint16_t position_source;
LocPosTechMask tech_mask;
bool unpropagatedPosition;
} UlpLocation;
typedef struct {
@ -583,6 +584,7 @@ enum loc_api_adapter_event_index {
LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request
LOC_API_ADAPTER_BATCH_STATUS, // batch status
LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request
LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION, // Unpropagated Position report
LOC_API_ADAPTER_EVENT_MAX
};
@ -619,7 +621,7 @@ enum loc_api_adapter_event_index {
#define LOC_API_ADAPTER_BIT_POSITION_INJECTION_REQUEST (1<<LOC_API_ADAPTER_REQUEST_POSITION_INJECTION)
#define LOC_API_ADAPTER_BIT_BATCH_STATUS (1<<LOC_API_ADAPTER_BATCH_STATUS)
#define LOC_API_ADAPTER_BIT_FDCL_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_FDCL_SERVICE_REQ)
#define LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION)
typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;