blob: 2717571c02effe7f7731a0db7b7f5adeb541010f [file] [log] [blame]
Yu-Han Yanga2f77322018-03-06 10:12:55 -08001#define LOG_TAG "GnssConfiguration"
2
Yu-Han Yang73f16ad2018-02-24 10:05:32 -08003#include "GnssConfiguration.h"
Yu-Han Yanga2f77322018-03-06 10:12:55 -08004#include <log/log.h>
Yu-Han Yang73f16ad2018-02-24 10:05:32 -08005
6namespace android {
7namespace hardware {
8namespace gnss {
9namespace V1_1 {
10namespace implementation {
11
12// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
13Return<bool> GnssConfiguration::setSuplEs(bool) {
14 // TODO implement
15 return bool{};
16}
17
18Return<bool> GnssConfiguration::setSuplVersion(uint32_t) {
19 // TODO implement
20 return bool{};
21}
22
23Return<bool> GnssConfiguration::setSuplMode(hidl_bitfield<SuplMode>) {
24 // TODO implement
25 return bool{};
26}
27
28Return<bool> GnssConfiguration::setGpsLock(hidl_bitfield<GpsLock>) {
29 // TODO implement
30 return bool{};
31}
32
33Return<bool> GnssConfiguration::setLppProfile(hidl_bitfield<LppProfile>) {
34 // TODO implement
35 return bool{};
36}
37
38Return<bool> GnssConfiguration::setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol>) {
39 // TODO implement
40 return bool{};
41}
42
43Return<bool> GnssConfiguration::setEmergencySuplPdn(bool) {
44 // TODO implement
45 return bool{};
46}
47
48// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Yu-Han Yanga2f77322018-03-06 10:12:55 -080049Return<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
64Return<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
74std::recursive_mutex& GnssConfiguration::getMutex() const {
75 return mMutex;
Yu-Han Yang73f16ad2018-02-24 10:05:32 -080076}
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