diff options
author | Bhavna Sharma <sbhavna@codeaurora.org> | 2018-03-30 17:10:59 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-04-12 13:24:57 -0700 |
commit | e5c31f33c1fac9129b7141c62d61826dfc041a54 (patch) | |
tree | 98f568a2e0a91d926028f11b6c69960b60f5009a | |
parent | 82d0efd99ae4aa5643d6fa844f44c850fa008cc5 (diff) | |
download | gps-e5c31f33c1fac9129b7141c62d61826dfc041a54.tar.gz |
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
-rw-r--r-- | core/EngineHubProxyBase.h | 7 | ||||
-rw-r--r-- | core/LocAdapterBase.cpp | 5 | ||||
-rw-r--r-- | core/LocAdapterBase.h | 6 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 54 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 7 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 4 |
6 files changed, 64 insertions, 19 deletions
diff --git a/core/EngineHubProxyBase.h b/core/EngineHubProxyBase.h index 7b9f3ae..4e259ba 100644 --- a/core/EngineHubProxyBase.h +++ b/core/EngineHubProxyBase.h @@ -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; diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index f3c999c..5d1b2c2 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -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:: diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index e7beca8..8388c71 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -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); diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index dca3d0f..f619a9a 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -1259,6 +1259,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); } @@ -2121,22 +2122,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; @@ -2237,18 +2259,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 { @@ -3326,15 +3358,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"); diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index c1e1754..85962cf 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -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, diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 57d9d51..9565682 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -128,6 +128,7 @@ typedef struct { /* Provider indicator for HYBRID or GPS */ uint16_t position_source; LocPosTechMask tech_mask; + bool unpropagatedPosition; } UlpLocation; typedef struct { @@ -769,6 +770,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 }; @@ -805,7 +807,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; |