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 "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(static_cast<int32_t>(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(static_cast<int32_t>(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.WriteInt32(static_cast<int32_t>(details.reason))) {
88 TELEPHONY_LOGE("write reason fail");
89 return TELEPHONY_ERR_WRITE_DATA_FAIL;
90 }
91 if (!dataParcel.WriteString(details.message)) {
92 TELEPHONY_LOGE("write message fail");
93 return TELEPHONY_ERR_WRITE_DATA_FAIL;
94 }
95 if (Remote() == nullptr) {
96 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
97 }
98 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_DISCONNECTED_CAUSE), dataParcel, replyParcel, option);
99 if (error != TELEPHONY_SUCCESS) {
100 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
101 }
102 return replyParcel.ReadInt32();
103 }
104
UpdateEventResultInfo(const CellularCallEventInfo & info)105 int32_t CallStatusCallbackProxy::UpdateEventResultInfo(const CellularCallEventInfo &info)
106 {
107 MessageParcel dataParcel;
108 MessageParcel replyParcel;
109 MessageOption option;
110 int32_t error = TELEPHONY_ERR_FAIL;
111 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
112 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
113 }
114 int32_t length = sizeof(CellularCallEventInfo);
115 dataParcel.WriteInt32(length);
116 dataParcel.WriteRawData((const void *)&info, length);
117 if (Remote() == nullptr) {
118 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
119 }
120 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_EVENT_RESULT_INFO), dataParcel, replyParcel, option);
121 if (error != TELEPHONY_SUCCESS) {
122 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
123 }
124 return replyParcel.ReadInt32();
125 }
126
UpdateRBTPlayInfo(const RBTPlayInfo info)127 int32_t CallStatusCallbackProxy::UpdateRBTPlayInfo(const RBTPlayInfo info)
128 {
129 MessageParcel dataParcel;
130 MessageParcel replyParcel;
131 MessageOption option;
132 int32_t error = TELEPHONY_ERR_FAIL;
133 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
134 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
135 }
136 dataParcel.WriteInt32((int32_t)info);
137 if (Remote() == nullptr) {
138 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
139 }
140 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_RBT_PLAY_INFO), dataParcel, replyParcel, option);
141 if (error != TELEPHONY_SUCCESS) {
142 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
143 }
144 return replyParcel.ReadInt32();
145 }
146
UpdateGetWaitingResult(const CallWaitResponse & callWaitResponse)147 int32_t CallStatusCallbackProxy::UpdateGetWaitingResult(const CallWaitResponse &callWaitResponse)
148 {
149 MessageParcel dataParcel;
150 MessageParcel replyParcel;
151 MessageOption option;
152 int32_t error = TELEPHONY_ERR_FAIL;
153 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
154 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
155 }
156 int32_t length = sizeof(CallWaitResponse);
157 dataParcel.WriteInt32(length);
158 dataParcel.WriteRawData((const void *)&callWaitResponse, length);
159 if (Remote() == nullptr) {
160 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
161 }
162 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_WAITING), dataParcel, replyParcel, option);
163 if (error != TELEPHONY_SUCCESS) {
164 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
165 }
166 return replyParcel.ReadInt32();
167 }
168
UpdateSetWaitingResult(const int32_t result)169 int32_t CallStatusCallbackProxy::UpdateSetWaitingResult(const int32_t result)
170 {
171 MessageParcel dataParcel;
172 MessageParcel replyParcel;
173 MessageOption option;
174 int32_t error = TELEPHONY_ERR_FAIL;
175 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
176 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
177 }
178 dataParcel.WriteInt32(result);
179 if (Remote() == nullptr) {
180 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
181 }
182 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_WAITING), dataParcel, replyParcel, option);
183 if (error != TELEPHONY_SUCCESS) {
184 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
185 }
186 return replyParcel.ReadInt32();
187 }
188
UpdateGetRestrictionResult(const CallRestrictionResponse & callRestrictionResult)189 int32_t CallStatusCallbackProxy::UpdateGetRestrictionResult(const CallRestrictionResponse &callRestrictionResult)
190 {
191 MessageParcel dataParcel;
192 MessageParcel replyParcel;
193 MessageOption option;
194 int32_t error = TELEPHONY_ERR_FAIL;
195 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
196 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
197 }
198 int32_t length = sizeof(CallRestrictionResponse);
199 dataParcel.WriteInt32(length);
200 dataParcel.WriteRawData((const void *)&callRestrictionResult, length);
201 if (Remote() == nullptr) {
202 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
203 }
204 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_RESTRICTION), dataParcel, replyParcel, option);
205 if (error != TELEPHONY_SUCCESS) {
206 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
207 }
208 return replyParcel.ReadInt32();
209 }
210
UpdateSetRestrictionResult(const int32_t result)211 int32_t CallStatusCallbackProxy::UpdateSetRestrictionResult(const int32_t result)
212 {
213 MessageParcel dataParcel;
214 MessageParcel replyParcel;
215 MessageOption option;
216 int32_t error = TELEPHONY_ERR_FAIL;
217 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
218 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
219 }
220 dataParcel.WriteInt32(result);
221 if (Remote() == nullptr) {
222 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
223 }
224 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_RESTRICTION), dataParcel, replyParcel, option);
225 if (error != TELEPHONY_SUCCESS) {
226 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
227 }
228 return replyParcel.ReadInt32();
229 }
230
UpdateSetRestrictionPasswordResult(const int32_t result)231 int32_t CallStatusCallbackProxy::UpdateSetRestrictionPasswordResult(const int32_t result)
232 {
233 MessageParcel dataParcel;
234 MessageParcel replyParcel;
235 MessageOption option;
236 int32_t error = TELEPHONY_ERR_FAIL;
237 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
238 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
239 }
240 dataParcel.WriteInt32(result);
241 if (Remote() == nullptr) {
242 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
243 }
244 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_RESTRICTION_PWD), dataParcel, replyParcel, option);
245 if (error != TELEPHONY_SUCCESS) {
246 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
247 }
248 return replyParcel.ReadInt32();
249 }
250
UpdateGetTransferResult(const CallTransferResponse & callTransferResponse)251 int32_t CallStatusCallbackProxy::UpdateGetTransferResult(const CallTransferResponse &callTransferResponse)
252 {
253 MessageParcel dataParcel;
254 MessageParcel replyParcel;
255 MessageOption option;
256 int32_t error = TELEPHONY_ERR_FAIL;
257 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
258 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
259 }
260 int32_t length = sizeof(CallTransferResponse);
261 dataParcel.WriteInt32(length);
262 dataParcel.WriteRawData((const void *)&callTransferResponse, length);
263 if (Remote() == nullptr) {
264 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
265 }
266 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_TRANSFER), dataParcel, replyParcel, option);
267 if (error != TELEPHONY_SUCCESS) {
268 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
269 }
270 return replyParcel.ReadInt32();
271 }
272
UpdateSetTransferResult(const int32_t result)273 int32_t CallStatusCallbackProxy::UpdateSetTransferResult(const int32_t result)
274 {
275 MessageParcel dataParcel;
276 MessageParcel replyParcel;
277 MessageOption option;
278 int32_t error = TELEPHONY_ERR_FAIL;
279 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
280 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
281 }
282 dataParcel.WriteInt32(result);
283 if (Remote() == nullptr) {
284 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
285 }
286 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_TRANSFER), dataParcel, replyParcel, option);
287 if (error != TELEPHONY_SUCCESS) {
288 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
289 }
290 return replyParcel.ReadInt32();
291 }
292
UpdateGetCallClipResult(const ClipResponse & clipResponse)293 int32_t CallStatusCallbackProxy::UpdateGetCallClipResult(const ClipResponse &clipResponse)
294 {
295 MessageParcel dataParcel;
296 MessageParcel replyParcel;
297 MessageOption option;
298 int32_t error = TELEPHONY_ERR_FAIL;
299 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
300 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
301 }
302 int32_t length = sizeof(ClipResponse);
303 dataParcel.WriteInt32(length);
304 dataParcel.WriteRawData((const void *)&clipResponse, length);
305 if (Remote() == nullptr) {
306 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
307 }
308 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_CALL_CLIP), dataParcel, replyParcel, option);
309 if (error != TELEPHONY_SUCCESS) {
310 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
311 }
312 return replyParcel.ReadInt32();
313 }
314
UpdateGetCallClirResult(const ClirResponse & clirResponse)315 int32_t CallStatusCallbackProxy::UpdateGetCallClirResult(const ClirResponse &clirResponse)
316 {
317 MessageParcel dataParcel;
318 MessageParcel replyParcel;
319 MessageOption option;
320 int32_t error = TELEPHONY_ERR_FAIL;
321 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
322 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
323 }
324 int32_t length = sizeof(ClirResponse);
325 dataParcel.WriteInt32(length);
326 dataParcel.WriteRawData((const void *)&clirResponse, length);
327 if (Remote() == nullptr) {
328 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
329 }
330 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_GET_CALL_CLIR), dataParcel, replyParcel, option);
331 if (error != TELEPHONY_SUCCESS) {
332 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
333 }
334 return replyParcel.ReadInt32();
335 }
336
UpdateSetCallClirResult(const int32_t result)337 int32_t CallStatusCallbackProxy::UpdateSetCallClirResult(const int32_t result)
338 {
339 MessageParcel dataParcel;
340 MessageParcel replyParcel;
341 MessageOption option;
342 int32_t error = TELEPHONY_ERR_FAIL;
343 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
344 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
345 }
346 dataParcel.WriteInt32(result);
347 if (Remote() == nullptr) {
348 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
349 }
350 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_SET_CALL_CLIR), dataParcel, replyParcel, option);
351 if (error != TELEPHONY_SUCCESS) {
352 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
353 }
354 return replyParcel.ReadInt32();
355 }
356
StartRttResult(const int32_t result)357 int32_t CallStatusCallbackProxy::StartRttResult(const int32_t result)
358 {
359 MessageParcel dataParcel;
360 MessageParcel replyParcel;
361 MessageOption option;
362 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
363 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
364 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
365 }
366 dataParcel.WriteInt32(result);
367 if (Remote() == nullptr) {
368 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
369 }
370 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_STARTRTT_STATUS), dataParcel, replyParcel, option);
371 if (error != TELEPHONY_SUCCESS) {
372 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
373 }
374 return replyParcel.ReadInt32();
375 }
376
StopRttResult(const int32_t result)377 int32_t CallStatusCallbackProxy::StopRttResult(const int32_t result)
378 {
379 MessageParcel dataParcel;
380 MessageParcel replyParcel;
381 MessageOption option;
382 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
383 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
384 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
385 }
386 dataParcel.WriteInt32(result);
387 if (Remote() == nullptr) {
388 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
389 }
390 error = Remote()->SendRequest(static_cast<int32_t>(UPDATE_STOPRTT_STATUS), dataParcel, replyParcel, option);
391 if (error != TELEPHONY_SUCCESS) {
392 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
393 }
394 return replyParcel.ReadInt32();
395 }
396
GetImsConfigResult(const GetImsConfigResponse & response)397 int32_t CallStatusCallbackProxy::GetImsConfigResult(const GetImsConfigResponse &response)
398 {
399 MessageParcel dataParcel;
400 MessageParcel replyParcel;
401 MessageOption option;
402 int32_t error = TELEPHONY_ERR_FAIL;
403 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
404 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
405 }
406 int32_t length = sizeof(GetImsConfigResponse);
407 dataParcel.WriteInt32(length);
408 dataParcel.WriteRawData((const void *)&response, length);
409 if (Remote() == nullptr) {
410 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
411 }
412 error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_CONFIG), dataParcel, replyParcel, option);
413 if (error != TELEPHONY_SUCCESS) {
414 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
415 }
416 return replyParcel.ReadInt32();
417 }
418
SetImsConfigResult(const int32_t result)419 int32_t CallStatusCallbackProxy::SetImsConfigResult(const int32_t result)
420 {
421 MessageParcel dataParcel;
422 MessageParcel replyParcel;
423 MessageOption option;
424 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
425 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
426 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
427 }
428 dataParcel.WriteInt32(result);
429 if (Remote() == nullptr) {
430 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
431 }
432 error = Remote()->SendRequest(static_cast<int32_t>(SET_IMS_CONFIG), dataParcel, replyParcel, option);
433 if (error != TELEPHONY_SUCCESS) {
434 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
435 }
436 return replyParcel.ReadInt32();
437 }
438
GetImsFeatureValueResult(const GetImsFeatureValueResponse & response)439 int32_t CallStatusCallbackProxy::GetImsFeatureValueResult(const GetImsFeatureValueResponse &response)
440 {
441 MessageParcel dataParcel;
442 MessageParcel replyParcel;
443 MessageOption option;
444 int32_t error = TELEPHONY_ERR_FAIL;
445 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
446 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
447 }
448 int32_t length = sizeof(GetImsFeatureValueResponse);
449 dataParcel.WriteInt32(length);
450 dataParcel.WriteRawData((const void *)&response, length);
451 if (Remote() == nullptr) {
452 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
453 }
454 error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_FEATURE_VALUE), dataParcel, replyParcel, option);
455 if (error != TELEPHONY_SUCCESS) {
456 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
457 }
458 return replyParcel.ReadInt32();
459 }
460
SetImsFeatureValueResult(const int32_t result)461 int32_t CallStatusCallbackProxy::SetImsFeatureValueResult(const int32_t result)
462 {
463 MessageParcel dataParcel;
464 MessageParcel replyParcel;
465 MessageOption option;
466 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
467 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
468 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
469 }
470 dataParcel.WriteInt32(result);
471 if (Remote() == nullptr) {
472 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
473 }
474 error = Remote()->SendRequest(static_cast<int32_t>(SET_IMS_FEATURE_VALUE), dataParcel, replyParcel, option);
475 if (error != TELEPHONY_SUCCESS) {
476 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
477 }
478 return replyParcel.ReadInt32();
479 }
480
ReceiveUpdateCallMediaModeResponse(const CallMediaModeResponse & response)481 int32_t CallStatusCallbackProxy::ReceiveUpdateCallMediaModeResponse(const CallMediaModeResponse &response)
482 {
483 MessageParcel dataParcel;
484 MessageParcel replyParcel;
485 MessageOption option;
486 int32_t error = TELEPHONY_ERR_FAIL;
487 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
488 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
489 }
490 int32_t length = sizeof(CallMediaModeResponse);
491 dataParcel.WriteInt32(length);
492 dataParcel.WriteRawData((const void *)&response, length);
493 if (Remote() == nullptr) {
494 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
495 }
496 error = Remote()->SendRequest(static_cast<int32_t>(RECEIVE_UPDATE_MEDIA_MODE_RESPONSE), dataParcel,
497 replyParcel, option);
498 if (error != TELEPHONY_SUCCESS) {
499 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
500 }
501 return replyParcel.ReadInt32();
502 }
503
InviteToConferenceResult(const int32_t result)504 int32_t CallStatusCallbackProxy::InviteToConferenceResult(const int32_t result)
505 {
506 MessageParcel dataParcel;
507 MessageParcel replyParcel;
508 MessageOption option;
509 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
510 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
511 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
512 }
513 dataParcel.WriteInt32(result);
514 if (Remote() == nullptr) {
515 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
516 }
517 error = Remote()->SendRequest(static_cast<int32_t>(INVITE_TO_CONFERENCE), dataParcel, replyParcel, option);
518 if (error != TELEPHONY_SUCCESS) {
519 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
520 }
521 return replyParcel.ReadInt32();
522 }
523
StartDtmfResult(const int32_t result)524 int32_t CallStatusCallbackProxy::StartDtmfResult(const int32_t result)
525 {
526 MessageParcel dataParcel;
527 MessageParcel replyParcel;
528 MessageOption option;
529 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
530 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
531 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
532 }
533 dataParcel.WriteInt32(result);
534 if (Remote() == nullptr) {
535 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
536 }
537 error = Remote()->SendRequest(static_cast<int32_t>(START_DTMF), dataParcel, replyParcel, option);
538 if (error != TELEPHONY_SUCCESS) {
539 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
540 }
541 return replyParcel.ReadInt32();
542 }
543
StopDtmfResult(const int32_t result)544 int32_t CallStatusCallbackProxy::StopDtmfResult(const int32_t result)
545 {
546 MessageParcel dataParcel;
547 MessageParcel replyParcel;
548 MessageOption option;
549 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
550 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
551 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
552 }
553 dataParcel.WriteInt32(result);
554 if (Remote() == nullptr) {
555 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
556 }
557 error = Remote()->SendRequest(static_cast<int32_t>(STOP_DTMF), dataParcel, replyParcel, option);
558 if (error != TELEPHONY_SUCCESS) {
559 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
560 }
561 return replyParcel.ReadInt32();
562 }
563
SendUssdResult(const int32_t result)564 int32_t CallStatusCallbackProxy::SendUssdResult(const int32_t result)
565 {
566 MessageParcel dataParcel;
567 MessageParcel replyParcel;
568 MessageOption option;
569 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
570 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
571 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
572 }
573 dataParcel.WriteInt32(result);
574 if (Remote() == nullptr) {
575 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
576 }
577 error = Remote()->SendRequest(static_cast<int32_t>(SEND_USSD), dataParcel, replyParcel, option);
578 if (error != TELEPHONY_SUCCESS) {
579 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
580 }
581 return replyParcel.ReadInt32();
582 }
583
SendMmiCodeResult(const MmiCodeInfo & info)584 int32_t CallStatusCallbackProxy::SendMmiCodeResult(const MmiCodeInfo &info)
585 {
586 MessageParcel dataParcel;
587 MessageParcel replyParcel;
588 MessageOption option;
589 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
590 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
591 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
592 }
593 int32_t length = sizeof(MmiCodeInfo);
594 dataParcel.WriteInt32(length);
595 dataParcel.WriteRawData((const void *)&info, length);
596 if (Remote() == nullptr) {
597 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
598 }
599 error = Remote()->SendRequest(static_cast<int32_t>(MMI_CODE_INFO_RESPONSE), dataParcel, replyParcel, option);
600 if (error != TELEPHONY_SUCCESS) {
601 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
602 }
603 return replyParcel.ReadInt32();
604 }
605
GetImsCallDataResult(const int32_t result)606 int32_t CallStatusCallbackProxy::GetImsCallDataResult(const int32_t result)
607 {
608 MessageParcel dataParcel;
609 MessageParcel replyParcel;
610 MessageOption option;
611 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
612 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
613 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
614 }
615 dataParcel.WriteInt32(result);
616 if (Remote() == nullptr) {
617 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
618 }
619 error = Remote()->SendRequest(static_cast<int32_t>(GET_IMS_CALL_DATA), dataParcel, replyParcel, option);
620 if (error != TELEPHONY_SUCCESS) {
621 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
622 }
623 return replyParcel.ReadInt32();
624 }
625
CloseUnFinishedUssdResult(const int32_t result)626 int32_t CallStatusCallbackProxy::CloseUnFinishedUssdResult(const int32_t result)
627 {
628 MessageParcel dataParcel;
629 MessageParcel replyParcel;
630 MessageOption option;
631 int32_t error = CALL_ERR_ILLEGAL_CALL_OPERATION;
632 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
633 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
634 }
635 dataParcel.WriteInt32(result);
636 if (Remote() == nullptr) {
637 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
638 }
639 error = Remote()->SendRequest(static_cast<int32_t>(CLOSE_UNFINISHED_USSD), dataParcel, replyParcel, option);
640 if (error != TELEPHONY_SUCCESS) {
641 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
642 }
643 return replyParcel.ReadInt32();
644 }
645
ReportPostDialChar(const std::string & c)646 int32_t CallStatusCallbackProxy::ReportPostDialChar(const std::string &c)
647 {
648 MessageParcel dataParcel;
649 MessageParcel replyParcel;
650 MessageOption option;
651 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
652 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
653 }
654 dataParcel.WriteString(c);
655 if (Remote() == nullptr) {
656 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
657 }
658 int32_t error = Remote()->SendRequest(POST_DIAL_CHAR, dataParcel, replyParcel, option);
659 if (error != TELEPHONY_SUCCESS) {
660 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
661 }
662 return replyParcel.ReadInt32();
663 }
664
ReportPostDialDelay(const std::string & str)665 int32_t CallStatusCallbackProxy::ReportPostDialDelay(const std::string &str)
666 {
667 MessageParcel dataParcel;
668 MessageParcel replyParcel;
669 MessageOption option;
670 if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
671 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
672 }
673 dataParcel.WriteString(str);
674 if (Remote() == nullptr) {
675 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
676 }
677 int32_t error = Remote()->SendRequest(POST_DIAL_DELAY, dataParcel, replyParcel, option);
678 if (error != TELEPHONY_SUCCESS) {
679 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
680 }
681 return replyParcel.ReadInt32();
682 }
683 } // namespace Telephony
684 } // namespace OHOS
685