Report Qwes feature capabilities to LCA
- Add Qwes CapabilitiesMask to LocationCapabilitiesMask. Also
update type to uint64 to make it future proof.
- Update capabilities based on Qwes feature type information
from engine hub or modem.
Change-Id: I4101255d2b4843358f773014893f61a61439af24
CRs-Fixed: 2807083
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index d30ed1d..b55b758 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -50,6 +50,7 @@
bool ContextBase::sGnssMeasurementSupported = false;
uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
GnssNMEARptRate ContextBase::sNmeaReportRate = GNSS_NMEA_REPORT_RATE_NHZ;
+LocationCapabilitiesMask ContextBase::sQwesFeatureMask = 0;
const loc_param_s_type ContextBase::mGps_conf_table[] =
{
diff --git a/core/ContextBase.h b/core/ContextBase.h
index 433ba60..280316c 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2017,2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,6 +35,11 @@
#include <LocApiBase.h>
#include <LBSProxyBase.h>
#include <loc_cfg.h>
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
/* GPS.conf support */
/* NOTE: the implementaiton of the parser casts number
@@ -155,6 +160,7 @@
static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
static bool sGnssMeasurementSupported;
static GnssNMEARptRate sNmeaReportRate;
+ static LocationCapabilitiesMask sQwesFeatureMask;
void readConfig();
static uint32_t getCarrierCapabilities();
@@ -187,6 +193,118 @@
*/
static bool gnssConstellationConfig();
+ /*
+ set QWES feature status info
+ */
+ static inline void setQwesFeatureStatus(
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
+ std::unordered_map<LocationQwesFeatureType, bool>::const_iterator itr;
+ static LocationQwesFeatureType locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_MAX];
+ for (itr = featureMap.begin(); itr != featureMap.end(); ++itr) {
+ LOC_LOGi("Feature : %d isValid: %d", itr->first, itr->second);
+ locQwesFeatType[itr->first] = itr->second;
+ switch (itr->first) {
+ case LOCATION_QWES_FEATURE_TYPE_CARRIER_PHASE:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_SV_POLYNOMIAL:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_GNSS_SINGLE_FREQUENCY:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_SV_EPH:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_GNSS_MULTI_FREQUENCY:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_PPE:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_PPE;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_PPE;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_QDR2:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR2;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR2;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_QDR3:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR3;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR3;
+ }
+ break;
+ case LOCATION_QWES_FEATURE_TYPE_VPE:
+ if (itr->second) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_VPE;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_VPE;
+ }
+ break;
+ }
+ }
+
+ // Set CV2X basic when time freq and tunc is set
+ // CV2X_BASIC = LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY &
+ // LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY
+
+ // Set CV2X premium when time freq and tunc is set
+ // CV2X_PREMIUM = CV2X_BASIC & LOCATION_QWES_FEATURE_TYPE_QDR3 &
+ // LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE
+
+ bool cv2xBasicEnabled = (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY]) &&
+ (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY]);
+ bool cv2xPremiumEnabled = cv2xBasicEnabled &&
+ (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_QDR3]) &&
+ (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE]);
+
+ LOC_LOGd("CV2X_BASIC:%d, CV2X_PREMIUM:%d", cv2xBasicEnabled, cv2xPremiumEnabled);
+ if (cv2xBasicEnabled) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
+ }
+ if (cv2xPremiumEnabled) {
+ sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
+ } else {
+ sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
+ }
+ }
+
+ /*
+ get QWES feature status info
+ */
+ static inline LocationCapabilitiesMask getQwesFeatureStatus() {
+ return (ContextBase::sQwesFeatureMask);
+ }
+
+
};
struct LocApiResponse: LocMsg {
diff --git a/core/EngineHubProxyBase.h b/core/EngineHubProxyBase.h
index 399297b..0e0b093 100644
--- a/core/EngineHubProxyBase.h
+++ b/core/EngineHubProxyBase.h
@@ -28,6 +28,11 @@
*/
#ifndef ENGINE_HUB_PROXY_BASE_H
#define ENGINE_HUB_PROXY_BASE_H
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
namespace loc_core {
@@ -134,6 +139,9 @@
typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)>
GnssAdapterUpdateNHzRequirementCb;
+typedef std::function<void(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)>
+ GnssAdapterUpdateQwesFeatureStatusCb;
+
// potential parameters: message queue: MsgTask * msgTask;
// callback function to report back dr and ppe position and sv report
typedef EngineHubProxyBase* (getEngHubProxyFn)(
@@ -142,7 +150,8 @@
GnssAdapterReportEnginePositionsEventCb positionEventCb,
GnssAdapterReportSvEventCb svEventCb,
GnssAdapterReqAidingDataCb reqAidingDataCb,
- GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb);
+ GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb,
+ GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb);
} // namespace loc_core
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index 763426e..14e4857 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -214,4 +214,8 @@
LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/)
DEFAULT_IMPL()
+bool LocAdapterBase::
+ reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
+DEFAULT_IMPL(false)
+
} // namespace loc_core
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index 373add2..ed1ad6e 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -199,6 +199,8 @@
virtual bool reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo& additionalSystemInfo);
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
+ virtual bool reportQwesCapabilities(
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
};
} // namespace loc_core
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 207849c..50d7369 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -481,6 +481,14 @@
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLocationSystemInfoEvent(locationSystemInfo));
}
+void LocApiBase::reportQwesCapabilities
+(
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
+)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportQwesCapabilities(featureMap));
+}
void LocApiBase::requestXtraData()
{
// loop through adapters, and deliver to the first handling adapter.
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index 0831cc7..05f7db5 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -35,6 +35,11 @@
#include <LocationAPI.h>
#include <MsgTask.h>
#include <log_util.h>
+#ifdef NO_UNORDERED_SET_OR_MAP
+ #include <map>
+#else
+ #include <unordered_map>
+#endif
namespace loc_core {
@@ -191,6 +196,10 @@
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
+ void reportQwesCapabilities
+ (
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
+ );
// downward calls
// All below functions are to be defined by adapter specific modules:
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 04b5172..1c00106 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -2403,7 +2403,8 @@
{
// need to register for leap second info
// for proper nmea generation
- LOC_API_ADAPTER_EVENT_MASK_T mask = LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO;
+ LOC_API_ADAPTER_EVENT_MASK_T mask = LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO |
+ LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
if (it->second.trackingCb != nullptr ||
it->second.gnssLocationInfoCb != nullptr ||
@@ -2441,7 +2442,6 @@
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT;
- mask |= LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
// Nhz measurement bit is set based on callback from loc eng hub
// for Nhz engines.
@@ -2639,18 +2639,8 @@
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02)) {
mask |= LOCATION_CAPABILITIES_AGPM_BIT;
}
- if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY)) {
- mask |= LOCATION_CAPABILITIES_PRIVACY_BIT;
- }
- if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION)) {
- mask |= LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT;
- }
- if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_ROBUST_LOCATION)) {
- mask |= LOCATION_CAPABILITIES_CONFORMITY_INDEX_BIT;
- }
- if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_EDGNSS)) {
- mask |= LOCATION_CAPABILITIES_EDGNSS_BIT;
- }
+ //Get QWES feature status mask
+ mask |= ContextBase::getQwesFeatureStatus();
return mask;
}
@@ -4582,6 +4572,31 @@
return true;
}
+bool GnssAdapter::reportQwesCapabilities(
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
+{
+ struct MsgReportQwesFeatureStatus : public LocMsg {
+ GnssAdapter& mAdapter;
+ const std::unordered_map<LocationQwesFeatureType, bool> mFeatureMap;
+ inline MsgReportQwesFeatureStatus(GnssAdapter& adapter,
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) :
+ LocMsg(),
+ mAdapter(adapter),
+ mFeatureMap(std::move(featureMap)) {}
+ inline virtual void proc() const {
+ LOC_LOGi("ReportQwesFeatureStatus before caps %" PRIx64 " ",
+ mAdapter.getCapabilities());
+ ContextBase::setQwesFeatureStatus(mFeatureMap);
+ LOC_LOGi("ReportQwesFeatureStatus After caps %" PRIx64 " ",
+ mAdapter.getCapabilities());
+ mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
+ }
+ };
+
+ sendMsg(new MsgReportQwesFeatureStatus(*this, featureMap));
+ return true;
+}
+
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback)
{
struct MsgInitOdcpi : public LocMsg {
@@ -6049,14 +6064,20 @@
mNHzNeeded = nHzNeeded;
checkAndRestartSPESession();
}
- };
+ };
+
+ GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb =
+ [this] (const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
+ reportQwesCapabilities(featureMap);
+ };
getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");
if(getter != nullptr) {
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
- reportPositionEventCb,
- reportSvEventCb, reqAidingDataCb,
- updateNHzRequirementCb);
+ reportPositionEventCb,
+ reportSvEventCb, reqAidingDataCb,
+ updateNHzRequirementCb,
+ updateQwesFeatureStatusCb);
if (hubProxy != nullptr) {
mEngHubProxy = hubProxy;
engHubLoadSuccessful = true;
diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h
index ff8cc6d..569c589 100644
--- a/gnss/GnssAdapter.h
+++ b/gnss/GnssAdapter.h
@@ -481,6 +481,10 @@
virtual bool reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo& additionalSystemInfo);
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
+ virtual bool reportQwesCapabilities
+ (
+ const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
+ );
/* ======== UTILITIES ================================================================= */
bool needReport(const UlpLocation& ulpLocation,
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index a30d729..0f927e5 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -228,7 +228,8 @@
GEOFENCE_STATUS_AVAILABILE_YES,
} GeofenceStatusAvailable;
-typedef uint32_t LocationCapabilitiesMask;
+// Set of masks for Modem and QWES capabilities.
+typedef uint64_t LocationCapabilitiesMask;
typedef enum {
// supports startTracking API with minInterval param
LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0),
@@ -262,8 +263,86 @@
LOCATION_CAPABILITIES_CONFORMITY_INDEX_BIT = (1<<14),
// support precise location edgnss
LOCATION_CAPABILITIES_EDGNSS_BIT = (1<<15),
+ // Modem supports Carrier Phase for Precise Positioning
+ // Measurement Engine (PPME).
+ LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT = (1<<16),
+ // Modem supports SV Polynomial for tightly coupled external
+ // DR support. This is a Standalone Feature.
+ LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT = (1<<17),
+ // Modem supports SV Ephemeris for tightly coupled external
+ // PPE engines. This is a Standalone Feature.
+ LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT = (1<<18),
+ // Modem supports GNSS Single Frequency feature. This is a
+ // Standalone Feature.
+ LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY = (1<<19),
+ // Modem supports GNSS Multi Frequency feature. Multi Frequency
+ // enables Single frequency also.
+ LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY = (1<<20),
+ // This mask indicates VPe license bundle is enabled. VEPP
+ // bundle include Carrier Phase and SV Polynomial features.
+ LOCATION_CAPABILITIES_QWES_VPE = (1<<21),
+ // This mask indicates support for CV2X Location basic features.
+ // This bundle includes features for GTS Time & Freq, C-TUNC
+ // (Constrained Time uncertainity.
+ LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC = (1<<22),
+ // This mask indicates support for CV2X Location premium features.
+ // This bundle includes features for CV2X Location Basic features,
+ // QDR3 feature, and PACE. (Position Assisted Clock Estimator.
+ LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM = (1<<23),
+ // This mask indicates that PPE (Precise Positioning Engine)
+ // library is enabled or Precise Positioning Framework (PPF)
+ // is available. This bundle includes features for Carrier
+ // Phase and SV Ephermeris.
+ LOCATION_CAPABILITIES_QWES_PPE = (1<<24),
+ // This mask indicates QDR2_C license bundle is enabled. This
+ // bundle includes features for SV Polynomial.
+ LOCATION_CAPABILITIES_QWES_QDR2 = (1<<25),
+ // This mask indicates QDR3_C license bundle is enabled. This
+ // bundle includes features for SV Polynomial.
+ LOCATION_CAPABILITIES_QWES_QDR3 = (1<<26),
} LocationCapabilitiesBits;
+typedef uint8_t LocationQwesFeatureType;
+typedef enum {
+ // Modem supports Carrier Phase for Precise Positioning
+ // Measurement Engine (PPME).
+ LOCATION_QWES_FEATURE_TYPE_CARRIER_PHASE = 1,
+ // Modem supports SV Polynomial for tightly coupled external
+ // DR support. This is a Standalone Feature.
+ LOCATION_QWES_FEATURE_TYPE_SV_POLYNOMIAL,
+ // Modem supports SV Ephemeris for tightly coupled external
+ // PPE support. This is a Standalone Feature.
+ LOCATION_QWES_FEATURE_TYPE_SV_EPH,
+ // Modem supports GNSS Single Frequency feature. This is a
+ // Standalone Feature.
+ LOCATION_QWES_FEATURE_TYPE_GNSS_SINGLE_FREQUENCY,
+ // Modem supports GNSS Multi Frequency feature. Multi Frequency
+ // enables Single frequency also.
+ LOCATION_QWES_FEATURE_TYPE_GNSS_MULTI_FREQUENCY,
+ // This indicates Time and Frequency status.
+ LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY,
+ // This indicates Time Uncertainty status.
+ LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY,
+ // This indicates Clock Estimate status.
+ LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE,
+ // This mask indicates that PPE (Precise Positioning Engine)
+ // library is enabled or Precise Positioning Framework (PPF)
+ // is available. This bundle includes features for Carrier
+ // Phase and SV Ephermeris.
+ LOCATION_QWES_FEATURE_TYPE_PPE,
+ // This indicates QDR2_C license bundle is enabled. This
+ // bundle includes features for SV Polynomial.
+ LOCATION_QWES_FEATURE_TYPE_QDR2,
+ // This indicates QDR3_C license bundle is enabled. This
+ // bundle includes features for SV Polynomial.
+ LOCATION_QWES_FEATURE_TYPE_QDR3,
+ // This indicates VEPP license bundle is enabled. VEPP
+ // bundle include Carrier Phase and SV Polynomial features.
+ LOCATION_QWES_FEATURE_TYPE_VPE,
+ // Max value
+ LOCATION_QWES_FEATURE_TYPE_MAX
+} LocationQwesFeatureTypes;
+
typedef enum {
LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
} LocationTechnologyType;