1e1c44949Sopenharmony_ci/* 2e1c44949Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 3e1c44949Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e1c44949Sopenharmony_ci * you may not use this file except in compliance with the License. 5e1c44949Sopenharmony_ci * You may obtain a copy of the License at 6e1c44949Sopenharmony_ci * 7e1c44949Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e1c44949Sopenharmony_ci * 9e1c44949Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e1c44949Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e1c44949Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e1c44949Sopenharmony_ci * See the License for the specific language governing permissions and 13e1c44949Sopenharmony_ci * limitations under the License. 14e1c44949Sopenharmony_ci */ 15e1c44949Sopenharmony_ci 16e1c44949Sopenharmony_ci#ifndef VOIP_CALL_MANAGER_PROXY_H 17e1c44949Sopenharmony_ci#define VOIP_CALL_MANAGER_PROXY_H 18e1c44949Sopenharmony_ci 19e1c44949Sopenharmony_ci#include <cfloat> 20e1c44949Sopenharmony_ci#include <cstdio> 21e1c44949Sopenharmony_ci#include <string> 22e1c44949Sopenharmony_ci#include <vector> 23e1c44949Sopenharmony_ci 24e1c44949Sopenharmony_ci#include "i_voip_call_manager_service.h" 25e1c44949Sopenharmony_ci#include "iremote_broker.h" 26e1c44949Sopenharmony_ci#include "iremote_proxy.h" 27e1c44949Sopenharmony_ci#include "pac_map.h" 28e1c44949Sopenharmony_ci 29e1c44949Sopenharmony_cinamespace OHOS { 30e1c44949Sopenharmony_cinamespace Telephony { 31e1c44949Sopenharmony_ciclass VoipCallManagerProxy : public IRemoteProxy<IVoipCallManagerService> { 32e1c44949Sopenharmony_cipublic: 33e1c44949Sopenharmony_ci /** 34e1c44949Sopenharmony_ci * VoipCallManagerProxy 35e1c44949Sopenharmony_ci * 36e1c44949Sopenharmony_ci * @param impl 37e1c44949Sopenharmony_ci */ 38e1c44949Sopenharmony_ci explicit VoipCallManagerProxy(const sptr<IRemoteObject> &impl); 39e1c44949Sopenharmony_ci virtual ~VoipCallManagerProxy() = default; 40e1c44949Sopenharmony_ci 41e1c44949Sopenharmony_ci /** 42e1c44949Sopenharmony_ci * @brief thrid-party applications report a incoming call. 43e1c44949Sopenharmony_ci * 44e1c44949Sopenharmony_ci * @param extras[in], extras date. 45e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 46e1c44949Sopenharmony_ci */ 47e1c44949Sopenharmony_ci int32_t ReportIncomingCall( 48e1c44949Sopenharmony_ci AppExecFwk::PacMap &extras, std::vector<uint8_t> &userProfile, ErrorReason &reason) override; 49e1c44949Sopenharmony_ci /** 50e1c44949Sopenharmony_ci * @brief thrid-party applications report incoming call failed causes. 51e1c44949Sopenharmony_ci * 52e1c44949Sopenharmony_ci * @param extras[in], extras date. 53e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 54e1c44949Sopenharmony_ci */ 55e1c44949Sopenharmony_ci int32_t ReportIncomingCallError(AppExecFwk::PacMap &extras) override; 56e1c44949Sopenharmony_ci /** 57e1c44949Sopenharmony_ci * @brief thrid-party applications report call state change. 58e1c44949Sopenharmony_ci * 59e1c44949Sopenharmony_ci * @param callId[in], The call id 60e1c44949Sopenharmony_ci * @param VoipCallState[in], The voip call state 61e1c44949Sopenharmony_ci * @param VoipCallType[in], The voip call type 62e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 63e1c44949Sopenharmony_ci */ 64e1c44949Sopenharmony_ci int32_t ReportCallStateChange(std::string callId, const VoipCallState &state, const VoipCallType &type) override; 65e1c44949Sopenharmony_ci /** 66e1c44949Sopenharmony_ci * @brief thrid-party applications report a outgoing call. 67e1c44949Sopenharmony_ci * 68e1c44949Sopenharmony_ci * @param extras[in], extras date. 69e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 70e1c44949Sopenharmony_ci */ 71e1c44949Sopenharmony_ci int32_t ReportOutgoingCall( 72e1c44949Sopenharmony_ci AppExecFwk::PacMap &extras, std::vector<uint8_t> &userProfile, ErrorReason &reason) override; 73e1c44949Sopenharmony_ci 74e1c44949Sopenharmony_ci /** 75e1c44949Sopenharmony_ci * RegisterCallBack 76e1c44949Sopenharmony_ci * 77e1c44949Sopenharmony_ci * @brief Register callback 78e1c44949Sopenharmony_ci * @param callback[in], callback function pointer 79e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 80e1c44949Sopenharmony_ci */ 81e1c44949Sopenharmony_ci int32_t RegisterCallBack(const sptr<IVoipCallManagerCallback> &callback) override; 82e1c44949Sopenharmony_ci /** 83e1c44949Sopenharmony_ci * UnRegisterCallBack 84e1c44949Sopenharmony_ci * 85e1c44949Sopenharmony_ci * @brief unregister callback 86e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 87e1c44949Sopenharmony_ci */ 88e1c44949Sopenharmony_ci int32_t UnRegisterCallBack() override; 89e1c44949Sopenharmony_ci 90e1c44949Sopenharmony_ci /** 91e1c44949Sopenharmony_ci * @brief pushSA report a incoming call. 92e1c44949Sopenharmony_ci * 93e1c44949Sopenharmony_ci * @param callId[in], The call id 94e1c44949Sopenharmony_ci * @param bundleName[in], The bundleName 95e1c44949Sopenharmony_ci * @param processMode[in], The processMode 96e1c44949Sopenharmony_ci * @param uid[in], The uid 97e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 98e1c44949Sopenharmony_ci */ 99e1c44949Sopenharmony_ci int32_t ReportVoipIncomingCall( 100e1c44949Sopenharmony_ci std::string callId, std::string bundleName, std::string processMode, int32_t uid) override; 101e1c44949Sopenharmony_ci /** 102e1c44949Sopenharmony_ci * @brief pushSA report call extensionId. 103e1c44949Sopenharmony_ci * 104e1c44949Sopenharmony_ci * @param callId[in], The call id 105e1c44949Sopenharmony_ci * @param bundleName[in], The bundleName 106e1c44949Sopenharmony_ci * @param extensionId[in], The extensionId 107e1c44949Sopenharmony_ci * @param uid[in], The uid 108e1c44949Sopenharmony_ci * @return Returns 0 on success, others on failure. 109e1c44949Sopenharmony_ci */ 110e1c44949Sopenharmony_ci int32_t ReportVoipCallExtensionId( 111e1c44949Sopenharmony_ci std::string callId, std::string bundleName, std::string extensionId, int32_t uid) override; 112e1c44949Sopenharmony_ci 113e1c44949Sopenharmony_ci /** 114e1c44949Sopenharmony_ci * @brief hang up a call 115e1c44949Sopenharmony_ci * 116e1c44949Sopenharmony_ci * @param events[in], The VoipCallEventInfo 117e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 118e1c44949Sopenharmony_ci */ 119e1c44949Sopenharmony_ci int32_t HangUp(const VoipCallEventInfo &events) override; 120e1c44949Sopenharmony_ci 121e1c44949Sopenharmony_ci /** 122e1c44949Sopenharmony_ci * @brief reject a call 123e1c44949Sopenharmony_ci * 124e1c44949Sopenharmony_ci * @param events[in], The VoipCallEventInfo 125e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 126e1c44949Sopenharmony_ci */ 127e1c44949Sopenharmony_ci int32_t Reject(const VoipCallEventInfo &events) override; 128e1c44949Sopenharmony_ci 129e1c44949Sopenharmony_ci /** 130e1c44949Sopenharmony_ci * @brief answer a call 131e1c44949Sopenharmony_ci * 132e1c44949Sopenharmony_ci * @param events[in], The VoipCallEventInfo 133e1c44949Sopenharmony_ci * @param videoState[in], The videoState 134e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 135e1c44949Sopenharmony_ci */ 136e1c44949Sopenharmony_ci int32_t Answer(const VoipCallEventInfo &events, int32_t videoState) override; 137e1c44949Sopenharmony_ci 138e1c44949Sopenharmony_ci /** 139e1c44949Sopenharmony_ci * @brief Unload voip SA 140e1c44949Sopenharmony_ci * 141e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 142e1c44949Sopenharmony_ci */ 143e1c44949Sopenharmony_ci int32_t UnloadVoipSa() override; 144e1c44949Sopenharmony_ci 145e1c44949Sopenharmony_ci /** 146e1c44949Sopenharmony_ci * @brief Register CallManager CallBack ptr 147e1c44949Sopenharmony_ci * 148e1c44949Sopenharmony_ci * @param callback callback ptr 149e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 150e1c44949Sopenharmony_ci */ 151e1c44949Sopenharmony_ci int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) override; 152e1c44949Sopenharmony_ci /** 153e1c44949Sopenharmony_ci * @brief UnRegister CallManager CallBack ptr 154e1c44949Sopenharmony_ci * 155e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 156e1c44949Sopenharmony_ci */ 157e1c44949Sopenharmony_ci int32_t UnRegisterCallManagerCallBack() override; 158e1c44949Sopenharmony_ci 159e1c44949Sopenharmony_ci /** 160e1c44949Sopenharmony_ci * @brief Send Call ui event 161e1c44949Sopenharmony_ci * 162e1c44949Sopenharmony_ci * @param voipCallId[in], The VoipCallId 163e1c44949Sopenharmony_ci * @param callAudioEvent[in], The call audio event 164e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 165e1c44949Sopenharmony_ci */ 166e1c44949Sopenharmony_ci int32_t SendCallUiEvent(std::string voipCallId, const CallAudioEvent &callAudioEvent) override; 167e1c44949Sopenharmony_ci 168e1c44949Sopenharmony_ci /** 169e1c44949Sopenharmony_ci * @brief thrid-party applications report call audio event change 170e1c44949Sopenharmony_ci * 171e1c44949Sopenharmony_ci * @param voipCallId[in], The VoipCallId 172e1c44949Sopenharmony_ci * @param callAudioEvent[in], The call audio event 173e1c44949Sopenharmony_ci * @return Returns TELEPHONY_SUCCESS on success, others on failure. 174e1c44949Sopenharmony_ci */ 175e1c44949Sopenharmony_ci int32_t ReportCallAudioEventChange(std::string voipCallId, const CallAudioEvent &callAudioEvent) override; 176e1c44949Sopenharmony_ci 177e1c44949Sopenharmony_ciprivate: 178e1c44949Sopenharmony_ci static inline BrokerDelegator<VoipCallManagerProxy> delegator_; 179e1c44949Sopenharmony_ci}; 180e1c44949Sopenharmony_ci 181e1c44949Sopenharmony_ci} // namespace Telephony 182e1c44949Sopenharmony_ci} // namespace OHOS 183e1c44949Sopenharmony_ci 184e1c44949Sopenharmony_ci#endif 185