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