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