• 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 "hril_call_parcel.h"
17 #include "hril_modem_parcel.h"
18 
19 namespace OHOS {
20 namespace Telephony {
UnMarshalling(Parcel & parcel)21 std::shared_ptr<DialInfo> DialInfo::UnMarshalling(Parcel &parcel)
22 {
23     std::shared_ptr<DialInfo> param = std::make_shared<DialInfo>();
24     if (param == nullptr || !param->ReadFromParcel(parcel)) {
25         param = nullptr;
26     }
27     return param;
28 }
29 
ReadFromParcel(Parcel & parcel)30 bool DialInfo::ReadFromParcel(Parcel &parcel)
31 {
32     if (!Read(parcel, serial)) {
33         return false;
34     }
35     if (!Read(parcel, address)) {
36         return false;
37     }
38     if (!Read(parcel, clir)) {
39         return false;
40     }
41     return true;
42 }
43 
Marshalling(Parcel & parcel) const44 bool DialInfo::Marshalling(Parcel &parcel) const
45 {
46     if (!Write(parcel, serial)) {
47         return false;
48     }
49     if (!Write(parcel, address)) {
50         return false;
51     }
52     if (!Write(parcel, clir)) {
53         return false;
54     }
55     return true;
56 }
57 
ReadFromParcel(Parcel & parcel)58 bool CallInfo::ReadFromParcel(Parcel &parcel)
59 {
60     if (!Read(parcel, index)) {
61         return false;
62     }
63     if (!Read(parcel, dir)) {
64         return false;
65     }
66     if (!Read(parcel, state)) {
67         return false;
68     }
69     if (!Read(parcel, mode)) {
70         return false;
71     }
72     if (!Read(parcel, mpty)) {
73         return false;
74     }
75     if (!Read(parcel, voiceDomain)) {
76         return false;
77     }
78     if (!Read(parcel, callType)) {
79         return false;
80     }
81     if (!Read(parcel, number)) {
82         return false;
83     }
84     if (!Read(parcel, type)) {
85         return false;
86     }
87     if (!Read(parcel, alpha)) {
88         return false;
89     }
90     return true;
91 }
92 
Marshalling(Parcel & parcel) const93 bool CallInfo::Marshalling(Parcel &parcel) const
94 {
95     if (!Write(parcel, index)) {
96         return false;
97     }
98     if (!Write(parcel, dir)) {
99         return false;
100     }
101     if (!Write(parcel, state)) {
102         return false;
103     }
104     if (!Write(parcel, mode)) {
105         return false;
106     }
107     if (!Write(parcel, mpty)) {
108         return false;
109     }
110     if (!Write(parcel, voiceDomain)) {
111         return false;
112     }
113     if (!Write(parcel, callType)) {
114         return false;
115     }
116     if (!Write(parcel, number)) {
117         return false;
118     }
119     if (!Write(parcel, type)) {
120         return false;
121     }
122     if (!Write(parcel, alpha)) {
123         return false;
124     }
125     return true;
126 }
127 
UnMarshalling(Parcel & parcel)128 std::shared_ptr<CallInfo> CallInfo::UnMarshalling(Parcel &parcel)
129 {
130     std::shared_ptr<CallInfo> param = std::make_shared<CallInfo>();
131     if (param == nullptr || !param->ReadFromParcel(parcel)) {
132         param = nullptr;
133     }
134     return param;
135 }
136 
Dump(std::string,int32_t)137 void CallInfo::Dump(std::string, int32_t) {}
138 
ReadFromParcel(Parcel & parcel)139 bool CallInfoList::ReadFromParcel(Parcel &parcel)
140 {
141     if (!Read(parcel, callSize)) {
142         return false;
143     }
144     if (!Read(parcel, flag)) {
145         return false;
146     }
147     calls.resize(callSize);
148     for (int32_t i = 0; i < callSize; i++) {
149         calls[i].ReadFromParcel(parcel);
150     }
151     return true;
152 }
153 
Marshalling(Parcel & parcel) const154 bool CallInfoList::Marshalling(Parcel &parcel) const
155 {
156     if (!Write(parcel, callSize)) {
157         return false;
158     }
159     if (!Write(parcel, flag)) {
160         return false;
161     }
162     for (int32_t i = 0; i < callSize; i++) {
163         calls[i].Marshalling(parcel);
164     }
165     return true;
166 }
167 
UnMarshalling(Parcel & parcel)168 std::shared_ptr<CallInfoList> CallInfoList::UnMarshalling(Parcel &parcel)
169 {
170     std::shared_ptr<CallInfoList> param = std::make_shared<CallInfoList>();
171     if (param == nullptr || !param->ReadFromParcel(parcel)) {
172         return nullptr;
173     }
174     return param;
175 }
176 
Dump(std::string,int32_t)177 void CallInfoList::Dump(std::string, int32_t) {}
178 
ReadFromParcel(Parcel & parcel)179 bool EmergencyInfo::ReadFromParcel(Parcel &parcel)
180 {
181     if (!Read(parcel, index)) {
182         return false;
183     }
184     if (!Read(parcel, total)) {
185         return false;
186     }
187     if (!Read(parcel, eccNum)) {
188         return false;
189     }
190     if (!Read(parcel, category)) {
191         return false;
192     }
193     if (!Read(parcel, simpresent)) {
194         return false;
195     }
196     if (!Read(parcel, mcc)) {
197         return false;
198     }
199     if (!Read(parcel, abnormalService)) {
200         return false;
201     }
202     return true;
203 }
204 
Marshalling(Parcel & parcel) const205 bool EmergencyInfo::Marshalling(Parcel &parcel) const
206 {
207     if (!Write(parcel, index)) {
208         return false;
209     }
210     if (!Write(parcel, total)) {
211         return false;
212     }
213     if (!Write(parcel, eccNum)) {
214         return false;
215     }
216     if (!Write(parcel, category)) {
217         return false;
218     }
219     if (!Write(parcel, simpresent)) {
220         return false;
221     }
222     if (!Write(parcel, mcc)) {
223         return false;
224     }
225     if (!Write(parcel, abnormalService)) {
226         return false;
227     }
228     return true;
229 }
230 
UnMarshalling(Parcel & parcel)231 std::shared_ptr<EmergencyInfo> EmergencyInfo::UnMarshalling(Parcel &parcel)
232 {
233     std::shared_ptr<EmergencyInfo> param = std::make_shared<EmergencyInfo>();
234     if (param == nullptr || !param->ReadFromParcel(parcel)) {
235         param = nullptr;
236     }
237     return param;
238 }
239 
Dump(std::string,int32_t)240 void EmergencyInfo::Dump(std::string, int32_t) {}
241 
ReadFromParcel(Parcel & parcel)242 bool EmergencyInfoList::ReadFromParcel(Parcel &parcel)
243 {
244     if (!Read(parcel, callSize)) {
245         return false;
246     }
247     if (!Read(parcel, flag)) {
248         return false;
249     }
250     calls.resize(callSize);
251     for (int32_t i = 0; i < callSize; i++) {
252         calls[i].ReadFromParcel(parcel);
253     }
254     return true;
255 }
256 
Marshalling(Parcel & parcel) const257 bool EmergencyInfoList::Marshalling(Parcel &parcel) const
258 {
259     if (!Write(parcel, callSize)) {
260         return false;
261     }
262     if (!Write(parcel, flag)) {
263         return false;
264     }
265     for (int32_t i = 0; i < callSize; i++) {
266         calls[i].Marshalling(parcel);
267     }
268     return true;
269 }
270 
UnMarshalling(Parcel & parcel)271 std::shared_ptr<EmergencyInfoList> EmergencyInfoList::UnMarshalling(Parcel &parcel)
272 {
273     std::shared_ptr<EmergencyInfoList> param = std::make_shared<EmergencyInfoList>();
274     if (param == nullptr || !param->ReadFromParcel(parcel)) {
275         return nullptr;
276     }
277     return param;
278 }
279 
Dump(std::string,int32_t)280 void EmergencyInfoList::Dump(std::string, int32_t) {}
281 
ReadFromParcel(Parcel & parcel)282 bool UusData::ReadFromParcel(Parcel &parcel)
283 {
284     if (!Read(parcel, uusDcs)) {
285         return false;
286     }
287     return true;
288 }
289 
Marshalling(Parcel & parcel) const290 bool UusData::Marshalling(Parcel &parcel) const
291 {
292     if (!Write(parcel, uusDcs)) {
293         return false;
294     }
295     return true;
296 }
297 
UnMarshalling(Parcel & parcel)298 std::shared_ptr<UusData> UusData::UnMarshalling(Parcel &parcel)
299 {
300     std::shared_ptr<UusData> param = std::make_shared<UusData>();
301     if (param == nullptr || !param->ReadFromParcel(parcel)) {
302         param = nullptr;
303     }
304     return param;
305 }
306 
Dump(std::string,int32_t)307 void UusData::Dump(std::string, int32_t) {}
308 
ReadFromParcel(Parcel & parcel)309 bool CallForwardSetInfo::ReadFromParcel(Parcel &parcel)
310 {
311     if (!Read(parcel, serial)) {
312         return false;
313     }
314     if (!Read(parcel, reason)) {
315         return false;
316     }
317     if (!Read(parcel, mode)) {
318         return false;
319     }
320     if (!Read(parcel, number)) {
321         return false;
322     }
323     if (!Read(parcel, classx)) {
324         return false;
325     }
326     return true;
327 }
328 
Marshalling(Parcel & parcel) const329 bool CallForwardSetInfo::Marshalling(Parcel &parcel) const
330 {
331     if (!Write(parcel, serial)) {
332         return false;
333     }
334     if (!Write(parcel, reason)) {
335         return false;
336     }
337     if (!Write(parcel, mode)) {
338         return false;
339     }
340     if (!Write(parcel, number)) {
341         return false;
342     }
343     if (!Write(parcel, classx)) {
344         return false;
345     }
346     return true;
347 }
348 
UnMarshalling(Parcel & parcel)349 std::shared_ptr<CallForwardSetInfo> CallForwardSetInfo::UnMarshalling(Parcel &parcel)
350 {
351     std::shared_ptr<CallForwardSetInfo> param = std::make_shared<CallForwardSetInfo>();
352     if (param == nullptr || !param->ReadFromParcel(parcel)) {
353         param = nullptr;
354     }
355     return param;
356 }
357 
Dump(std::string,int32_t)358 void CallForwardSetInfo::Dump(std::string, int32_t) {}
359 
ReadFromParcel(Parcel & parcel)360 bool CallForwardQueryResult::ReadFromParcel(Parcel &parcel)
361 {
362     if (!Read(parcel, serial)) {
363         return false;
364     }
365     if (!Read(parcel, result)) {
366         return false;
367     }
368     if (!Read(parcel, status)) {
369         return false;
370     }
371     if (!Read(parcel, classx)) {
372         return false;
373     }
374     if (!Read(parcel, number)) {
375         return false;
376     }
377     if (!Read(parcel, type)) {
378         return false;
379     }
380     return true;
381 }
382 
Marshalling(Parcel & parcel) const383 bool CallForwardQueryResult::Marshalling(Parcel &parcel) const
384 {
385     if (!Write(parcel, serial)) {
386         return false;
387     }
388     if (!Write(parcel, result)) {
389         return false;
390     }
391     if (!Write(parcel, status)) {
392         return false;
393     }
394     if (!Write(parcel, classx)) {
395         return false;
396     }
397     if (!Write(parcel, number)) {
398         return false;
399     }
400     if (!Write(parcel, type)) {
401         return false;
402     }
403     return true;
404 }
405 
UnMarshalling(Parcel & parcel)406 std::shared_ptr<CallForwardQueryResult> CallForwardQueryResult::UnMarshalling(Parcel &parcel)
407 {
408     std::shared_ptr<CallForwardQueryResult> param = std::make_shared<CallForwardQueryResult>();
409     if (param == nullptr || !param->ReadFromParcel(parcel)) {
410         param = nullptr;
411     }
412     return param;
413 }
414 
Dump(std::string,int32_t)415 void CallForwardQueryResult::Dump(std::string, int32_t) {}
416 
ReadFromParcel(Parcel & parcel)417 bool GetClipResult::ReadFromParcel(Parcel &parcel)
418 {
419     if (!Read(parcel, result)) {
420         return false;
421     }
422     if (!Read(parcel, action)) {
423         return false;
424     }
425     if (!Read(parcel, clipStat)) {
426         return false;
427     }
428     return true;
429 }
430 
Marshalling(Parcel & parcel) const431 bool GetClipResult::Marshalling(Parcel &parcel) const
432 {
433     if (!Write(parcel, result)) {
434         return false;
435     }
436     if (!Write(parcel, action)) {
437         return false;
438     }
439     if (!Write(parcel, clipStat)) {
440         return false;
441     }
442     return true;
443 }
444 
UnMarshalling(Parcel & parcel)445 std::shared_ptr<GetClipResult> GetClipResult::UnMarshalling(Parcel &parcel)
446 {
447     std::shared_ptr<GetClipResult> param = std::make_shared<GetClipResult>();
448     if (param == nullptr || !param->ReadFromParcel(parcel)) {
449         param = nullptr;
450     }
451     return param;
452 }
453 
Dump(std::string,int32_t)454 void GetClipResult::Dump(std::string, int32_t) {}
455 
ReadFromParcel(Parcel & parcel)456 bool GetClirResult::ReadFromParcel(Parcel &parcel)
457 {
458     if (!Read(parcel, result)) {
459         return false;
460     }
461     if (!Read(parcel, action)) {
462         return false;
463     }
464     if (!Read(parcel, clirStat)) {
465         return false;
466     }
467     return true;
468 }
469 
Marshalling(Parcel & parcel) const470 bool GetClirResult::Marshalling(Parcel &parcel) const
471 {
472     if (!Write(parcel, result)) {
473         return false;
474     }
475     if (!Write(parcel, action)) {
476         return false;
477     }
478     if (!Write(parcel, clirStat)) {
479         return false;
480     }
481     return true;
482 }
483 
UnMarshalling(Parcel & parcel)484 std::shared_ptr<GetClirResult> GetClirResult::UnMarshalling(Parcel &parcel)
485 {
486     std::shared_ptr<GetClirResult> param = std::make_shared<GetClirResult>();
487     if (param == nullptr || !param->ReadFromParcel(parcel)) {
488         param = nullptr;
489     }
490     return param;
491 }
492 
Dump(std::string,int32_t)493 void GetClirResult::Dump(std::string, int32_t) {}
494 
ReadFromParcel(Parcel & parcel)495 bool CallWaitResult::ReadFromParcel(Parcel &parcel)
496 {
497     if (!Read(parcel, result)) {
498         return false;
499     }
500     if (!Read(parcel, status)) {
501         return false;
502     }
503     if (!Read(parcel, classCw)) {
504         return false;
505     }
506     return true;
507 }
508 
Marshalling(Parcel & parcel) const509 bool CallWaitResult::Marshalling(Parcel &parcel) const
510 {
511     if (!Write(parcel, result)) {
512         return false;
513     }
514     if (!Write(parcel, status)) {
515         return false;
516     }
517     if (!Write(parcel, classCw)) {
518         return false;
519     }
520     return true;
521 }
522 
UnMarshalling(Parcel & parcel)523 std::shared_ptr<CallWaitResult> CallWaitResult::UnMarshalling(Parcel &parcel)
524 {
525     std::shared_ptr<CallWaitResult> param = std::make_shared<CallWaitResult>();
526     if (param == nullptr || !param->ReadFromParcel(parcel)) {
527         param = nullptr;
528     }
529     return param;
530 }
531 
Dump(std::string,int32_t)532 void CallWaitResult::Dump(std::string, int32_t) {}
533 
ReadFromParcel(Parcel & parcel)534 bool CallRestrictionResult::ReadFromParcel(Parcel &parcel)
535 {
536     if (!Read(parcel, result)) {
537         return false;
538     }
539     if (!Read(parcel, status)) {
540         return false;
541     }
542     if (!Read(parcel, classCw)) {
543         return false;
544     }
545     return true;
546 }
547 
Marshalling(Parcel & parcel) const548 bool CallRestrictionResult::Marshalling(Parcel &parcel) const
549 {
550     if (!Write(parcel, result)) {
551         return false;
552     }
553     if (!Write(parcel, status)) {
554         return false;
555     }
556     if (!Write(parcel, classCw)) {
557         return false;
558     }
559     return true;
560 }
561 
UnMarshalling(Parcel & parcel)562 std::shared_ptr<CallRestrictionResult> CallRestrictionResult::UnMarshalling(Parcel &parcel)
563 {
564     std::shared_ptr<CallRestrictionResult> param = std::make_shared<CallRestrictionResult>();
565     if (param == nullptr || !param->ReadFromParcel(parcel)) {
566         param = nullptr;
567     }
568     return param;
569 }
570 
Dump(std::string,int32_t)571 void CallRestrictionResult::Dump(std::string, int32_t) {}
572 
ReadFromParcel(Parcel & parcel)573 bool CallImsServiceStatus::ReadFromParcel(Parcel &parcel)
574 {
575     if (!Read(parcel, smsSrvStatus)) {
576         return false;
577     }
578     if (!Read(parcel, smsSrvRat)) {
579         return false;
580     }
581     if (!Read(parcel, voipSrvStatus)) {
582         return false;
583     }
584     if (!Read(parcel, voipSrvRat)) {
585         return false;
586     }
587     if (!Read(parcel, vtSrvStatus)) {
588         return false;
589     }
590     if (!Read(parcel, vtSrvRat)) {
591         return false;
592     }
593     if (!Read(parcel, vsSrvStatus)) {
594         return false;
595     }
596     if (!Read(parcel, vsSrvRat)) {
597         return false;
598     }
599     return true;
600 }
601 
Marshalling(Parcel & parcel) const602 bool CallImsServiceStatus::Marshalling(Parcel &parcel) const
603 {
604     if (!Write(parcel, smsSrvStatus)) {
605         return false;
606     }
607     if (!Write(parcel, smsSrvRat)) {
608         return false;
609     }
610     if (!Write(parcel, voipSrvStatus)) {
611         return false;
612     }
613     if (!Write(parcel, voipSrvRat)) {
614         return false;
615     }
616     if (!Write(parcel, vtSrvStatus)) {
617         return false;
618     }
619     if (!Write(parcel, vtSrvRat)) {
620         return false;
621     }
622     if (!Write(parcel, vsSrvStatus)) {
623         return false;
624     }
625     if (!Write(parcel, vsSrvRat)) {
626         return false;
627     }
628     return true;
629 }
630 
UnMarshalling(Parcel & parcel)631 std::shared_ptr<CallImsServiceStatus> CallImsServiceStatus::UnMarshalling(Parcel &parcel)
632 {
633     std::shared_ptr<CallImsServiceStatus> param = std::make_shared<CallImsServiceStatus>();
634     if (param == nullptr || !param->ReadFromParcel(parcel)) {
635         param = nullptr;
636     }
637     return param;
638 }
639 
Dump(std::string,int32_t)640 void CallImsServiceStatus::Dump(std::string, int32_t) {}
641 
ReadFromParcel(Parcel & parcel)642 bool UssdInfo::ReadFromParcel(Parcel &parcel)
643 {
644     if (!Read(parcel, n)) {
645         return false;
646     }
647     if (!Read(parcel, str)) {
648         return false;
649     }
650     if (!Read(parcel, dcs)) {
651         return false;
652     }
653     return true;
654 }
655 
Marshalling(Parcel & parcel) const656 bool UssdInfo::Marshalling(Parcel &parcel) const
657 {
658     if (!Write(parcel, n)) {
659         return false;
660     }
661     if (!Write(parcel, str)) {
662         return false;
663     }
664     if (!Write(parcel, dcs)) {
665         return false;
666     }
667     return true;
668 }
669 
UnMarshalling(Parcel & parcel)670 std::shared_ptr<UssdInfo> UssdInfo::UnMarshalling(Parcel &parcel)
671 {
672     std::shared_ptr<UssdInfo> param = std::make_shared<UssdInfo>();
673     if (param == nullptr || !param->ReadFromParcel(parcel)) {
674         param = nullptr;
675     }
676     return param;
677 }
678 
Dump(std::string,int32_t)679 void UssdInfo::Dump(std::string, int32_t) {}
680 
ReadFromParcel(Parcel & parcel)681 bool UssdNoticeInfo::ReadFromParcel(Parcel &parcel)
682 {
683     if (!Read(parcel, m)) {
684         return false;
685     }
686     if (!Read(parcel, str)) {
687         return false;
688     }
689     if (!Read(parcel, dcs)) {
690         return false;
691     }
692     return true;
693 }
694 
Marshalling(Parcel & parcel) const695 bool UssdNoticeInfo::Marshalling(Parcel &parcel) const
696 {
697     if (!Write(parcel, m)) {
698         return false;
699     }
700     if (!Write(parcel, str)) {
701         return false;
702     }
703     if (!Write(parcel, dcs)) {
704         return false;
705     }
706     return true;
707 }
708 
UnMarshalling(Parcel & parcel)709 std::shared_ptr<UssdNoticeInfo> UssdNoticeInfo::UnMarshalling(Parcel &parcel)
710 {
711     std::shared_ptr<UssdNoticeInfo> param = std::make_shared<UssdNoticeInfo>();
712     if (param == nullptr || !param->ReadFromParcel(parcel)) {
713         param = nullptr;
714     }
715     return param;
716 }
717 
Dump(std::string,int32_t)718 void UssdNoticeInfo::Dump(std::string, int32_t) {}
719 
ReadFromParcel(Parcel & parcel)720 bool SrvccStatus::ReadFromParcel(Parcel &parcel)
721 {
722     if (!Read(parcel, status)) {
723         return false;
724     }
725     return true;
726 }
727 
Marshalling(Parcel & parcel) const728 bool SrvccStatus::Marshalling(Parcel &parcel) const
729 {
730     if (!Write(parcel, status)) {
731         return false;
732     }
733     return true;
734 }
735 
UnMarshalling(Parcel & parcel)736 std::shared_ptr<SrvccStatus> SrvccStatus::UnMarshalling(Parcel &parcel)
737 {
738     std::shared_ptr<SrvccStatus> param = std::make_shared<SrvccStatus>();
739     if (param == nullptr || !param->ReadFromParcel(parcel)) {
740         param = nullptr;
741     }
742     return param;
743 }
744 
Dump(std::string,int32_t)745 void SrvccStatus::Dump(std::string, int32_t) {}
746 
ReadFromParcel(Parcel & parcel)747 bool RingbackVoice::ReadFromParcel(Parcel &parcel)
748 {
749     if (!Read(parcel, status)) {
750         return false;
751     }
752     return true;
753 }
754 
Marshalling(Parcel & parcel) const755 bool RingbackVoice::Marshalling(Parcel &parcel) const
756 {
757     if (!Write(parcel, status)) {
758         return false;
759     }
760     return true;
761 }
762 
UnMarshalling(Parcel & parcel)763 std::shared_ptr<RingbackVoice> RingbackVoice::UnMarshalling(Parcel &parcel)
764 {
765     std::shared_ptr<RingbackVoice> param = std::make_shared<RingbackVoice>();
766     if (param == nullptr || !param->ReadFromParcel(parcel)) {
767         param = nullptr;
768     }
769     return param;
770 }
771 
Dump(std::string,int32_t)772 void RingbackVoice::Dump(std::string, int32_t) {}
773 } // namespace Telephony
774 } // namespace OHOS
775