• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-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 TELEPHONY_IMS_CALL_CALLBACK_STUB_H
17 #define TELEPHONY_IMS_CALL_CALLBACK_STUB_H
18 
19 #include <map>
20 
21 #include "cellular_call_data_struct.h"
22 #include "ims_call_callback_interface.h"
23 #include "ims_call_callback_ipc_interface_code.h"
24 #include "iremote_stub.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class ImsCallCallbackStub : public IRemoteStub<ImsCallCallbackInterface> {
29 public:
30     ImsCallCallbackStub();
31     virtual ~ImsCallCallbackStub();
32     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
33 
34     /****************** call basic ******************/
35     int32_t DialResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
36     int32_t HangUpResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
37     int32_t RejectWithReasonResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
38     int32_t AnswerResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
39     int32_t HoldCallResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
40     int32_t UnHoldCallResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
41     int32_t SwitchCallResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
42     int32_t CallStateChangeReport(int32_t slotId) override;
43     int32_t GetImsCallsDataResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
44     int32_t GetImsCallsDataResponse(int32_t slotId, const ImsCurrentCallList &callList) override;
45     int32_t LastCallFailReasonResponse(int32_t slotId, const DisconnectedDetails &details) override;
46     int32_t CallRingBackReport(int32_t slotId, const RingbackVoice &info) override;
47 
48     /****************** dtmf rtt ******************/
49     int32_t StartDtmfResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
50     int32_t SendDtmfResponse(int32_t slotId, const HRilRadioResponseInfo &info, int32_t callIndex) override;
51     int32_t StopDtmfResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
52 
53     /****************** ims config ******************/
54     int32_t SetImsSwitchResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
55     int32_t GetImsSwitchResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
56     int32_t GetImsSwitchResponse(int32_t slotId, int32_t active) override;
57     int32_t SetMuteResponse(int32_t slotId, const MuteControlResponse &response) override;
58 
59     /****************** supplement ******************/
60     int32_t SetClipResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
61     int32_t GetClipResponse(int32_t slotId, const GetClipResult &result) override;
62     int32_t GetClirResponse(int32_t slotId, const GetClirResult &result) override;
63     int32_t SetClirResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
64     int32_t GetCallTransferResponse(int32_t slotId, const CallForwardQueryInfoList &cFQueryList) override;
65     int32_t SetCallTransferResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
66     int32_t GetCallRestrictionResponse(int32_t slotId, const CallRestrictionResult &result) override;
67     int32_t SetCallRestrictionResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
68     int32_t GetCallWaitingResponse(int32_t slotId, const CallWaitResult &result) override;
69     int32_t SetCallWaitingResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
70     int32_t SetColrResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
71     int32_t GetColrResponse(int32_t slotId, const GetColrResult &result) override;
72     int32_t SetColpResponse(int32_t slotId, const SsBaseResult &resultInfo) override;
73     int32_t GetColpResponse(int32_t slotId, const GetColpResult &result) override;
74 
75     /****************** conference ******************/
76     int32_t CombineConferenceResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
77     int32_t InviteToConferenceResponse(int32_t slotId, const HRilRadioResponseInfo &info) override;
78     /****************** call modify ******************/
79     int32_t ReceiveUpdateCallMediaModeResponse(
80         int32_t slotId, const ImsCallModeReceiveInfo &callModeResponse) override;
81     int32_t ReceiveUpdateCallMediaModeRequest(int32_t slotId, const ImsCallModeReceiveInfo &callModeRequest) override;
82     int32_t CallSessionEventChanged(int32_t slotId, const ImsCallSessionEventInfo &callSessionEventInfo) override;
83     int32_t PeerDimensionsChanged(int32_t slotId, const ImsCallPeerDimensionsInfo &callPeerDimensionsInfo) override;
84     int32_t CallDataUsageChanged(int32_t slotId, const ImsCallDataUsageInfo &callDataUsageInfo) override;
85     int32_t CameraCapabilitiesChanged(int32_t slotId, const CameraCapabilitiesInfo &cameraCapabilitiesInfo) override;
86 
87 private:
88     void InitFuncMap();
89     void InitCallBasicFuncMap();
90     void InitConfigFuncMap();
91     void InitSupplementFuncMap();
92 
93     /****************** call basic ******************/
94     int32_t OnDialResponseInner(MessageParcel &data, MessageParcel &reply);
95     int32_t OnHangUpResponseInner(MessageParcel &data, MessageParcel &reply);
96     int32_t OnRejectResponseInner(MessageParcel &data, MessageParcel &reply);
97     int32_t OnAnswerResponseInner(MessageParcel &data, MessageParcel &reply);
98     int32_t OnHoldCallResponseInner(MessageParcel &data, MessageParcel &reply);
99     int32_t OnUnHoldCallResponseInner(MessageParcel &data, MessageParcel &reply);
100     int32_t OnSwitchCallResponseInner(MessageParcel &data, MessageParcel &reply);
101     int32_t OnCallStateChangeReportInner(MessageParcel &data, MessageParcel &reply);
102     int32_t OnGetImsCallsDataResponseInner(MessageParcel &data, MessageParcel &reply);
103     int32_t OnCallRingBackReportInner(MessageParcel &data, MessageParcel &reply);
104     int32_t OnLastCallFailReasonResponseInner(MessageParcel &data, MessageParcel &reply);
105 
106     /****************** dtmf rtt ******************/
107     int32_t OnStartDtmfResponseInner(MessageParcel &data, MessageParcel &reply);
108     int32_t OnSendDtmfResponseInner(MessageParcel &data, MessageParcel &reply);
109     int32_t OnStopDtmfResponseInner(MessageParcel &data, MessageParcel &reply);
110 
111     /****************** ims config ******************/
112     int32_t OnSetImsSwitchResponseInner(MessageParcel &data, MessageParcel &reply);
113     int32_t OnGetImsSwitchResponseInner(MessageParcel &data, MessageParcel &reply);
114     int32_t OnSetMuteResponseInner(MessageParcel &data, MessageParcel &reply);
115 
116     /****************** supplement ******************/
117     int32_t OnSetClipResponseInner(MessageParcel &data, MessageParcel &reply);
118     int32_t OnGetClipResponseInner(MessageParcel &data, MessageParcel &reply);
119     int32_t OnGetClirResponseInner(MessageParcel &data, MessageParcel &reply);
120     int32_t OnSetClirResponseInner(MessageParcel &data, MessageParcel &reply);
121     int32_t OnGetCallTransferResponseInner(MessageParcel &data, MessageParcel &reply);
122     int32_t OnSetCallTransferResponseInner(MessageParcel &data, MessageParcel &reply);
123     int32_t OnGetCallRestrictionResponseInner(MessageParcel &data, MessageParcel &reply);
124     int32_t OnSetCallRestrictionResponseInner(MessageParcel &data, MessageParcel &reply);
125     int32_t OnGetCallWaitingResponseInner(MessageParcel &data, MessageParcel &reply);
126     int32_t OnSetCallWaitingResponseInner(MessageParcel &data, MessageParcel &reply);
127     int32_t OnSetColrResponseInner(MessageParcel &data, MessageParcel &reply);
128     int32_t OnGetColrResponseInner(MessageParcel &data, MessageParcel &reply);
129     int32_t OnSetColpResponseInner(MessageParcel &data, MessageParcel &reply);
130     int32_t OnGetColpResponseInner(MessageParcel &data, MessageParcel &reply);
131     int32_t GetSsRequestCommand(int32_t slotId, int32_t index, SsRequestCommand &ss);
132     void BuildCallForwardInfo(const CallForwardQueryInfoList &cFQueryList, CallForwardQueryInfoList &cFQueryResultList);
133 
134     /****************** conference ******************/
135     int32_t OnCombineConferenceResponseInner(MessageParcel &data, MessageParcel &reply);
136     int32_t OnInviteToConferenceResponseInner(MessageParcel &data, MessageParcel &reply);
137 
138     /****************** call modify ******************/
139     int32_t OnReceiveUpdateCallMediaModeRequestInner(MessageParcel &data, MessageParcel &reply);
140     int32_t OnReceiveUpdateCallMediaModeResponseInner(MessageParcel &data, MessageParcel &reply);
141     int32_t OnCallSessionEventChangedInner(MessageParcel &data, MessageParcel &reply);
142     int32_t OnPeerDimensionsChangedInner(MessageParcel &data, MessageParcel &reply);
143     int32_t OnCallDataUsageChangedInner(MessageParcel &data, MessageParcel &reply);
144     int32_t OnCameraCapabilitiesChangedInner(MessageParcel &data, MessageParcel &reply);
145 
146     int32_t SendEvent(int32_t slotId, int32_t eventId, const HRilRadioResponseInfo &info);
147     int32_t SendEvent(int32_t slotId, int32_t eventId, const SsBaseResult &resultInfo);
148     int32_t SendEvent(int32_t slotId, int32_t eventId, const ImsCallModeReceiveInfo &callModeInfo);
149 
150 private:
151     using RequestFuncType = int32_t (ImsCallCallbackStub::*)(MessageParcel &data, MessageParcel &reply);
152     std::map<uint32_t, RequestFuncType> requestFuncMap_;
153 };
154 } // namespace Telephony
155 } // namespace OHOS
156 
157 #endif // TELEPHONY_IMS_CALL_CALLBACK_STUB_H
158