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