1 /* 2 * Copyright (C) Huawei Device Co., Ltd. 2025-2025. All rights reserved. 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 OHOS_BLUETOOTH_STANDARD_BLUETOOTH_PARCEL_TRUST_DEVICE_H 17 #define OHOS_BLUETOOTH_STANDARD_BLUETOOTH_PARCEL_TRUST_DEVICE_H 18 19 #include "parcel.h" 20 #include "bt_trust_pair_device.h" 21 22 namespace OHOS { 23 namespace Bluetooth { 24 constexpr int32_t TRUST_PAIR_DEVICE_SIZE_MAX = 1000; 25 class BluetoothTrustPairDevice : public Parcelable, public bluetooth::TrustPairDevice { 26 public: 27 BluetoothTrustPairDevice() = default; 28 ~BluetoothTrustPairDevice() = default; 29 30 bool Marshalling(Parcel &parcel) const override; 31 static BluetoothTrustPairDevice *Unmarshalling(Parcel &parcel); 32 bool WriteToParcel(Parcel &parcel); 33 bool ReadFromParcel(Parcel &parcel); 34 private: 35 bool MarshallingVecSafe(Parcel &parcel, const std::vector<uint8_t> &vec) const; 36 bool ReadParcelVecSafe(Parcel &parcel, std::vector<uint8_t> &res); 37 bool MarshallingVecStrSafe(Parcel &parcel, const std::vector<std::string> &vec) const; 38 bool ReadParcelVecStrSafe(Parcel &parcel, std::vector<std::string> &res); 39 }; 40 } // namespace Bluetooth 41 } // namespace OHOS 42 43 #endif // BLUETOOTH_PARCEL_SENSING_INFO_H