1 /*
2 * Copyright (C) 2021-2022 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 "message_option.h"
19 #include "message_parcel.h"
20
21 #include "telephony_log_wrapper.h"
22 #include "call_manager_errors.h"
23
24 namespace OHOS {
25 namespace Telephony {
CallStatusCallbackProxy(const sptr<IRemoteObject> & impl)26 CallStatusCallbackProxy::CallStatusCallbackProxy(const sptr<IRemoteObject> &impl)
27 : IRemoteProxy<ICallStatusCallback>(impl)
28 {}
29
UpdateCallReportInfo(const CallReportInfo & info)30 int32_t CallStatusCallbackProxy::UpdateCallReportInfo(const CallReportInfo &info)
31 {
32 MessageParcel dataParcel;
33 MessageParcel replyParcel;
34 MessageOption option;
35 int32_t error = TELEPHONY_ERR_FAIL;
36 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
37 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
38 }
39 int32_t length = sizeof(CallReportInfo);
40 dataParcel.WriteInt32(length);
41 dataParcel.WriteRawData((const void *)&info, length);
42 if (Remote() == nullptr) {
43 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
44 }
45 error = Remote()->SendRequest(UPDATE_CALL_INFO, dataParcel, replyParcel, option);
46 if (error != TELEPHONY_SUCCESS) {
47 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
48 }
49 return replyParcel.ReadInt32();
50 }
51
UpdateCallsReportInfo(const CallsReportInfo & info)52 int32_t CallStatusCallbackProxy::UpdateCallsReportInfo(const CallsReportInfo &info)
53 {
54 MessageParcel dataParcel;
55 MessageParcel replyParcel;
56 MessageOption option;
57 int32_t length = sizeof(CallReportInfo);
58 int32_t error = TELEPHONY_ERR_FAIL;
59 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
60 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
61 }
62 dataParcel.WriteInt32(info.callVec.size());
63 for (auto &it : info.callVec) {
64 dataParcel.WriteInt32(length);
65 dataParcel.WriteRawData((const void *)&it, length);
66 }
67 dataParcel.WriteInt32(info.slotId);
68 if (Remote() == nullptr) {
69 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
70 }
71 error = Remote()->SendRequest(UPDATE_CALLS_INFO, dataParcel, replyParcel, option);
72 if (error != TELEPHONY_SUCCESS) {
73 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
74 }
75 return replyParcel.ReadInt32();
76 }
77
UpdateDisconnectedCause(const DisconnectedDetails & details)78 int32_t CallStatusCallbackProxy::UpdateDisconnectedCause(const DisconnectedDetails &details)
79 {
80 MessageParcel dataParcel;
81 MessageParcel replyParcel;
82 MessageOption option;
83 int32_t error = TELEPHONY_ERR_FAIL;
84 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
85 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
86 }
87 if (!dataParcel.WriteRawData((const void *)&details, sizeof(DisconnectedDetails))) {
88 return TELEPHONY_ERR_WRITE_DATA_FAIL;
89 }
90 if (Remote() == nullptr) {
91 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
92 }
93 error = Remote()->SendRequest(UPDATE_DISCONNECTED_CAUSE, dataParcel, replyParcel, option);
94 if (error != TELEPHONY_SUCCESS) {
95 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
96 }
97 return replyParcel.ReadInt32();
98 }
99
UpdateEventResultInfo(const CellularCallEventInfo & info)100 int32_t CallStatusCallbackProxy::UpdateEventResultInfo(const CellularCallEventInfo &info)
101 {
102 MessageParcel dataParcel;
103 MessageParcel replyParcel;
104 MessageOption option;
105 int32_t error = TELEPHONY_ERR_FAIL;
106 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
107 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
108 }
109 int32_t length = sizeof(CellularCallEventInfo);
110 dataParcel.WriteInt32(length);
111 dataParcel.WriteRawData((const void *)&info, length);
112 if (Remote() == nullptr) {
113 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
114 }
115 error = Remote()->SendRequest(UPDATE_EVENT_RESULT_INFO, dataParcel, replyParcel, option);
116 if (error != TELEPHONY_SUCCESS) {
117 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
118 }
119 return replyParcel.ReadInt32();
120 }
121
UpdateRBTPlayInfo(const RBTPlayInfo info)122 int32_t CallStatusCallbackProxy::UpdateRBTPlayInfo(const RBTPlayInfo info)
123 {
124 MessageParcel dataParcel;
125 MessageParcel replyParcel;
126 MessageOption option;
127 int32_t error = TELEPHONY_ERR_FAIL;
128 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
129 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
130 }
131 dataParcel.WriteInt32((int32_t)info);
132 if (Remote() == nullptr) {
133 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
134 }
135 error = Remote()->SendRequest(UPDATE_RBT_PLAY_INFO, dataParcel, replyParcel, option);
136 if (error != TELEPHONY_SUCCESS) {
137 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
138 }
139 return replyParcel.ReadInt32();
140 }
141
UpdateGetWaitingResult(const CallWaitResponse & callWaitResponse)142 int32_t CallStatusCallbackProxy::UpdateGetWaitingResult(const CallWaitResponse &callWaitResponse)
143 {
144 MessageParcel dataParcel;
145 MessageParcel replyParcel;
146 MessageOption option;
147 int32_t error = TELEPHONY_ERR_FAIL;
148 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
149 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
150 }
151 int32_t length = sizeof(CallWaitResponse);
152 dataParcel.WriteInt32(length);
153 dataParcel.WriteRawData((const void *)&callWaitResponse, length);
154 if (Remote() == nullptr) {
155 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
156 }
157 error = Remote()->SendRequest(UPDATE_GET_WAITING, dataParcel, replyParcel, option);
158 if (error != TELEPHONY_SUCCESS) {
159 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
160 }
161 return replyParcel.ReadInt32();
162 }
163
UpdateSetWaitingResult(const int32_t result)164 int32_t CallStatusCallbackProxy::UpdateSetWaitingResult(const int32_t result)
165 {
166 MessageParcel dataParcel;
167 MessageParcel replyParcel;
168 MessageOption option;
169 int32_t error = TELEPHONY_ERR_FAIL;
170 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
171 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
172 }
173 dataParcel.WriteInt32(result);
174 if (Remote() == nullptr) {
175 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
176 }
177 error = Remote()->SendRequest(UPDATE_SET_WAITING, dataParcel, replyParcel, option);
178 if (error != TELEPHONY_SUCCESS) {
179 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
180 }
181 return replyParcel.ReadInt32();
182 }
183
UpdateGetRestrictionResult(const CallRestrictionResponse & callRestrictionResult)184 int32_t CallStatusCallbackProxy::UpdateGetRestrictionResult(const CallRestrictionResponse &callRestrictionResult)
185 {
186 MessageParcel dataParcel;
187 MessageParcel replyParcel;
188 MessageOption option;
189 int32_t error = TELEPHONY_ERR_FAIL;
190 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
191 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
192 }
193 int32_t length = sizeof(CallRestrictionResponse);
194 dataParcel.WriteInt32(length);
195 dataParcel.WriteRawData((const void *)&callRestrictionResult, length);
196 if (Remote() == nullptr) {
197 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
198 }
199 error = Remote()->SendRequest(UPDATE_GET_RESTRICTION, dataParcel, replyParcel, option);
200 if (error != TELEPHONY_SUCCESS) {
201 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
202 }
203 return replyParcel.ReadInt32();
204 }
205
UpdateSetRestrictionResult(const int32_t result)206 int32_t CallStatusCallbackProxy::UpdateSetRestrictionResult(const int32_t result)
207 {
208 MessageParcel dataParcel;
209 MessageParcel replyParcel;
210 MessageOption option;
211 int32_t error = TELEPHONY_ERR_FAIL;
212 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
213 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
214 }
215 dataParcel.WriteInt32(result);
216 if (Remote() == nullptr) {
217 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
218 }
219 error = Remote()->SendRequest(UPDATE_SET_RESTRICTION, dataParcel, replyParcel, option);
220 if (error != TELEPHONY_SUCCESS) {
221 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
222 }
223 return replyParcel.ReadInt32();
224 }
225
UpdateGetTransferResult(const CallTransferResponse & callTransferResponse)226 int32_t CallStatusCallbackProxy::UpdateGetTransferResult(const CallTransferResponse &callTransferResponse)
227 {
228 MessageParcel dataParcel;
229 MessageParcel replyParcel;
230 MessageOption option;
231 int32_t error = TELEPHONY_ERR_FAIL;
232 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
233 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
234 }
235 int32_t length = sizeof(CallTransferResponse);
236 dataParcel.WriteInt32(length);
237 dataParcel.WriteRawData((const void *)&callTransferResponse, length);
238 if (Remote() == nullptr) {
239 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
240 }
241 error = Remote()->SendRequest(UPDATE_GET_TRANSFER, dataParcel, replyParcel, option);
242 if (error != TELEPHONY_SUCCESS) {
243 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
244 }
245 return replyParcel.ReadInt32();
246 }
247
UpdateSetTransferResult(const int32_t result)248 int32_t CallStatusCallbackProxy::UpdateSetTransferResult(const int32_t result)
249 {
250 MessageParcel dataParcel;
251 MessageParcel replyParcel;
252 MessageOption option;
253 int32_t error = TELEPHONY_ERR_FAIL;
254 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
255 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
256 }
257 dataParcel.WriteInt32(result);
258 if (Remote() == nullptr) {
259 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
260 }
261 error = Remote()->SendRequest(UPDATE_SET_TRANSFER, dataParcel, replyParcel, option);
262 if (error != TELEPHONY_SUCCESS) {
263 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
264 }
265 return replyParcel.ReadInt32();
266 }
267
UpdateGetCallClipResult(const ClipResponse & clipResponse)268 int32_t CallStatusCallbackProxy::UpdateGetCallClipResult(const ClipResponse &clipResponse)
269 {
270 MessageParcel dataParcel;
271 MessageParcel replyParcel;
272 MessageOption option;
273 int32_t error = TELEPHONY_ERR_FAIL;
274 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
275 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
276 }
277 int32_t length = sizeof(ClipResponse);
278 dataParcel.WriteInt32(length);
279 dataParcel.WriteRawData((const void *)&clipResponse, length);
280 if (Remote() == nullptr) {
281 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
282 }
283 error = Remote()->SendRequest(UPDATE_GET_CALL_CLIP, dataParcel, replyParcel, option);
284 if (error != TELEPHONY_SUCCESS) {
285 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
286 }
287 return replyParcel.ReadInt32();
288 }
289
UpdateGetCallClirResult(const ClirResponse & clirResponse)290 int32_t CallStatusCallbackProxy::UpdateGetCallClirResult(const ClirResponse &clirResponse)
291 {
292 MessageParcel dataParcel;
293 MessageParcel replyParcel;
294 MessageOption option;
295 int32_t error = TELEPHONY_ERR_FAIL;
296 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
297 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
298 }
299 int32_t length = sizeof(ClirResponse);
300 dataParcel.WriteInt32(length);
301 dataParcel.WriteRawData((const void *)&clirResponse, length);
302 if (Remote() == nullptr) {
303 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
304 }
305 error = Remote()->SendRequest(UPDATE_GET_CALL_CLIR, dataParcel, replyParcel, option);
306 if (error != TELEPHONY_SUCCESS) {
307 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
308 }
309 return replyParcel.ReadInt32();
310 }
311
UpdateSetCallClirResult(const int32_t result)312 int32_t CallStatusCallbackProxy::UpdateSetCallClirResult(const int32_t result)
313 {
314 MessageParcel dataParcel;
315 MessageParcel replyParcel;
316 MessageOption option;
317 int32_t error = TELEPHONY_ERR_FAIL;
318 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
319 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
320 }
321 dataParcel.WriteInt32(result);
322 if (Remote() == nullptr) {
323 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
324 }
325 error = Remote()->SendRequest(UPDATE_SET_CALL_CLIR, dataParcel, replyParcel, option);
326 if (error != TELEPHONY_SUCCESS) {
327 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
328 }
329 return replyParcel.ReadInt32();
330 }
331
StartRttResult(const int32_t result)332 int32_t CallStatusCallbackProxy::StartRttResult(const int32_t result)
333 {
334 MessageParcel dataParcel;
335 MessageParcel replyParcel;
336 MessageOption option;
337 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
338 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
339 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
340 }
341 dataParcel.WriteInt32(result);
342 if (Remote() == nullptr) {
343 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
344 }
345 error = Remote()->SendRequest(UPDATE_STARTRTT_STATUS, dataParcel, replyParcel, option);
346 if (error != TELEPHONY_SUCCESS) {
347 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
348 }
349 return replyParcel.ReadInt32();
350 }
351
StopRttResult(const int32_t result)352 int32_t CallStatusCallbackProxy::StopRttResult(const int32_t result)
353 {
354 MessageParcel dataParcel;
355 MessageParcel replyParcel;
356 MessageOption option;
357 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
358 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
359 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
360 }
361 dataParcel.WriteInt32(result);
362 if (Remote() == nullptr) {
363 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
364 }
365 error = Remote()->SendRequest(UPDATE_STOPRTT_STATUS, dataParcel, replyParcel, option);
366 if (error != TELEPHONY_SUCCESS) {
367 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
368 }
369 return replyParcel.ReadInt32();
370 }
371
GetImsConfigResult(const GetImsConfigResponse & response)372 int32_t CallStatusCallbackProxy::GetImsConfigResult(const GetImsConfigResponse &response)
373 {
374 MessageParcel dataParcel;
375 MessageParcel replyParcel;
376 MessageOption option;
377 int32_t error = TELEPHONY_ERR_FAIL;
378 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
379 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
380 }
381 int32_t length = sizeof(GetImsConfigResponse);
382 dataParcel.WriteInt32(length);
383 dataParcel.WriteRawData((const void *)&response, length);
384 if (Remote() == nullptr) {
385 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
386 }
387 error = Remote()->SendRequest(GET_IMS_CONFIG, dataParcel, replyParcel, option);
388 if (error != TELEPHONY_SUCCESS) {
389 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
390 }
391 return replyParcel.ReadInt32();
392 }
393
SetImsConfigResult(const int32_t result)394 int32_t CallStatusCallbackProxy::SetImsConfigResult(const int32_t result)
395 {
396 MessageParcel dataParcel;
397 MessageParcel replyParcel;
398 MessageOption option;
399 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
400 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
401 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
402 }
403 dataParcel.WriteInt32(result);
404 if (Remote() == nullptr) {
405 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
406 }
407 error = Remote()->SendRequest(SET_IMS_CONFIG, dataParcel, replyParcel, option);
408 if (error != TELEPHONY_SUCCESS) {
409 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
410 }
411 return replyParcel.ReadInt32();
412 }
413
GetImsFeatureValueResult(const GetImsFeatureValueResponse & response)414 int32_t CallStatusCallbackProxy::GetImsFeatureValueResult(const GetImsFeatureValueResponse &response)
415 {
416 MessageParcel dataParcel;
417 MessageParcel replyParcel;
418 MessageOption option;
419 int32_t error = TELEPHONY_ERR_FAIL;
420 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
421 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
422 }
423 int32_t length = sizeof(GetImsFeatureValueResponse);
424 dataParcel.WriteInt32(length);
425 dataParcel.WriteRawData((const void *)&response, length);
426 if (Remote() == nullptr) {
427 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
428 }
429 error = Remote()->SendRequest(GET_IMS_FEATURE_VALUE, dataParcel, replyParcel, option);
430 if (error != TELEPHONY_SUCCESS) {
431 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
432 }
433 return replyParcel.ReadInt32();
434 }
435
SetImsFeatureValueResult(const int32_t result)436 int32_t CallStatusCallbackProxy::SetImsFeatureValueResult(const int32_t result)
437 {
438 MessageParcel dataParcel;
439 MessageParcel replyParcel;
440 MessageOption option;
441 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
442 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
443 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
444 }
445 dataParcel.WriteInt32(result);
446 if (Remote() == nullptr) {
447 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
448 }
449 error = Remote()->SendRequest(SET_IMS_FEATURE_VALUE, dataParcel, replyParcel, option);
450 if (error != TELEPHONY_SUCCESS) {
451 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
452 }
453 return replyParcel.ReadInt32();
454 }
455
ReceiveUpdateCallMediaModeResponse(const CallMediaModeResponse & response)456 int32_t CallStatusCallbackProxy::ReceiveUpdateCallMediaModeResponse(const CallMediaModeResponse &response)
457 {
458 MessageParcel dataParcel;
459 MessageParcel replyParcel;
460 MessageOption option;
461 int32_t error = TELEPHONY_ERR_FAIL;
462 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
463 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
464 }
465 int32_t length = sizeof(CallMediaModeResponse);
466 dataParcel.WriteInt32(length);
467 dataParcel.WriteRawData((const void *)&response, length);
468 if (Remote() == nullptr) {
469 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
470 }
471 error = Remote()->SendRequest(RECEIVE_UPDATE_MEDIA_MODE_RESPONSE, dataParcel, replyParcel, option);
472 if (error != TELEPHONY_SUCCESS) {
473 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
474 }
475 return replyParcel.ReadInt32();
476 }
477
InviteToConferenceResult(const int32_t result)478 int32_t CallStatusCallbackProxy::InviteToConferenceResult(const int32_t result)
479 {
480 MessageParcel dataParcel;
481 MessageParcel replyParcel;
482 MessageOption option;
483 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
484 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
485 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
486 }
487 dataParcel.WriteInt32(result);
488 if (Remote() == nullptr) {
489 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
490 }
491 error = Remote()->SendRequest(INVITE_TO_CONFERENCE, dataParcel, replyParcel, option);
492 if (error != TELEPHONY_SUCCESS) {
493 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
494 }
495 return replyParcel.ReadInt32();
496 }
497
StartDtmfResult(const int32_t result)498 int32_t CallStatusCallbackProxy::StartDtmfResult(const int32_t result)
499 {
500 MessageParcel dataParcel;
501 MessageParcel replyParcel;
502 MessageOption option;
503 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
504 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
505 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
506 }
507 dataParcel.WriteInt32(result);
508 if (Remote() == nullptr) {
509 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
510 }
511 error = Remote()->SendRequest(START_DTMF, dataParcel, replyParcel, option);
512 if (error != TELEPHONY_SUCCESS) {
513 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
514 }
515 return replyParcel.ReadInt32();
516 }
517
StopDtmfResult(const int32_t result)518 int32_t CallStatusCallbackProxy::StopDtmfResult(const int32_t result)
519 {
520 MessageParcel dataParcel;
521 MessageParcel replyParcel;
522 MessageOption option;
523 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
524 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
525 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
526 }
527 dataParcel.WriteInt32(result);
528 if (Remote() == nullptr) {
529 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
530 }
531 error = Remote()->SendRequest(STOP_DTMF, dataParcel, replyParcel, option);
532 if (error != TELEPHONY_SUCCESS) {
533 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
534 }
535 return replyParcel.ReadInt32();
536 }
537
SendUssdResult(const int32_t result)538 int32_t CallStatusCallbackProxy::SendUssdResult(const int32_t result)
539 {
540 MessageParcel dataParcel;
541 MessageParcel replyParcel;
542 MessageOption option;
543 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
544 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
545 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
546 }
547 dataParcel.WriteInt32(result);
548 if (Remote() == nullptr) {
549 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
550 }
551 error = Remote()->SendRequest(SEND_USSD, dataParcel, replyParcel, option);
552 if (error != TELEPHONY_SUCCESS) {
553 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
554 }
555 return replyParcel.ReadInt32();
556 }
557
SendMmiCodeResult(const MmiCodeInfo & info)558 int32_t CallStatusCallbackProxy::SendMmiCodeResult(const MmiCodeInfo &info)
559 {
560 MessageParcel dataParcel;
561 MessageParcel replyParcel;
562 MessageOption option;
563 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
564 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
565 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
566 }
567 int32_t length = sizeof(MmiCodeInfo);
568 dataParcel.WriteInt32(length);
569 dataParcel.WriteRawData((const void *)&info, length);
570 if (Remote() == nullptr) {
571 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
572 }
573 error = Remote()->SendRequest(MMI_CODE_INFO_RESPONSE, dataParcel, replyParcel, option);
574 if (error != TELEPHONY_SUCCESS) {
575 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
576 }
577 return replyParcel.ReadInt32();
578 }
579
GetImsCallDataResult(const int32_t result)580 int32_t CallStatusCallbackProxy::GetImsCallDataResult(const int32_t result)
581 {
582 MessageParcel dataParcel;
583 MessageParcel replyParcel;
584 MessageOption option;
585 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
586 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
587 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
588 }
589 dataParcel.WriteInt32(result);
590 if (Remote() == nullptr) {
591 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
592 }
593 error = Remote()->SendRequest(GET_IMS_CALL_DATA, dataParcel, replyParcel, option);
594 if (error != TELEPHONY_SUCCESS) {
595 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
596 }
597 return replyParcel.ReadInt32();
598 }
599 } // namespace Telephony
600 } // namespace OHOS
601