Yu-Han Yang | a2f7732 | 2018-03-06 10:12:55 -0800 | [diff] [blame^] | 1 | #define LOG_TAG "GnssConfiguration" |
| 2 | |
Yu-Han Yang | 73f16ad | 2018-02-24 10:05:32 -0800 | [diff] [blame] | 3 | #include "GnssConfiguration.h" |
Yu-Han Yang | a2f7732 | 2018-03-06 10:12:55 -0800 | [diff] [blame^] | 4 | #include <log/log.h> |
Yu-Han Yang | 73f16ad | 2018-02-24 10:05:32 -0800 | [diff] [blame] | 5 | |
| 6 | namespace android { |
| 7 | namespace hardware { |
| 8 | namespace gnss { |
| 9 | namespace V1_1 { |
| 10 | namespace implementation { |
| 11 | |
| 12 | // Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow. |
| 13 | Return<bool> GnssConfiguration::setSuplEs(bool) { |
| 14 | // TODO implement |
| 15 | return bool{}; |
| 16 | } |
| 17 | |
| 18 | Return<bool> GnssConfiguration::setSuplVersion(uint32_t) { |
| 19 | // TODO implement |
| 20 | return bool{}; |
| 21 | } |
| 22 | |
| 23 | Return<bool> GnssConfiguration::setSuplMode(hidl_bitfield<SuplMode>) { |
| 24 | // TODO implement |
| 25 | return bool{}; |
| 26 | } |
| 27 | |
| 28 | Return<bool> GnssConfiguration::setGpsLock(hidl_bitfield<GpsLock>) { |
| 29 | // TODO implement |
| 30 | return bool{}; |
| 31 | } |
| 32 | |
| 33 | Return<bool> GnssConfiguration::setLppProfile(hidl_bitfield<LppProfile>) { |
| 34 | // TODO implement |
| 35 | return bool{}; |
| 36 | } |
| 37 | |
| 38 | Return<bool> GnssConfiguration::setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol>) { |
| 39 | // TODO implement |
| 40 | return bool{}; |
| 41 | } |
| 42 | |
| 43 | Return<bool> GnssConfiguration::setEmergencySuplPdn(bool) { |
| 44 | // TODO implement |
| 45 | return bool{}; |
| 46 | } |
| 47 | |
| 48 | // Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow. |
Yu-Han Yang | a2f7732 | 2018-03-06 10:12:55 -0800 | [diff] [blame^] | 49 | Return<bool> GnssConfiguration::setBlacklist(const hidl_vec<BlacklistedSource>& sourceList) { |
| 50 | std::unique_lock<std::recursive_mutex> lock(mMutex); |
| 51 | mBlacklistedConstellationSet.clear(); |
| 52 | mBlacklistedSourceSet.clear(); |
| 53 | for (auto source : sourceList) { |
| 54 | if (source.svid == 0) { |
| 55 | // Wildcard blacklist, i.e., blacklist entire constellation. |
| 56 | mBlacklistedConstellationSet.insert(source.constellation); |
| 57 | } else { |
| 58 | mBlacklistedSourceSet.insert(source); |
| 59 | } |
| 60 | } |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | Return<bool> GnssConfiguration::isBlacklisted(const GnssSvInfo& gnssSvInfo) const { |
| 65 | std::unique_lock<std::recursive_mutex> lock(mMutex); |
| 66 | if (mBlacklistedConstellationSet.find(gnssSvInfo.constellation) != |
| 67 | mBlacklistedConstellationSet.end()) { |
| 68 | return true; |
| 69 | } |
| 70 | BlacklistedSource source = {.constellation = gnssSvInfo.constellation, .svid = gnssSvInfo.svid}; |
| 71 | return (mBlacklistedSourceSet.find(source) != mBlacklistedSourceSet.end()); |
| 72 | } |
| 73 | |
| 74 | std::recursive_mutex& GnssConfiguration::getMutex() const { |
| 75 | return mMutex; |
Yu-Han Yang | 73f16ad | 2018-02-24 10:05:32 -0800 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | // Methods from ::android::hidl::base::V1_0::IBase follow. |
| 79 | |
| 80 | } // namespace implementation |
| 81 | } // namespace V1_1 |
| 82 | } // namespace gnss |
| 83 | } // namespace hardware |
| 84 | } // namespace android |