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