195489c19Sopenharmony_ci/* 295489c19Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 395489c19Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 495489c19Sopenharmony_ci * you may not use this file except in compliance with the License. 595489c19Sopenharmony_ci * You may obtain a copy of the License at 695489c19Sopenharmony_ci * 795489c19Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 895489c19Sopenharmony_ci * 995489c19Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1095489c19Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1195489c19Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1295489c19Sopenharmony_ci * See the License for the specific language governing permissions and 1395489c19Sopenharmony_ci * limitations under the License. 1495489c19Sopenharmony_ci */ 1595489c19Sopenharmony_ci 1695489c19Sopenharmony_ci#ifndef BLUETOOTH_AUDIO_MANAGER_H 1795489c19Sopenharmony_ci#define BLUETOOTH_AUDIO_MANAGER_H 1895489c19Sopenharmony_ci 1995489c19Sopenharmony_ci#include <cstdint> 2095489c19Sopenharmony_ci#include <string> 2195489c19Sopenharmony_ci 2295489c19Sopenharmony_ci#include "iremote_broker.h" 2395489c19Sopenharmony_ci#include "refbase.h" 2495489c19Sopenharmony_ci#include "bluetooth_def.h" 2595489c19Sopenharmony_ci#include "bluetooth_types.h" 2695489c19Sopenharmony_ci#include "bluetooth_remote_device.h" 2795489c19Sopenharmony_ci#include "bluetooth_no_destructor.h" 2895489c19Sopenharmony_ci 2995489c19Sopenharmony_cinamespace OHOS { 3095489c19Sopenharmony_cinamespace Bluetooth { 3195489c19Sopenharmony_ci 3295489c19Sopenharmony_ciclass BLUETOOTH_API BluetoothAudioManager { 3395489c19Sopenharmony_cipublic: 3495489c19Sopenharmony_ci /** 3595489c19Sopenharmony_ci * @brief Get audio manager. 3695489c19Sopenharmony_ci * 3795489c19Sopenharmony_ci * @return Returns the singleton instance. 3895489c19Sopenharmony_ci * @since 6 3995489c19Sopenharmony_ci */ 4095489c19Sopenharmony_ci static BluetoothAudioManager &GetInstance(); 4195489c19Sopenharmony_ci 4295489c19Sopenharmony_ci int EnableWearDetection(const std::string &deviceId); 4395489c19Sopenharmony_ci int DisableWearDetection(const std::string &deviceId); 4495489c19Sopenharmony_ci int GetWearDetectionState(const std::string &deviceId, int32_t &ability); 4595489c19Sopenharmony_ci 4695489c19Sopenharmony_ci /** 4795489c19Sopenharmony_ci * @brief Headset is wearing. 4895489c19Sopenharmony_ci * 4995489c19Sopenharmony_ci * @param device Remote device. 5095489c19Sopenharmony_ci * @return Returns {@link BtErrCode} if the operation fails. 5195489c19Sopenharmony_ci * returns {wear 1 or unwear 0} otherwise. 5295489c19Sopenharmony_ci * @since 11 5395489c19Sopenharmony_ci */ 5495489c19Sopenharmony_ci int IsDeviceWearing(const BluetoothRemoteDevice &device); 5595489c19Sopenharmony_ci 5695489c19Sopenharmony_ci /** 5795489c19Sopenharmony_ci * @brief Whether wear detection is supported 5895489c19Sopenharmony_ci * 5995489c19Sopenharmony_ci * @param device Remote device. 6095489c19Sopenharmony_ci * @param isSupported Headset wearing detection capability. 6195489c19Sopenharmony_ci * @return Returns {@link BT_NO_ERROR} if the operation fails. 6295489c19Sopenharmony_ci * returns an error code defined in {@link BtErrCode} otherwise. 6395489c19Sopenharmony_ci * @since 11 6495489c19Sopenharmony_ci */ 6595489c19Sopenharmony_ci int IsWearDetectionSupported(const BluetoothRemoteDevice &device, bool &isSupported); 6695489c19Sopenharmony_ci 6795489c19Sopenharmony_ci /** 6895489c19Sopenharmony_ci * @brief Report to the remote device that the user has selected the device. 6995489c19Sopenharmony_ci * @param device Remote device. 7095489c19Sopenharmony_ci * @param useA2dp whether use A2dp of this device. 7195489c19Sopenharmony_ci * @param useHfp whether use Hfp of this device. 7295489c19Sopenharmony_ci * @param userSelection whether this send command by user selection. 7395489c19Sopenharmony_ci * @return Returns {@link BT_NO_ERROR} if send selection success; 7495489c19Sopenharmony_ci * returns an error code defined in {@link BtErrCode} otherwise. 7595489c19Sopenharmony_ci */ 7695489c19Sopenharmony_ci int SendDeviceSelection(const BluetoothRemoteDevice &device, int useA2dp, int useHfp, int userSelection) const; 7795489c19Sopenharmony_ci 7895489c19Sopenharmony_ciprivate: 7995489c19Sopenharmony_ci /** 8095489c19Sopenharmony_ci * @brief A constructor used to create a <b>BluetoothHost</b> instance. 8195489c19Sopenharmony_ci * 8295489c19Sopenharmony_ci * @since 6 8395489c19Sopenharmony_ci */ 8495489c19Sopenharmony_ci BluetoothAudioManager(); 8595489c19Sopenharmony_ci 8695489c19Sopenharmony_ci BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothAudioManager); 8795489c19Sopenharmony_ci BLUETOOTH_DECLARE_IMPL(); 8895489c19Sopenharmony_ci 8995489c19Sopenharmony_ci#ifdef DTFUZZ_TEST 9095489c19Sopenharmony_ci friend class BluetoothNoDestructor<BluetoothAudioManager>; 9195489c19Sopenharmony_ci#endif 9295489c19Sopenharmony_ci}; 9395489c19Sopenharmony_ci} // namespace Bluetooth 9495489c19Sopenharmony_ci} // namespace OHOS 9595489c19Sopenharmony_ci#endif 96