1 /* 2 * Copyright (c) 2024-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 16 #ifndef I_INFRARED_MANAGER 17 #define I_INFRARED_MANAGER 18 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace MMI { 23 struct InfraredFrequency : public Parcelable { 24 int64_t max_ { 0 }; 25 int64_t min_ { 0 }; ReadFromParcelInfraredFrequency26 bool ReadFromParcel(Parcel &parcel) 27 { 28 return ( 29 parcel.ReadInt64(max_) && 30 parcel.ReadInt64(min_) 31 ); 32 } 33 MarshallingInfraredFrequency34 bool Marshalling(Parcel &parcel) const 35 { 36 if (!parcel.WriteInt64(max_)) { 37 return false; 38 } 39 if (!parcel.WriteInt64(min_)) { 40 return false; 41 } 42 return true; 43 } 44 UnmarshallingInfraredFrequency45 static struct InfraredFrequency* Unmarshalling(Parcel &parcel) 46 { 47 auto infraredFrequency = new (std::nothrow) struct InfraredFrequency(); 48 if (infraredFrequency && !infraredFrequency->ReadFromParcel(parcel)) { 49 delete infraredFrequency; 50 infraredFrequency = nullptr; 51 } 52 53 return infraredFrequency; 54 } 55 }; 56 } // namespace MMI 57 } // namespace OHOS 58 #endif // I_INFRARED_MANAGER