1 /* 2 * Copyright (C) 2025 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 #include "apn_item.h" 16 #include "apn_activate_report_info.h" 17 18 namespace OHOS { 19 namespace Telephony { Marshalling(Parcel & parcel) const20bool ApnActivateReportInfoIpc::Marshalling(Parcel &parcel) const 21 { 22 if (!parcel.WriteUint32(actTimes)) { 23 return false; 24 } 25 if (!parcel.WriteUint32(averDuration)) { 26 return false; 27 } 28 if (!parcel.WriteUint32(topReason)) { 29 return false; 30 } 31 if (!parcel.WriteUint32(actSuccTimes)) { 32 return false; 33 } 34 return true; 35 } 36 Unmarshalling(Parcel & parcel)37ApnActivateReportInfoIpc* ApnActivateReportInfoIpc::Unmarshalling(Parcel &parcel) 38 { 39 std::unique_ptr<ApnActivateReportInfoIpc> info = std::make_unique<ApnActivateReportInfoIpc>(); 40 if (info == nullptr) { 41 return nullptr; 42 } 43 if (!parcel.ReadUint32(info->actTimes)) { 44 return nullptr; 45 } 46 if (!parcel.ReadUint32(info->averDuration)) { 47 return nullptr; 48 } 49 if (!parcel.ReadUint32(info->topReason)) { 50 return nullptr; 51 } 52 if (!parcel.ReadUint32(info->actSuccTimes)) { 53 return nullptr; 54 } 55 return info.release(); 56 } 57 transferToReportInfo(ApnActivateReportInfoIpc infoIpc,ApnActivateReportInfo & info)58void ApnActivateReportInfoIpc::transferToReportInfo(ApnActivateReportInfoIpc infoIpc, ApnActivateReportInfo &info) 59 { 60 info.actTimes = infoIpc.actTimes; 61 info.averDuration = infoIpc.averDuration; 62 info.topReason = infoIpc.topReason; 63 info.actSuccTimes = infoIpc.actSuccTimes; 64 } 65 } 66 }