diff options
author | Cyan_Hsieh <cyanhsieh@google.com> | 2019-09-11 09:08:53 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-09-11 09:08:53 -0700 |
commit | 0855d3f981e20f4c18a4c683838b145f841fe856 (patch) | |
tree | 72e4dc78316425cdefb3930d28b0a6126ad1b44a /android | |
parent | 2e698cd4c3153d00716f2cd482b9bccb3c68e7b3 (diff) | |
parent | 34bfa5225636dd99fe1a99e4949e32b49fc17b6e (diff) | |
download | gps-0855d3f981e20f4c18a4c683838b145f841fe856.tar.gz |
Merge remote-tracking branch 'goog/qcom/release/LA.UM.8.1.R1.09.00.00.529.082' into qt-qpr1-dev am: 6c4d159942
am: 34bfa52256
Change-Id: Ie2b9123e642d66ae7fefa6c50fc015aed6f7ddc4
Diffstat (limited to 'android')
-rw-r--r-- | android/2.0/GnssConfiguration.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/android/2.0/GnssConfiguration.cpp b/android/2.0/GnssConfiguration.cpp index d2a8763..363d2b1 100644 --- a/android/2.0/GnssConfiguration.cpp +++ b/android/2.0/GnssConfiguration.cpp @@ -23,6 +23,7 @@ #include <log_util.h> #include "Gnss.h" #include "GnssConfiguration.h" +#include "ContextBase.h" #include <android/hardware/gnss/1.0/types.h> namespace android { @@ -32,6 +33,7 @@ namespace V2_0 { namespace implementation { using ::android::hardware::gnss::V1_0::GnssConstellationType; +using namespace loc_core; GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) { } @@ -109,8 +111,7 @@ Return<bool> GnssConfiguration::setLppProfile(uint8_t lppProfile) { return false; } - GnssConfig config; - memset(&config, 0, sizeof(GnssConfig)); + GnssConfig config = {}; config.size = sizeof(GnssConfig); config.flags = GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT; switch (lppProfile) { @@ -162,8 +163,37 @@ Return<bool> GnssConfiguration::setGlonassPositioningProtocol(uint8_t protocol) return mGnss->updateConfiguration(config); } -Return<bool> GnssConfiguration::setGpsLock(uint8_t /*lock*/) { - // deprecated function. Must return false to pass VTS +Return<bool> GnssConfiguration::setGpsLock(uint8_t lock) { + + if (mGnss == nullptr) { + LOC_LOGE("%s]: mGnss is nullptr", __FUNCTION__); + return false; + } + + GnssConfig config = {}; + config.size = sizeof(GnssConfig); + config.flags = GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT; + switch (lock) { + case 0: + config.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE; + break; + case 1: + config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO; + break; + case 2: + config.gpsLock = GNSS_CONFIG_GPS_LOCK_NI; + break; + case 3: + config.gpsLock = GNSS_CONFIG_GPS_LOCK_MO_AND_NI; + break; + default: + LOC_LOGE("%s]: invalid lock: %d.", __FUNCTION__, lock); + return false; + break; + } + + mGnss->updateConfiguration(config); + // Must return false to pass VTS return false; } |