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 BLUETOOTH_CALL_CONNECTION_H 17 #define BLUETOOTH_CALL_CONNECTION_H 18 19 #include <mutex> 20 21 #include "common_type.h" 22 #include "singleton.h" 23 #include "bluetooth_hfp_hf.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 class BluetoothCallConnection : public std::enable_shared_from_this<BluetoothCallConnection> { 28 DECLARE_DELAYED_SINGLETON(BluetoothCallConnection) 29 30 public: 31 int32_t Dial(DialParaInfo &info); 32 void SetMacAddress(const std::string &macAddress); 33 std::string GetMacAddress(); 34 35 int32_t ConnectBtSco(); 36 int32_t DisConnectBtSco(); 37 bool GetBtScoIsConnected(); 38 39 void SetHfpConnected(bool isHfpConnected); 40 bool GetSupportBtCall(); 41 void SetBtCallScoConnected(bool isBtCallScoConnected); 42 bool GetBtCallScoConnected(); 43 void HfpDisConnectedEndBtCall(); 44 void SetHfpContactName(const std::string &hfpPhoneNumber, const std::string &hfpContactName); 45 std::string GetHfpContactName(const std::string &hfpPhoneNumber); 46 47 private: 48 std::string macAddress_; 49 bool isHfpConnected_ = false; 50 bool isBtCallScoConnected_ = false; 51 std::string hfpPhoneNumber_; 52 std::string hfpContactName_; 53 }; 54 } // namespace Telephony 55 } // namespace OHOS 56 57 #endif 58