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 VOIP_CALL_MANAGER_PROXY_H 17 #define VOIP_CALL_MANAGER_PROXY_H 18 19 #include <cfloat> 20 #include <cstdio> 21 #include <string> 22 #include <vector> 23 24 #include "i_voip_call_manager_service.h" 25 #include "iremote_broker.h" 26 #include "iremote_proxy.h" 27 #include "pac_map.h" 28 29 namespace OHOS { 30 namespace Telephony { 31 class VoipCallManagerProxy : public IRemoteProxy<IVoipCallManagerService> { 32 public: 33 /** 34 * VoipCallManagerProxy 35 * 36 * @param impl 37 */ 38 explicit VoipCallManagerProxy(const sptr<IRemoteObject> &impl); 39 virtual ~VoipCallManagerProxy() = default; 40 41 /** 42 * @brief thrid-party applications report a incoming call. 43 * 44 * @param extras[in], extras date. 45 * @return Returns 0 on success, others on failure. 46 */ 47 int32_t ReportIncomingCall( 48 AppExecFwk::PacMap &extras, std::vector<uint8_t> &userProfile, ErrorReason &reason) override; 49 /** 50 * @brief thrid-party applications report incoming call failed causes. 51 * 52 * @param extras[in], extras date. 53 * @return Returns 0 on success, others on failure. 54 */ 55 int32_t ReportIncomingCallError(AppExecFwk::PacMap &extras) override; 56 /** 57 * @brief thrid-party applications report call state change. 58 * 59 * @param callId[in], The call id 60 * @param VoipCallState[in], The voip call state 61 * @return Returns 0 on success, others on failure. 62 */ 63 int32_t ReportCallStateChange(std::string &callId, const VoipCallState &state) override; 64 /** 65 * RegisterCallBack 66 * 67 * @brief Register callback 68 * @param callback[in], callback function pointer 69 * @return Returns 0 on success, others on failure. 70 */ 71 int32_t RegisterCallBack(const sptr<IVoipCallManagerCallback> &callback) override; 72 73 /** 74 * UnRegisterCallBack 75 * 76 * @brief unregister callback 77 * @return Returns 0 on success, others on failure. 78 */ 79 int32_t UnRegisterCallBack() override; 80 /** 81 * @brief pushSA report a incoming call. 82 * 83 * @param callId[in], The call id 84 * @param bundleName[in], The bundleName 85 * @return Returns 0 on success, others on failure. 86 */ 87 int32_t ReportVoipIncomingCall(std::string &callId, std::string &bundleName) override; 88 89 /** 90 * @brief pushSA report call extensionId. 91 * 92 * @param callId[in], The call id 93 * @param bundleName[in], The bundleName 94 * @param extensionId[in], The extensionId 95 * @return Returns 0 on success, others on failure. 96 */ 97 int32_t ReportVoipCallExtensionId(std::string &callId, std::string &bundleName, std::string &extensionId) override; 98 99 /** 100 * @brief hang up a call 101 * 102 * @param events[in], The VoipCallEventInfo 103 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 104 */ 105 int32_t HangUp(const VoipCallEventInfo &events) override; 106 107 /** 108 * @brief reject a call 109 * 110 * @param events[in], The VoipCallEventInfo 111 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 112 */ 113 int32_t Reject(const VoipCallEventInfo &events) override; 114 115 /** 116 * @brief answer a call 117 * 118 * @param events[in], The VoipCallEventInfo 119 * @param videoState[in], The videoState 120 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 121 */ 122 int32_t Answer(const VoipCallEventInfo &events, int32_t videoState) override; 123 124 /** 125 * @brief Unload voip SA 126 * 127 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 128 */ 129 int32_t UnloadVoipSa() override; 130 131 /** 132 * @brief Register CallManager CallBack ptr 133 * 134 * @param callback callback ptr 135 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 136 */ 137 int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) override; 138 /** 139 * @brief UnRegister CallManager CallBack ptr 140 * 141 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 142 */ 143 int32_t UnRegisterCallManagerCallBack() override; 144 145 private: 146 static inline BrokerDelegator<VoipCallManagerProxy> delegator_; 147 }; 148 149 } // namespace Telephony 150 } // namespace OHOS 151 152 #endif 153