GnssConfiguration.cpp 2.4 KB

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