• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 #include "call_status_callback_proxy.h"
17 
18 #include "call_manager_errors.h"
19 #include "message_option.h"
20 #include "message_parcel.h"
21 #include "telephony_log_wrapper.h"
22 
23 namespace OHOS {
24 namespace Telephony {
CallStatusCallbackProxy(const sptr<IRemoteObject> & impl)25 CallStatusCallbackProxy::CallStatusCallbackProxy(const sptr<IRemoteObject> &impl)
26     : IRemoteProxy<ICallStatusCallback>(impl)
27 {}
28 
UpdateCallReportInfo(const CallReportInfo & info)29 int32_t CallStatusCallbackProxy::UpdateCallReportInfo(const CallReportInfo &info)
30 {
31     MessageParcel dataParcel;
32     MessageParcel replyParcel;
33     MessageOption option;
34     int32_t error = TELEPHONY_ERR_FAIL;
35     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
36         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
37     }
38     dataParcel.WriteInt32(info.index);
39     dataParcel.WriteCString(info.accountNum);
40     dataParcel.WriteInt32(info.accountId);
41     dataParcel.WriteInt32(static_cast<int32_t>(info.callType));
42     dataParcel.WriteInt32(static_cast<int32_t>(info.callMode));
43     dataParcel.WriteInt32(static_cast<int32_t>(info.state));
44     dataParcel.WriteInt32(info.voiceDomain);
45     dataParcel.WriteInt32(info.mpty);
46     dataParcel.WriteInt32(info.crsType);
47     dataParcel.WriteInt32(info.originalCallType);
48     if (info.callType == CallType::TYPE_VOIP) {
49         dataParcel.WriteString(info.voipCallInfo.voipCallId);
50         dataParcel.WriteString(info.voipCallInfo.userName);
51         dataParcel.WriteString(info.voipCallInfo.abilityName);
52         dataParcel.WriteString(info.voipCallInfo.extensionId);
53         dataParcel.WriteString(info.voipCallInfo.voipBundleName);
54         dataParcel.WriteBool(info.voipCallInfo.showBannerForIncomingCall);
55         dataParcel.WriteBool(info.voipCallInfo.isConferenceCall);
56         dataParcel.WriteBool(info.voipCallInfo.isVoiceAnswerSupported);
57         dataParcel.WriteBool(info.voipCallInfo.hasMicPermission);
58         dataParcel.WriteBool(info.voipCallInfo.isCapsuleSticky);
59         dataParcel.WriteInt32(info.voipCallInfo.uid);
60         dataParcel.WriteUInt8Vector(info.voipCallInfo.userProfile);
61     }
62     if (Remote() == nullptr) {
63         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
64     }
65     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_CALL_INFO), dataParcel, replyParcel, option);
66     if (error != TELEPHONY_SUCCESS) {
67         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
68     }
69     return replyParcel.ReadInt32();
70 }
71 
UpdateCallsReportInfo(const CallsReportInfo & info)72 int32_t CallStatusCallbackProxy::UpdateCallsReportInfo(const CallsReportInfo &info)
73 {
74     MessageParcel dataParcel;
75     MessageParcel replyParcel;
76     MessageOption option;
77     int32_t error = TELEPHONY_ERR_FAIL;
78     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
79         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
80     }
81     dataParcel.WriteInt32(info.callVec.size());
82     for (auto &it : info.callVec) {
83         dataParcel.WriteInt32(it.index);
84         dataParcel.WriteCString(it.accountNum);
85         dataParcel.WriteInt32(it.accountId);
86         dataParcel.WriteInt32(static_cast<int32_t>(it.callType));
87         dataParcel.WriteInt32(static_cast<int32_t>(it.callMode));
88         dataParcel.WriteInt32(static_cast<int32_t>(it.state));
89         dataParcel.WriteInt32(it.voiceDomain);
90         dataParcel.WriteInt32(it.mpty);
91         dataParcel.WriteInt32(it.crsType);
92         dataParcel.WriteInt32(it.originalCallType);
93         if (it.callType == CallType::TYPE_VOIP) {
94             dataParcel.WriteString(it.voipCallInfo.voipCallId);
95             dataParcel.WriteString(it.voipCallInfo.userName);
96             dataParcel.WriteString(it.voipCallInfo.abilityName);
97             dataParcel.WriteString(it.voipCallInfo.extensionId);
98             dataParcel.WriteString(it.voipCallInfo.voipBundleName);
99             dataParcel.WriteBool(it.voipCallInfo.showBannerForIncomingCall);
100             dataParcel.WriteBool(it.voipCallInfo.isConferenceCall);
101             dataParcel.WriteBool(it.voipCallInfo.isVoiceAnswerSupported);
102             dataParcel.WriteBool(it.voipCallInfo.hasMicPermission);
103             dataParcel.WriteBool(it.voipCallInfo.isCapsuleSticky);
104             dataParcel.WriteInt32(it.voipCallInfo.uid);
105             dataParcel.WriteUInt8Vector(it.voipCallInfo.userProfile);
106         }
107         dataParcel.WriteString(it.name);
108         dataParcel.WriteInt32(it.namePresentation);
109         dataParcel.WriteInt32(it.newCallUseBox);
110         dataParcel.WriteInt32(static_cast<int32_t>(it.reason));
111         dataParcel.WriteString(it.message);
112     }
113     dataParcel.WriteInt32(info.slotId);
114     if (Remote() == nullptr) {
115         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
116     }
117     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_CALLS_INFO), dataParcel, replyParcel, option);
118     if (error != TELEPHONY_SUCCESS) {
119         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
120     }
121     return replyParcel.ReadInt32();
122 }
123 
UpdateDisconnectedCause(const DisconnectedDetails & details)124 int32_t CallStatusCallbackProxy::UpdateDisconnectedCause(const DisconnectedDetails &details)
125 {
126     MessageParcel dataParcel;
127     MessageParcel replyParcel;
128     MessageOption option;
129     int32_t error = TELEPHONY_ERR_FAIL;
130     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
131         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
132     }
133     if (!dataParcel.WriteInt32(static_cast<int32_t>(details.reason))) {
134         TELEPHONY_LOGE("write reason fail");
135         return TELEPHONY_ERR_WRITE_DATA_FAIL;
136     }
137     if (!dataParcel.WriteString(details.message)) {
138         TELEPHONY_LOGE("write message fail");
139         return TELEPHONY_ERR_WRITE_DATA_FAIL;
140     }
141     if (Remote() == nullptr) {
142         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
143     }
144     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_DISCONNECTED_CAUSE), dataParcel, replyParcel, option);
145     if (error != TELEPHONY_SUCCESS) {
146         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
147     }
148     return replyParcel.ReadInt32();
149 }
150 
UpdateEventResultInfo(const CellularCallEventInfo & info)151 int32_t CallStatusCallbackProxy::UpdateEventResultInfo(const CellularCallEventInfo &info)
152 {
153     MessageParcel dataParcel;
154     MessageParcel replyParcel;
155     MessageOption option;
156     int32_t error = TELEPHONY_ERR_FAIL;
157     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
158         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
159     }
160     int32_t length = sizeof(CellularCallEventInfo);
161     dataParcel.WriteInt32(length);
162     dataParcel.WriteRawData((const void *)&info, length);
163     if (Remote() == nullptr) {
164         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
165     }
166     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_EVENT_RESULT_INFO), dataParcel, replyParcel, option);
167     if (error != TELEPHONY_SUCCESS) {
168         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
169     }
170     return replyParcel.ReadInt32();
171 }
172 
UpdateRBTPlayInfo(const RBTPlayInfo info)173 int32_t CallStatusCallbackProxy::UpdateRBTPlayInfo(const RBTPlayInfo info)
174 {
175     MessageParcel dataParcel;
176     MessageParcel replyParcel;
177     MessageOption option;
178     int32_t error = TELEPHONY_ERR_FAIL;
179     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
180         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
181     }
182     dataParcel.WriteInt32((int32_t)info);
183     if (Remote() == nullptr) {
184         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
185     }
186     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_RBT_PLAY_INFO), dataParcel, replyParcel, option);
187     if (error != TELEPHONY_SUCCESS) {
188         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
189     }
190     return replyParcel.ReadInt32();
191 }
192 
UpdateGetWaitingResult(const CallWaitResponse & callWaitResponse)193 int32_t CallStatusCallbackProxy::UpdateGetWaitingResult(const CallWaitResponse &callWaitResponse)
194 {
195     MessageParcel dataParcel;
196     MessageParcel replyParcel;
197     MessageOption option;
198     int32_t error = TELEPHONY_ERR_FAIL;
199     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
200         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
201     }
202     int32_t length = sizeof(CallWaitResponse);
203     dataParcel.WriteInt32(length);
204     dataParcel.WriteRawData((const void *)&callWaitResponse, length);
205     if (Remote() == nullptr) {
206         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
207     }
208     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_WAITING), dataParcel, replyParcel, option);
209     if (error != TELEPHONY_SUCCESS) {
210         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
211     }
212     return replyParcel.ReadInt32();
213 }
214 
UpdateSetWaitingResult(const int32_t result)215 int32_t CallStatusCallbackProxy::UpdateSetWaitingResult(const int32_t result)
216 {
217     MessageParcel dataParcel;
218     MessageParcel replyParcel;
219     MessageOption option;
220     int32_t error = TELEPHONY_ERR_FAIL;
221     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
222         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
223     }
224     dataParcel.WriteInt32(result);
225     if (Remote() == nullptr) {
226         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
227     }
228     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_WAITING), dataParcel, replyParcel, option);
229     if (error != TELEPHONY_SUCCESS) {
230         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
231     }
232     return replyParcel.ReadInt32();
233 }
234 
UpdateGetRestrictionResult(const CallRestrictionResponse & callRestrictionResult)235 int32_t CallStatusCallbackProxy::UpdateGetRestrictionResult(const CallRestrictionResponse &callRestrictionResult)
236 {
237     MessageParcel dataParcel;
238     MessageParcel replyParcel;
239     MessageOption option;
240     int32_t error = TELEPHONY_ERR_FAIL;
241     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
242         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
243     }
244     int32_t length = sizeof(CallRestrictionResponse);
245     dataParcel.WriteInt32(length);
246     dataParcel.WriteRawData((const void *)&callRestrictionResult, length);
247     if (Remote() == nullptr) {
248         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
249     }
250     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_RESTRICTION), dataParcel, replyParcel, option);
251     if (error != TELEPHONY_SUCCESS) {
252         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
253     }
254     return replyParcel.ReadInt32();
255 }
256 
UpdateSetRestrictionResult(const int32_t result)257 int32_t CallStatusCallbackProxy::UpdateSetRestrictionResult(const int32_t result)
258 {
259     MessageParcel dataParcel;
260     MessageParcel replyParcel;
261     MessageOption option;
262     int32_t error = TELEPHONY_ERR_FAIL;
263     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
264         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
265     }
266     dataParcel.WriteInt32(result);
267     if (Remote() == nullptr) {
268         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
269     }
270     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_RESTRICTION), dataParcel, replyParcel, option);
271     if (error != TELEPHONY_SUCCESS) {
272         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
273     }
274     return replyParcel.ReadInt32();
275 }
276 
UpdateSetRestrictionPasswordResult(const int32_t result)277 int32_t CallStatusCallbackProxy::UpdateSetRestrictionPasswordResult(const int32_t result)
278 {
279     MessageParcel dataParcel;
280     MessageParcel replyParcel;
281     MessageOption option;
282     int32_t error = TELEPHONY_ERR_FAIL;
283     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
284         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
285     }
286     dataParcel.WriteInt32(result);
287     if (Remote() == nullptr) {
288         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
289     }
290     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_RESTRICTION_PWD), dataParcel, replyParcel, option);
291     if (error != TELEPHONY_SUCCESS) {
292         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
293     }
294     return replyParcel.ReadInt32();
295 }
296 
UpdateGetTransferResult(const CallTransferResponse & callTransferResponse)297 int32_t CallStatusCallbackProxy::UpdateGetTransferResult(const CallTransferResponse &callTransferResponse)
298 {
299     MessageParcel dataParcel;
300     MessageParcel replyParcel;
301     MessageOption option;
302     int32_t error = TELEPHONY_ERR_FAIL;
303     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
304         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
305     }
306     int32_t length = sizeof(CallTransferResponse);
307     dataParcel.WriteInt32(length);
308     dataParcel.WriteRawData((const void *)&callTransferResponse, length);
309     if (Remote() == nullptr) {
310         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
311     }
312     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_TRANSFER), dataParcel, replyParcel, option);
313     if (error != TELEPHONY_SUCCESS) {
314         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
315     }
316     return replyParcel.ReadInt32();
317 }
318 
UpdateSetTransferResult(const int32_t result)319 int32_t CallStatusCallbackProxy::UpdateSetTransferResult(const int32_t result)
320 {
321     MessageParcel dataParcel;
322     MessageParcel replyParcel;
323     MessageOption option;
324     int32_t error = TELEPHONY_ERR_FAIL;
325     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
326         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
327     }
328     dataParcel.WriteInt32(result);
329     if (Remote() == nullptr) {
330         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
331     }
332     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_TRANSFER), dataParcel, replyParcel, option);
333     if (error != TELEPHONY_SUCCESS) {
334         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
335     }
336     return replyParcel.ReadInt32();
337 }
338 
UpdateGetCallClipResult(const ClipResponse & clipResponse)339 int32_t CallStatusCallbackProxy::UpdateGetCallClipResult(const ClipResponse &clipResponse)
340 {
341     MessageParcel dataParcel;
342     MessageParcel replyParcel;
343     MessageOption option;
344     int32_t error = TELEPHONY_ERR_FAIL;
345     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
346         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
347     }
348     int32_t length = sizeof(ClipResponse);
349     dataParcel.WriteInt32(length);
350     dataParcel.WriteRawData((const void *)&clipResponse, length);
351     if (Remote() == nullptr) {
352         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
353     }
354     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_CALL_CLIP), dataParcel, replyParcel, option);
355     if (error != TELEPHONY_SUCCESS) {
356         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
357     }
358     return replyParcel.ReadInt32();
359 }
360 
UpdateGetCallClirResult(const ClirResponse & clirResponse)361 int32_t CallStatusCallbackProxy::UpdateGetCallClirResult(const ClirResponse &clirResponse)
362 {
363     MessageParcel dataParcel;
364     MessageParcel replyParcel;
365     MessageOption option;
366     int32_t error = TELEPHONY_ERR_FAIL;
367     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
368         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
369     }
370     int32_t length = sizeof(ClirResponse);
371     dataParcel.WriteInt32(length);
372     dataParcel.WriteRawData((const void *)&clirResponse, length);
373     if (Remote() == nullptr) {
374         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
375     }
376     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_CALL_CLIR), dataParcel, replyParcel, option);
377     if (error != TELEPHONY_SUCCESS) {
378         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
379     }
380     return replyParcel.ReadInt32();
381 }
382 
UpdateSetCallClirResult(const int32_t result)383 int32_t CallStatusCallbackProxy::UpdateSetCallClirResult(const int32_t result)
384 {
385     MessageParcel dataParcel;
386     MessageParcel replyParcel;
387     MessageOption option;
388     int32_t error = TELEPHONY_ERR_FAIL;
389     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
390         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
391     }
392     dataParcel.WriteInt32(result);
393     if (Remote() == nullptr) {
394         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
395     }
396     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_CALL_CLIR), dataParcel, replyParcel, option);
397     if (error != TELEPHONY_SUCCESS) {
398         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
399     }
400     return replyParcel.ReadInt32();
401 }
402 
StartRttResult(const int32_t result)403 int32_t CallStatusCallbackProxy::StartRttResult(const int32_t result)
404 {
405     MessageParcel dataParcel;
406     MessageParcel replyParcel;
407     MessageOption option;
408     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
409     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
410         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
411     }
412     dataParcel.WriteInt32(result);
413     if (Remote() == nullptr) {
414         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
415     }
416     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_STARTRTT_STATUS), dataParcel, replyParcel, option);
417     if (error != TELEPHONY_SUCCESS) {
418         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
419     }
420     return replyParcel.ReadInt32();
421 }
422 
StopRttResult(const int32_t result)423 int32_t CallStatusCallbackProxy::StopRttResult(const int32_t result)
424 {
425     MessageParcel dataParcel;
426     MessageParcel replyParcel;
427     MessageOption option;
428     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
429     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
430         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
431     }
432     dataParcel.WriteInt32(result);
433     if (Remote() == nullptr) {
434         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
435     }
436     error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_STOPRTT_STATUS), dataParcel, replyParcel, option);
437     if (error != TELEPHONY_SUCCESS) {
438         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
439     }
440     return replyParcel.ReadInt32();
441 }
442 
GetImsConfigResult(const GetImsConfigResponse & response)443 int32_t CallStatusCallbackProxy::GetImsConfigResult(const GetImsConfigResponse &response)
444 {
445     MessageParcel dataParcel;
446     MessageParcel replyParcel;
447     MessageOption option;
448     int32_t error = TELEPHONY_ERR_FAIL;
449     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
450         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
451     }
452     int32_t length = sizeof(GetImsConfigResponse);
453     dataParcel.WriteInt32(length);
454     dataParcel.WriteRawData((const void *)&response, length);
455     if (Remote() == nullptr) {
456         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
457     }
458     error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_CONFIG), dataParcel, replyParcel, option);
459     if (error != TELEPHONY_SUCCESS) {
460         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
461     }
462     return replyParcel.ReadInt32();
463 }
464 
SetImsConfigResult(const int32_t result)465 int32_t CallStatusCallbackProxy::SetImsConfigResult(const int32_t result)
466 {
467     MessageParcel dataParcel;
468     MessageParcel replyParcel;
469     MessageOption option;
470     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
471     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
472         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
473     }
474     dataParcel.WriteInt32(result);
475     if (Remote() == nullptr) {
476         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
477     }
478     error = Remote()->SendRequest(static_cast<int32_t>(SET_IMS_CONFIG), dataParcel, replyParcel, option);
479     if (error != TELEPHONY_SUCCESS) {
480         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
481     }
482     return replyParcel.ReadInt32();
483 }
484 
GetImsFeatureValueResult(const GetImsFeatureValueResponse & response)485 int32_t CallStatusCallbackProxy::GetImsFeatureValueResult(const GetImsFeatureValueResponse &response)
486 {
487     MessageParcel dataParcel;
488     MessageParcel replyParcel;
489     MessageOption option;
490     int32_t error = TELEPHONY_ERR_FAIL;
491     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
492         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
493     }
494     int32_t length = sizeof(GetImsFeatureValueResponse);
495     dataParcel.WriteInt32(length);
496     dataParcel.WriteRawData((const void *)&response, length);
497     if (Remote() == nullptr) {
498         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
499     }
500     error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_FEATURE_VALUE), dataParcel, replyParcel, option);
501     if (error != TELEPHONY_SUCCESS) {
502         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
503     }
504     return replyParcel.ReadInt32();
505 }
506 
SetImsFeatureValueResult(const int32_t result)507 int32_t CallStatusCallbackProxy::SetImsFeatureValueResult(const int32_t result)
508 {
509     MessageParcel dataParcel;
510     MessageParcel replyParcel;
511     MessageOption option;
512     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
513     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
514         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
515     }
516     dataParcel.WriteInt32(result);
517     if (Remote() == nullptr) {
518         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
519     }
520     error = Remote()->SendRequest(static_cast<int32_t>(SET_IMS_FEATURE_VALUE), dataParcel, replyParcel, option);
521     if (error != TELEPHONY_SUCCESS) {
522         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
523     }
524     return replyParcel.ReadInt32();
525 }
526 
ReceiveUpdateCallMediaModeRequest(const CallModeReportInfo & response)527 int32_t CallStatusCallbackProxy::ReceiveUpdateCallMediaModeRequest(const CallModeReportInfo &response)
528 {
529     MessageParcel dataParcel;
530     MessageParcel replyParcel;
531     MessageOption option;
532     int32_t error = TELEPHONY_ERR_FAIL;
533     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
534         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
535     }
536     int32_t length = sizeof(CallModeReportInfo);
537     dataParcel.WriteInt32(length);
538     dataParcel.WriteRawData((const void *)&response, length);
539     if (Remote() == nullptr) {
540         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
541     }
542     error = Remote()->SendRequest(static_cast<int32_t>(RECEIVE_UPDATE_MEDIA_MODE_REQUEST), dataParcel,
543         replyParcel, option);
544     if (error != TELEPHONY_SUCCESS) {
545         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
546     }
547     return replyParcel.ReadInt32();
548 }
549 
ReceiveUpdateCallMediaModeResponse(const CallModeReportInfo & response)550 int32_t CallStatusCallbackProxy::ReceiveUpdateCallMediaModeResponse(const CallModeReportInfo &response)
551 {
552     MessageParcel dataParcel;
553     MessageParcel replyParcel;
554     MessageOption option;
555     int32_t error = TELEPHONY_ERR_FAIL;
556     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
557         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
558     }
559     int32_t length = sizeof(CallModeReportInfo);
560     dataParcel.WriteInt32(length);
561     dataParcel.WriteRawData((const void *)&response, length);
562     if (Remote() == nullptr) {
563         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
564     }
565     error = Remote()->SendRequest(static_cast<int32_t>(RECEIVE_UPDATE_MEDIA_MODE_RESPONSE), dataParcel,
566         replyParcel, option);
567     if (error != TELEPHONY_SUCCESS) {
568         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
569     }
570     return replyParcel.ReadInt32();
571 }
572 
InviteToConferenceResult(const int32_t result)573 int32_t CallStatusCallbackProxy::InviteToConferenceResult(const int32_t result)
574 {
575     MessageParcel dataParcel;
576     MessageParcel replyParcel;
577     MessageOption option;
578     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
579     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
580         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
581     }
582     dataParcel.WriteInt32(result);
583     if (Remote() == nullptr) {
584         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
585     }
586     error = Remote()->SendRequest(static_cast<int32_t>(INVITE_TO_CONFERENCE), dataParcel, replyParcel, option);
587     if (error != TELEPHONY_SUCCESS) {
588         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
589     }
590     return replyParcel.ReadInt32();
591 }
592 
StartDtmfResult(const int32_t result)593 int32_t CallStatusCallbackProxy::StartDtmfResult(const int32_t result)
594 {
595     MessageParcel dataParcel;
596     MessageParcel replyParcel;
597     MessageOption option;
598     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
599     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
600         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
601     }
602     dataParcel.WriteInt32(result);
603     if (Remote() == nullptr) {
604         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
605     }
606     error = Remote()->SendRequest(static_cast<int32_t>(START_DTMF), dataParcel, replyParcel, option);
607     if (error != TELEPHONY_SUCCESS) {
608         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
609     }
610     return replyParcel.ReadInt32();
611 }
612 
StopDtmfResult(const int32_t result)613 int32_t CallStatusCallbackProxy::StopDtmfResult(const int32_t result)
614 {
615     MessageParcel dataParcel;
616     MessageParcel replyParcel;
617     MessageOption option;
618     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
619     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
620         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
621     }
622     dataParcel.WriteInt32(result);
623     if (Remote() == nullptr) {
624         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
625     }
626     error = Remote()->SendRequest(static_cast<int32_t>(STOP_DTMF), dataParcel, replyParcel, option);
627     if (error != TELEPHONY_SUCCESS) {
628         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
629     }
630     return replyParcel.ReadInt32();
631 }
632 
SendUssdResult(const int32_t result)633 int32_t CallStatusCallbackProxy::SendUssdResult(const int32_t result)
634 {
635     MessageParcel dataParcel;
636     MessageParcel replyParcel;
637     MessageOption option;
638     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
639     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
640         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
641     }
642     dataParcel.WriteInt32(result);
643     if (Remote() == nullptr) {
644         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
645     }
646     error = Remote()->SendRequest(static_cast<int32_t>(SEND_USSD), dataParcel, replyParcel, option);
647     if (error != TELEPHONY_SUCCESS) {
648         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
649     }
650     return replyParcel.ReadInt32();
651 }
652 
SendMmiCodeResult(const MmiCodeInfo & info)653 int32_t CallStatusCallbackProxy::SendMmiCodeResult(const MmiCodeInfo &info)
654 {
655     MessageParcel dataParcel;
656     MessageParcel replyParcel;
657     MessageOption option;
658     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
659     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
660         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
661     }
662     int32_t length = sizeof(MmiCodeInfo);
663     dataParcel.WriteInt32(length);
664     dataParcel.WriteRawData((const void *)&info, length);
665     if (Remote() == nullptr) {
666         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
667     }
668     error = Remote()->SendRequest(static_cast<int32_t>(MMI_CODE_INFO_RESPONSE), dataParcel, replyParcel, option);
669     if (error != TELEPHONY_SUCCESS) {
670         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
671     }
672     return replyParcel.ReadInt32();
673 }
674 
GetImsCallDataResult(const int32_t result)675 int32_t CallStatusCallbackProxy::GetImsCallDataResult(const int32_t result)
676 {
677     MessageParcel dataParcel;
678     MessageParcel replyParcel;
679     MessageOption option;
680     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
681     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
682         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
683     }
684     dataParcel.WriteInt32(result);
685     if (Remote() == nullptr) {
686         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
687     }
688     error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_CALL_DATA), dataParcel, replyParcel, option);
689     if (error != TELEPHONY_SUCCESS) {
690         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
691     }
692     return replyParcel.ReadInt32();
693 }
694 
CloseUnFinishedUssdResult(const int32_t result)695 int32_t CallStatusCallbackProxy::CloseUnFinishedUssdResult(const int32_t result)
696 {
697     MessageParcel dataParcel;
698     MessageParcel replyParcel;
699     MessageOption option;
700     int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
701     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
702         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
703     }
704     dataParcel.WriteInt32(result);
705     if (Remote() == nullptr) {
706         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
707     }
708     error = Remote()->SendRequest(static_cast<int32_t>(CLOSE_UNFINISHED_USSD), dataParcel, replyParcel, option);
709     if (error != TELEPHONY_SUCCESS) {
710         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
711     }
712     return replyParcel.ReadInt32();
713 }
714 
ReportPostDialChar(const std::string & c)715 int32_t CallStatusCallbackProxy::ReportPostDialChar(const std::string &c)
716 {
717     MessageParcel dataParcel;
718     MessageParcel replyParcel;
719     MessageOption option;
720     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
721         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
722     }
723     dataParcel.WriteString(c);
724     if (Remote() == nullptr) {
725         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
726     }
727     int32_t error = Remote()->SendRequest(POST_DIAL_CHAR, dataParcel, replyParcel, option);
728     if (error != TELEPHONY_SUCCESS) {
729         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
730     }
731     return replyParcel.ReadInt32();
732 }
733 
ReportPostDialDelay(const std::string & str)734 int32_t CallStatusCallbackProxy::ReportPostDialDelay(const std::string &str)
735 {
736     MessageParcel dataParcel;
737     MessageParcel replyParcel;
738     MessageOption option;
739     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
740         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
741     }
742     dataParcel.WriteString(str);
743     if (Remote() == nullptr) {
744         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
745     }
746     int32_t error = Remote()->SendRequest(POST_DIAL_DELAY, dataParcel, replyParcel, option);
747     if (error != TELEPHONY_SUCCESS) {
748         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
749     }
750     return replyParcel.ReadInt32();
751 }
752 
UpdateVoipEventInfo(const VoipCallEventInfo & info)753 int32_t CallStatusCallbackProxy::UpdateVoipEventInfo(const VoipCallEventInfo &info)
754 {
755     MessageParcel dataParcel;
756     MessageParcel replyParcel;
757     MessageOption option;
758     int32_t error = TELEPHONY_ERR_FAIL;
759     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
760         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
761     }
762     dataParcel.WriteString(info.voipCallId);
763     dataParcel.WriteString(info.bundleName);
764     dataParcel.WriteInt32(info.uid);
765     dataParcel.WriteInt32(static_cast<int32_t>(info.voipCallEvent));
766     dataParcel.WriteInt32(static_cast<int32_t>(info.errorReason));
767     if (Remote() == nullptr) {
768         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
769     }
770     error = Remote()->SendRequest(UPDATE_VOIP_EVENT_INFO, dataParcel, replyParcel, option);
771     if (error != TELEPHONY_SUCCESS) {
772         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
773     }
774     return replyParcel.ReadInt32();
775 }
776 
HandleCallSessionEventChanged(const CallSessionReportInfo & eventOptions)777 int32_t CallStatusCallbackProxy::HandleCallSessionEventChanged(const CallSessionReportInfo &eventOptions)
778 {
779     MessageParcel dataParcel;
780     MessageParcel replyParcel;
781     MessageOption option;
782     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
783         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
784     }
785     int32_t length = sizeof(CallSessionReportInfo);
786     dataParcel.WriteInt32(length);
787     dataParcel.WriteRawData((const void *)&eventOptions, length);
788     if (Remote() == nullptr) {
789         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
790     }
791     int32_t error = Remote()->SendRequest(CALL_SESSION_EVENT, dataParcel, replyParcel, option);
792     if (error != TELEPHONY_SUCCESS) {
793         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
794     }
795     return replyParcel.ReadInt32();
796 }
797 
HandlePeerDimensionsChanged(const PeerDimensionsReportInfo & dimensionsDetail)798 int32_t CallStatusCallbackProxy::HandlePeerDimensionsChanged(const PeerDimensionsReportInfo &dimensionsDetail)
799 {
800     MessageParcel dataParcel;
801     MessageParcel replyParcel;
802     MessageOption option;
803     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
804         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
805     }
806     int32_t length = sizeof(PeerDimensionsReportInfo);
807     dataParcel.WriteInt32(length);
808     dataParcel.WriteRawData((const void *)&dimensionsDetail, length);
809     if (Remote() == nullptr) {
810         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
811     }
812     int32_t error = Remote()->SendRequest(PEER_DIMENSION_CHANGE, dataParcel, replyParcel, option);
813     if (error != TELEPHONY_SUCCESS) {
814         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
815     }
816     return replyParcel.ReadInt32();
817 }
818 
HandleCallDataUsageChanged(const int64_t result)819 int32_t CallStatusCallbackProxy::HandleCallDataUsageChanged(const int64_t result)
820 {
821     MessageParcel dataParcel;
822     MessageParcel replyParcel;
823     MessageOption option;
824     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
825         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
826     }
827     dataParcel.WriteInt64(result);
828     if (Remote() == nullptr) {
829         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
830     }
831     int32_t error = Remote()->SendRequest(CALL_DATA_USAGE, dataParcel, replyParcel, option);
832     if (error != TELEPHONY_SUCCESS) {
833         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
834     }
835     return replyParcel.ReadInt32();
836 }
837 
HandleCameraCapabilitiesChanged(const CameraCapabilitiesReportInfo & cameraCapabilities)838 int32_t CallStatusCallbackProxy::HandleCameraCapabilitiesChanged(const CameraCapabilitiesReportInfo &cameraCapabilities)
839 {
840     MessageParcel dataParcel;
841     MessageParcel replyParcel;
842     MessageOption option;
843     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
844         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
845     }
846     int32_t length = sizeof(CameraCapabilitiesReportInfo);
847     dataParcel.WriteInt32(length);
848     dataParcel.WriteRawData((const void *)&cameraCapabilities, length);
849     if (Remote() == nullptr) {
850         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
851     }
852     int32_t error = Remote()->SendRequest(CAMERA_CAPBILITIES_CHANGE, dataParcel, replyParcel, option);
853     if (error != TELEPHONY_SUCCESS) {
854         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
855     }
856     return replyParcel.ReadInt32();
857 }
858 } // namespace Telephony
859 } // namespace OHOS
860