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 I_VOIP_CALL_MANAGER_SERVICE_H
17 #define I_VOIP_CALL_MANAGER_SERVICE_H
18 #include <cstdio>
19 #include <string>
20 #include <vector>
21 
22 #include "i_call_status_callback.h"
23 #include "i_voip_call_manager_callback.h"
24 #include "iremote_broker.h"
25 #include "pac_map.h"
26 #include "voip_call_manager_info.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 
31 class IVoipCallManagerService : public IRemoteBroker {
32 public:
33     enum {
34         INTERFACE_REPORT_INCOMING_CALL = 0,
35         INTERFACE_REPORT_INCOMING_CALL_ERROR,
36         INTERFACE_REPORT_CALL_STATE_CHANGE,
37         INTERFACE_REGISTER_CALLBACK,
38         INTERFACE_UN_REGISTER_CALLBACK,
39         INTERFACE_REPORT_VOIP_INCOMING_CALL,
40         INTERFACE_REPORT_VOIP_CALL_EXTENSIONID,
41         INTERFACE_REGISTER_CALL_MANAGER_CALLBACK,
42         INTERFACE_UNREGISTER_CALL_MANAGER_CALLBACK,
43         INTERFACE_ANSWER_VOIP_CALL,
44         INTERFACE_HANGUP_VOIP_CALL,
45         INTERFACE_REJECT_VOIP_CALL,
46         INTERFACE_UNLOAD_VOIP_SA,
47         INTERFACE_SEND_CALL_UI_EVENT,
48         INTERFACE_REPORT_CALL_AUDIO_EVENT_CHANGE,
49         INTERFACE_REPORT_OUTGOING_CALL
50     };
51     virtual ~IVoipCallManagerService() = default;
52     virtual int32_t ReportIncomingCall(
53         AppExecFwk::PacMap &extras, std::vector<uint8_t> &userProfile, ErrorReason &reason) = 0;
54     virtual int32_t ReportIncomingCallError(AppExecFwk::PacMap &extras) = 0;
55     virtual int32_t ReportCallStateChange(
56         std::string callId, const VoipCallState &state, const VoipCallType &type) = 0;
57     virtual int32_t RegisterCallBack(const sptr<IVoipCallManagerCallback> &callback) = 0;
58     virtual int32_t UnRegisterCallBack() = 0;
59     virtual int32_t ReportVoipIncomingCall(
60         std::string callId, std::string bundleName, std::string processMode, int32_t uid) = 0;
61     virtual int32_t ReportVoipCallExtensionId(
62         std::string callId, std::string bundleName, std::string extensionId, int32_t uid) = 0;
63 
64     virtual int32_t RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback) = 0;
65     virtual int32_t UnRegisterCallManagerCallBack() = 0;
66     virtual int32_t Answer(const VoipCallEventInfo &events, int32_t videoState) = 0;
67     virtual int32_t HangUp(const VoipCallEventInfo &events) = 0;
68     virtual int32_t Reject(const VoipCallEventInfo &events) = 0;
69     virtual int32_t UnloadVoipSa() = 0;
70     virtual int32_t SendCallUiEvent(std::string voipCallId, const CallAudioEvent &callAudioEvent) = 0;
71     virtual int32_t ReportCallAudioEventChange(std::string voipCallId, const CallAudioEvent &callAudioEvent) = 0;
72     virtual int32_t ReportOutgoingCall(
73         AppExecFwk::PacMap &extras, std::vector<uint8_t> &userProfile, ErrorReason &reason) = 0;
74 
75 public:
76     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Telephony.IVoipCallManagerService");
77 };
78 } // namespace Telephony
79 } // namespace OHOS
80 
81 #endif
82