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 NEARLINK_CALL_CLIENT_H 17 #define NEARLINK_CALL_CLIENT_H 18 19 #include "singleton.h" 20 #include "pac_map.h" 21 22 #include "call_manager_callback.h" 23 #include "i_bluetooth_call.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 class CallManagerProxy; 28 class NearlinkCallClient : public DelayedRefSingleton<NearlinkCallClient> { 29 DECLARE_DELAYED_REF_SINGLETON(NearlinkCallClient) 30 public: 31 void Init(); 32 void UnInit(); 33 34 /** 35 * @brief Register callback 36 * 37 * @param callback[in], callback function pointer 38 * @return Returns 0 on success, others on failure. 39 */ 40 int32_t RegisterCallBack(std::unique_ptr<CallManagerCallback> callback); 41 42 /** 43 * @brief unregister callback 44 * 45 * @return Returns 0 on success, others on failure. 46 */ 47 int32_t UnRegisterCallBack(); 48 49 /** 50 * @brief Answer a phone call 51 * 52 * @return Returns 0 on success, others on failure. 53 */ 54 int32_t AnswerCall(); 55 56 /** 57 * @brief Reject a phone call 58 * 59 * @return Returns 0 on success, others on failure. 60 */ 61 int32_t RejectCall(); 62 63 /** 64 * @brief Hang up the phone 65 * 66 * @return Returns 0 on success, others on failure. 67 */ 68 int32_t HangUpCall(); 69 70 /** 71 * @brief Obtain the call status of the device 72 * 73 * @return Returns 0 on success, others on failure. 74 */ 75 int32_t GetCallState(); 76 77 /** 78 * @brief Get current call list 79 * 80 * @param slotId[in], The slot id 81 * @return Returns call info list. 82 */ 83 std::vector<CallAttributeInfo> GetCurrentCallList(int32_t slotId); 84 85 /** 86 * @brief Add nearlink audio device 87 * 88 * @param address[in], audio device address 89 * @param name[in], audio device name 90 * @return Returns 0 on success, others on failure. 91 */ 92 int32_t AddAudioDevice(const std::string &address, const std::string &name); 93 94 /** 95 * @brief Remove nearlink audio device 96 * 97 * @param address[in], audio device address 98 * @return Returns 0 on success, others on failure. 99 */ 100 int32_t RemoveAudioDevice(const std::string &address); 101 102 /** 103 * @brief Reset all nearlink audio device when nearlink service removed 104 * 105 * @return Returns 0 on success, others on failure. 106 */ 107 int32_t ResetNearlinkDeviceList(); 108 private: 109 std::shared_ptr<CallManagerProxy> callManagerProxyPtr_ = nullptr; 110 sptr<IBluetoothCall> bluetoothCallProxyPtr_ = nullptr; 111 }; 112 } 113 } 114 #endif 115