1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ABILITY_DMSFWK_1_BLUETOOTH_STATE_ADAPTER_H 17 #define ABILITY_DMSFWK_1_BLUETOOTH_STATE_ADAPTER_H 18 19 #include <string> 20 #include "single_instance.h" 21 #include <atomic> 22 23 namespace OHOS { 24 namespace DistributedSchedule { 25 class BluetoothStateAdapter { 26 public: 27 DECLARE_SINGLE_INSTANCE_BASE(BluetoothStateAdapter); 28 29 public: 30 bool IsBluetoothActive(); 31 32 void UpdateBTState(bool isBTActive); 33 34 void UpdateBLEState(bool isBLEActive); 35 36 private: BluetoothStateAdapter()37 BluetoothStateAdapter() {} 38 39 std::atomic<bool> isBTActive_ = false; 40 std::atomic<bool> isBLEActive_ = false; 41 }; 42 } // namespace DistributedSchedule 43 } // namespace OHOS 44 #endif //ABILITY_DMSFWK_1_BLUETOOTH_STATE_ADAPTER_H 45