• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <stdexcept>
20 #include <string>
21 #include <unordered_map>
22 
23 #include "src/init_flags.rs.h"
24 
25 namespace bluetooth {
26 namespace common {
27 
28 class InitFlags final {
29  public:
Load(const char ** flags)30   inline static void Load(const char** flags) {
31     rust::Vec<rust::String> rusted_flags = rust::Vec<rust::String>();
32     while (flags != nullptr && *flags != nullptr) {
33       rusted_flags.push_back(rust::String(*flags));
34       flags++;
35     }
36     init_flags::load(std::move(rusted_flags));
37   }
38 
IsDebugLoggingEnabledForTag(const std::string & tag)39   inline static bool IsDebugLoggingEnabledForTag(const std::string& tag) {
40     return init_flags::is_debug_logging_enabled_for_tag(tag);
41   }
42 
IsDebugLoggingEnabledForAll()43   inline static bool IsDebugLoggingEnabledForAll() {
44     return init_flags::logging_debug_enabled_for_all_is_enabled();
45   }
46 
IsBtmDmFlushDiscoveryQueueOnSearchCancel()47   inline static bool IsBtmDmFlushDiscoveryQueueOnSearchCancel() {
48     return init_flags::btm_dm_flush_discovery_queue_on_search_cancel_is_enabled();
49   }
50 
IsTargetedAnnouncementReconnectionMode()51   inline static bool IsTargetedAnnouncementReconnectionMode() {
52     return init_flags::leaudio_targeted_announcement_reconnection_mode_is_enabled();
53   }
54 
GetAdapterIndex()55   inline static int GetAdapterIndex() {
56     return init_flags::get_hci_adapter();
57   }
58 
SetAllForTesting()59   inline static void SetAllForTesting() {
60     init_flags::set_all_for_testing();
61   }
62 };
63 
64 }  // namespace common
65 }  // namespace bluetooth
66