platform_hardware_interfaces/gnss/1.1/default/GnssConfiguration.cpp
Yu-Han Yang a2f77322b4 Mock blacklisting satellites in default implementation
- Mock GnssDebug to pass the sanity check.

Bug: 73845705

Test: All Gnss v1.1 VTS tests are passing on gce_x86

Change-Id: I258fb1671d2b682f471207192b8a0feb138c16ab
2018-03-14 14:23:30 -07:00

84 lines
2.4 KiB
C++

#define LOG_TAG "GnssConfiguration"
#include "GnssConfiguration.h"
#include <log/log.h>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setSuplEs(bool) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setSuplVersion(uint32_t) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setSuplMode(hidl_bitfield<SuplMode>) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setGpsLock(hidl_bitfield<GpsLock>) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setLppProfile(hidl_bitfield<LppProfile>) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol>) {
// TODO implement
return bool{};
}
Return<bool> GnssConfiguration::setEmergencySuplPdn(bool) {
// TODO implement
return bool{};
}
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setBlacklist(const hidl_vec<BlacklistedSource>& sourceList) {
std::unique_lock<std::recursive_mutex> lock(mMutex);
mBlacklistedConstellationSet.clear();
mBlacklistedSourceSet.clear();
for (auto source : sourceList) {
if (source.svid == 0) {
// Wildcard blacklist, i.e., blacklist entire constellation.
mBlacklistedConstellationSet.insert(source.constellation);
} else {
mBlacklistedSourceSet.insert(source);
}
}
return true;
}
Return<bool> GnssConfiguration::isBlacklisted(const GnssSvInfo& gnssSvInfo) const {
std::unique_lock<std::recursive_mutex> lock(mMutex);
if (mBlacklistedConstellationSet.find(gnssSvInfo.constellation) !=
mBlacklistedConstellationSet.end()) {
return true;
}
BlacklistedSource source = {.constellation = gnssSvInfo.constellation, .svid = gnssSvInfo.svid};
return (mBlacklistedSourceSet.find(source) != mBlacklistedSourceSet.end());
}
std::recursive_mutex& GnssConfiguration::getMutex() const {
return mMutex;
}
// Methods from ::android::hidl::base::V1_0::IBase follow.
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android