1 /* 2 * Copyright (C) 2023 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 BLUETOOTH_AUDIO_MANAGER_H 17 #define BLUETOOTH_AUDIO_MANAGER_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "iremote_broker.h" 23 #include "refbase.h" 24 #include "bluetooth_def.h" 25 #include "bluetooth_types.h" 26 #include "bluetooth_remote_device.h" 27 28 namespace OHOS { 29 namespace Bluetooth { 30 31 class BLUETOOTH_API BluetoothAudioManager { 32 public: 33 /** 34 * @brief Get audio manager. 35 * 36 * @return Returns the singleton instance. 37 * @since 6 38 */ 39 static BluetoothAudioManager &GetInstance(); 40 41 int EnableWearDetection(const std::string &deviceId); 42 int DisableWearDetection(const std::string &deviceId); 43 int GetWearDetectionState(const std::string &deviceId, int32_t &ability); 44 45 /** 46 * @brief Whether wear detection is supported 47 * 48 * @param device Remote device. 49 * @param isSupported Headset wearing detection capability. 50 * @return Returns {@link BT_NO_ERROR} if the operation fails. 51 * returns an error code defined in {@link BtErrCode} otherwise. 52 * @since 11 53 */ 54 int IsWearDetectionSupported(const BluetoothRemoteDevice &device, bool &isSupported); 55 56 /** 57 * @brief Report to the remote device that the user has selected the device. 58 * @param device Remote device. 59 * @param useA2dp whether use A2dp of this device. 60 * @param useHfp whether use Hfp of this device. 61 * @param userSelection whether this send command by user selection. 62 * @return Returns {@link BT_NO_ERROR} if send selection success; 63 * returns an error code defined in {@link BtErrCode} otherwise. 64 */ 65 int SendDeviceSelection(const BluetoothRemoteDevice &device, int useA2dp, int useHfp, int userSelection) const; 66 67 private: 68 /** 69 * @brief A constructor used to create a <b>BluetoothHost</b> instance. 70 * 71 * @since 6 72 */ 73 BluetoothAudioManager(); 74 75 BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothAudioManager); 76 BLUETOOTH_DECLARE_IMPL(); 77 78 }; 79 } // namespace Bluetooth 80 } // namespace OHOS 81 #endif 82