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 #ifndef BLUETOOTH_PARCEL_BLE_ADVERTISER_DATA_H 16 #define BLUETOOTH_PARCEL_BLE_ADVERTISER_DATA_H 17 18 #include "../common/ble_parcel_data.h" 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace Bluetooth { 23 class BluetoothBleAdvertiserData : public Parcelable, public bluetooth::AdvertiserData { 24 public: 25 explicit BluetoothBleAdvertiserData() = default; BluetoothBleAdvertiserData(const bluetooth::AdvertiserData & other)26 explicit BluetoothBleAdvertiserData(const bluetooth::AdvertiserData &other) : bluetooth::AdvertiserData(other) 27 {} BluetoothBleAdvertiserData(const BluetoothBleAdvertiserData & other)28 explicit BluetoothBleAdvertiserData(const BluetoothBleAdvertiserData &other) : bluetooth::AdvertiserData(other) 29 {} 30 BluetoothBleAdvertiserData& operator=(const bluetooth::AdvertiserData &other) = delete; 31 BluetoothBleAdvertiserData& operator=(const BluetoothBleAdvertiserData &other) = delete; 32 ~BluetoothBleAdvertiserData() override = default; 33 34 bool Marshalling(Parcel &parcel) const override; 35 36 static BluetoothBleAdvertiserData *Unmarshalling(Parcel &parcel); 37 38 bool WriteToParcel(Parcel &parcel); 39 bool ReadFromParcel(Parcel &parcel); 40 41 private: 42 bool WriteServiceUuids(Parcel &parcel) const; 43 bool ReadServiceUuids(std::vector<bluetooth::Uuid> &serviceUuids, Parcel &parcel); 44 45 bool WriteManufacturerData(Parcel &parcel) const; 46 bool ReadManufacturerData(std::map<uint16_t, std::string> &manufacturerData, Parcel &parcel); 47 48 bool WriteServiceData(Parcel &parcel) const; 49 bool ReadServiceData(std::map<bluetooth::Uuid, std::string> &serviceData, Parcel &parcel); 50 }; 51 } // namespace Bluetooth 52 } // namespace OHOS 53 54 #endif // BLUETOOTH_PARCEL_BLE_ADVERTISER_DATA_H