1 /* 2 * Copyright (c) 2025 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_HFP_INTERFACE_H 17 #define BLUETOOTH_HFP_INTERFACE_H 18 19 #include <string> 20 #include <memory> 21 #include <vector> 22 #include "bluetooth_hfp_ag.h" 23 #include "bluetooth_device_utils.h" 24 25 namespace OHOS { 26 namespace Bluetooth { 27 class BluetoothHfpInterface { 28 public: 29 static BluetoothHfpInterface &GetInstance(); 30 31 virtual int32_t GetDeviceState(const BluetoothRemoteDevice &device, int32_t &state) = 0; 32 virtual AudioScoState GetScoState(const BluetoothRemoteDevice &device) = 0; 33 virtual int32_t GetCurrentCategory(ScoCategory &category) = 0; 34 virtual int32_t ConnectSco(uint8_t callType) = 0; 35 virtual int32_t DisconnectSco(uint8_t callType) = 0; 36 virtual int32_t OpenVoiceRecognition(const BluetoothRemoteDevice &device) = 0; 37 virtual int32_t CloseVoiceRecognition(const BluetoothRemoteDevice &device) = 0; 38 virtual int32_t SetActiveDevice(const BluetoothRemoteDevice &device) = 0; 39 40 virtual void RegisterObserver(std::shared_ptr<HandsFreeAudioGatewayObserver> observer) = 0; 41 virtual void DeregisterObserver(std::shared_ptr<HandsFreeAudioGatewayObserver> observer) = 0; 42 virtual std::vector<BluetoothRemoteDevice> GetDevicesByStates(std::vector<int> states) = 0; 43 virtual void GetVirtualDeviceList(std::vector<std::string> &devices) = 0; 44 virtual BluetoothRemoteDevice GetActiveDevice() = 0; 45 virtual int32_t Connect(const BluetoothRemoteDevice &device) = 0; 46 virtual int32_t IsInbandRingingEnabled(bool &isEnabled) = 0; 47 virtual int32_t GetLastError() = 0; 48 virtual std::string GetLastOpration() = 0; 49 50 protected: BluetoothHfpInterface()51 BluetoothHfpInterface() {} ~BluetoothHfpInterface()52 virtual ~BluetoothHfpInterface() {} 53 }; 54 } 55 } 56 #endif