diff options
author | Saurabh Srivastava <ssrivast@codeaurora.org> | 2018-05-20 19:29:46 +0530 |
---|---|---|
committer | Saurabh Srivastava <ssrivast@codeaurora.org> | 2018-06-03 12:15:34 +0530 |
commit | eaf7e54b54a31c571560bf5fe869bb235a2aacaf (patch) | |
tree | 2f4bf20ac4196ba2439b38f80c7de31b1ce5467f /android | |
parent | a93b10c6770079c9f23ca3484b56fa0136b25464 (diff) | |
download | gps-eaf7e54b54a31c571560bf5fe869bb235a2aacaf.tar.gz |
FR 45651 - GNSS SV/Constellation Control
Adding support for configuring GNSS SVs
and constellations to be used.
Change-Id: I47d5cd9d08ac9aaf633be2fe3b1bd152a2f4293b
CRs-Fixed: 2184871
Diffstat (limited to 'android')
-rw-r--r-- | android/Gnss.cpp | 4 | ||||
-rw-r--r-- | android/GnssConfiguration.cpp | 57 | ||||
-rw-r--r-- | android/GnssConfiguration.h | 3 |
3 files changed, 62 insertions, 2 deletions
diff --git a/android/Gnss.cpp b/android/Gnss.cpp index 878cd20..d31a18b 100644 --- a/android/Gnss.cpp +++ b/android/Gnss.cpp @@ -234,6 +234,10 @@ Return<bool> Gnss::updateConfiguration(GnssConfig& gnssConfig) { mPendingConfig.flags |= GNSS_CONFIG_FLAGS_SUPL_MODE_BIT; mPendingConfig.suplModeMask = gnssConfig.suplModeMask; } + if (gnssConfig.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) { + mPendingConfig.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT; + mPendingConfig.blacklistedSvIds = gnssConfig.blacklistedSvIds; + } } return true; } diff --git a/android/GnssConfiguration.cpp b/android/GnssConfiguration.cpp index 9eeceac..cee928a 100644 --- a/android/GnssConfiguration.cpp +++ b/android/GnssConfiguration.cpp @@ -23,6 +23,7 @@ #include <log_util.h> #include "Gnss.h" #include "GnssConfiguration.h" +#include <android/hardware/gnss/1.0/types.h> namespace android { namespace hardware { @@ -30,6 +31,8 @@ namespace gnss { namespace V1_1 { namespace implementation { +using ::android::hardware::gnss::V1_0::GnssConstellationType; + GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) { } @@ -222,10 +225,60 @@ Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) { // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow. Return<bool> GnssConfiguration::setBlacklist( - const hidl_vec<GnssConfiguration::BlacklistedSource>& /*blacklist*/) { + const hidl_vec<GnssConfiguration::BlacklistedSource>& blacklist) { ENTRY_LOG_CALLFLOW(); - return true; + if (nullptr == mGnss) { + LOC_LOGe("mGnss is null"); + return false; + } + + GnssConfig config; + memset(&config, 0, sizeof(GnssConfig)); + config.size = sizeof(GnssConfig); + config.flags = GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT; + config.blacklistedSvIds.clear(); + + GnssSvIdSource source = {}; + for (int idx = 0; idx < (int)blacklist.size(); idx++) { + setBlacklistedSource(source, blacklist[idx]); + config.blacklistedSvIds.push_back(source); + } + + return mGnss->updateConfiguration(config); +} + +void GnssConfiguration::setBlacklistedSource( + GnssSvIdSource& copyToSource, + const GnssConfiguration::BlacklistedSource& copyFromSource) { + + copyToSource.size = sizeof(GnssSvIdSource); + + switch(copyFromSource.constellation) { + case GnssConstellationType::GPS: + copyToSource.constellation = GNSS_SV_TYPE_GPS; + break; + case GnssConstellationType::SBAS: + copyToSource.constellation = GNSS_SV_TYPE_SBAS; + break; + case GnssConstellationType::GLONASS: + copyToSource.constellation = GNSS_SV_TYPE_GLONASS; + break; + case GnssConstellationType::QZSS: + copyToSource.constellation = GNSS_SV_TYPE_QZSS; + break; + case GnssConstellationType::BEIDOU: + copyToSource.constellation = GNSS_SV_TYPE_BEIDOU; + break; + case GnssConstellationType::GALILEO: + copyToSource.constellation = GNSS_SV_TYPE_GALILEO; + break; + default: + copyToSource.constellation = GNSS_SV_TYPE_UNKNOWN; + break; + } + + copyToSource.svId = copyFromSource.svid; } } // namespace implementation diff --git a/android/GnssConfiguration.h b/android/GnssConfiguration.h index f46f607..15ee290 100644 --- a/android/GnssConfiguration.h +++ b/android/GnssConfiguration.h @@ -64,6 +64,9 @@ struct GnssConfiguration : public IGnssConfiguration { private: Gnss* mGnss = nullptr; + void setBlacklistedSource( + GnssSvIdSource& copyToSource, + const GnssConfiguration::BlacklistedSource& copyFromSource); }; } // namespace implementation |