diff options
author | Naresh Munagala <nareshm@codeaurora.org> | 2020-09-18 16:18:12 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-11-13 18:58:25 -0800 |
commit | f000bce990ad76b569627f77109aca2d4b5014f9 (patch) | |
tree | be2cd6062f3eadc4c7e3cdab3a37b849fdd74b8b /core | |
parent | 164123c78e5b3d1b65414e9f5e840725c5d2f693 (diff) |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/ContextBase.cpp | 1 | ||||
-rw-r--r-- | core/ContextBase.h | 120 | ||||
-rw-r--r-- | core/EngineHubProxyBase.h | 11 | ||||
-rw-r--r-- | core/LocAdapterBase.cpp | 4 | ||||
-rw-r--r-- | core/LocAdapterBase.h | 2 | ||||
-rw-r--r-- | core/LocApiBase.cpp | 8 | ||||
-rw-r--r-- | core/LocApiBase.h | 9 |
7 files changed, 153 insertions, 2 deletions
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 @@ uint64_t ContextBase::sSupportedMsgMask = 0; 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 @@ public: 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 @@ public: */ 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(const GnssAidingDataSvMask& svDataMask)> 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 @@ typedef EngineHubProxyBase* (getEngHubProxyFn)( 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 @@ void 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 @@ public: 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 @@ void LocApiBase::reportLocationSystemInfo(const LocationSystemInfo& locationSyst 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 @@ public: 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: |