1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 #include <mutex> 19 #include <unordered_set> 20 #include <aidl/android/hardware/gnss/BnGnssConfiguration.h> 21 22 namespace aidl { 23 namespace android { 24 namespace hardware { 25 namespace gnss { 26 namespace implementation { 27 28 struct GnssConfiguration : public BnGnssConfiguration { 29 ndk::ScopedAStatus setSuplVersion(int version) override; 30 ndk::ScopedAStatus setSuplMode(int mode) override; 31 ndk::ScopedAStatus setLppProfile(int lppProfile) override; 32 ndk::ScopedAStatus setGlonassPositioningProtocol(int protocol) override; 33 ndk::ScopedAStatus setEmergencySuplPdn(bool enable) override; 34 ndk::ScopedAStatus setEsExtensionSec(int emergencyExtensionSeconds) override; 35 ndk::ScopedAStatus setBlocklist(const std::vector<BlocklistedSource>& blocklist) override; 36 37 bool isBlocklisted(GnssConstellationType constellation, int svid) const; 38 39 private: 40 struct BlocklistedSourceHasher { 41 size_t operator()(const BlocklistedSource& x) const noexcept; 42 }; 43 44 struct BlocklistedSourceEqual { 45 bool operator()(const BlocklistedSource& lhs, 46 const BlocklistedSource& rhs) const noexcept; 47 }; 48 49 using BlocklistedSources = std::unordered_set<BlocklistedSource, 50 BlocklistedSourceHasher, 51 BlocklistedSourceEqual>; 52 BlocklistedSources mBlocklistedSources; 53 mutable std::mutex mMtx; 54 }; 55 56 } // namespace implementation 57 } // namespace gnss 58 } // namespace hardware 59 } // namespace android 60 } // namespace aidl 61