1b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//
2b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  Copyright 2017, The Android Open Source Project
3b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//
4b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  Licensed under the Apache License, Version 2.0 (the "License");
5b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  you may not use this file except in compliance with the License.
6b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  You may obtain a copy of the License at:
7b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//
8b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  http://www.apache.org/licenses/LICENSE-2.0
9b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//
10b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  Unless required by applicable law or agreed to in writing, software
11b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  distributed under the License is distributed on an "AS IS" BASIS,
12b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  See the License for the specific language governing permissions and
14b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//  limitations under the License.
15b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski//
16b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
17b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski#pragma once
18b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
19b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski#include <binder/Parcel.h>
20b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski#include <binder/Parcelable.h>
21b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
22b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski#include <raw_address.h>
23b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
24b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowskinamespace android {
25b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowskinamespace bluetooth {
26b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
27b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowskiclass BluetoothDevice : public android::Parcelable {
28b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski public:
29b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  BluetoothDevice() = default;
30b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  ~BluetoothDevice() = default;
31b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
32b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // Write |this| parcelable to the given |parcel|.  Keep in mind that
33b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // implementations of writeToParcel must be manually kept in sync
34b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // with readFromParcel and the Java equivalent versions of these methods.
35b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  //
36b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // Returns android::OK on success and an appropriate error otherwise.
37b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  android::status_t writeToParcel(android::Parcel* parcel) const override;
38b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
39b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // Read data from the given |parcel| into |this|.  After readFromParcel
40b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // completes, |this| should have equivalent state to the object that
41b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // wrote itself to the parcel.
42b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  //
43b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  // Returns android::OK on success and an appropriate error otherwise.
44b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  android::status_t readFromParcel(const android::Parcel* parcel) override;
45b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
46b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski  RawAddress address;
47b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski};
48b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski
49b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski}  // namespace bluetooth
50b38374d71a63812712de4a4e20c0df4ff8accf28Jakub Pawlowski}  // namespace android
51