1 /* 2 * Copyright 2019 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 19 #include <string> 20 21 #include "src/init_flags.rs.h" 22 23 namespace bluetooth { 24 namespace common { 25 26 class InitFlags final { 27 public: Load(const char ** flags)28 inline static void Load(const char** flags) { 29 rust::Vec<rust::String> rusted_flags = rust::Vec<rust::String>(); 30 while (flags != nullptr && *flags != nullptr) { 31 rusted_flags.push_back(rust::String(*flags)); 32 flags++; 33 } 34 init_flags::load(std::move(rusted_flags)); 35 } 36 IsBtmDmFlushDiscoveryQueueOnSearchCancel()37 inline static bool IsBtmDmFlushDiscoveryQueueOnSearchCancel() { 38 return init_flags::btm_dm_flush_discovery_queue_on_search_cancel_is_enabled(); 39 } 40 IsTargetedAnnouncementReconnectionMode()41 inline static bool IsTargetedAnnouncementReconnectionMode() { 42 return init_flags::leaudio_targeted_announcement_reconnection_mode_is_enabled(); 43 } 44 UseRsiFromCachedInquiryResults()45 inline static bool UseRsiFromCachedInquiryResults() { 46 return init_flags::use_rsi_from_cached_inqiry_results_is_enabled(); 47 } 48 GetAdapterIndex()49 inline static int GetAdapterIndex() { 50 return init_flags::get_hci_adapter(); 51 } 52 SetAllForTesting()53 inline static void SetAllForTesting() { 54 init_flags::set_all_for_testing(); 55 } 56 }; 57 58 } // namespace common 59 } // namespace bluetooth 60