Home | History | Annotate | Download | only in binder
      1 //
      2 //  Copyright (C) 2015 Google, Inc.
      3 //
      4 //  Licensed under the Apache License, Version 2.0 (the "License");
      5 //  you may not use this file except in compliance with the License.
      6 //  You may obtain a copy of the License at:
      7 //
      8 //  http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 //  Unless required by applicable law or agreed to in writing, software
     11 //  distributed under the License is distributed on an "AS IS" BASIS,
     12 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 //  See the License for the specific language governing permissions and
     14 //  limitations under the License.
     15 //
     16 
     17 #pragma once
     18 
     19 #include <memory>
     20 
     21 #include <binder/Parcel.h>
     22 
     23 #include <bluetooth/advertise_data.h>
     24 #include <bluetooth/advertise_settings.h>
     25 #include <bluetooth/gatt_identifier.h>
     26 #include <bluetooth/scan_filter.h>
     27 #include <bluetooth/scan_result.h>
     28 #include <bluetooth/scan_settings.h>
     29 #include <bluetooth/uuid.h>
     30 
     31 namespace ipc {
     32 namespace binder {
     33 
     34 // Java Parcel meta-data constants.
     35 const int kParcelValList = 11;
     36 
     37 // Helpers for converting bluetooth::AdvertiseData to/from Parcel
     38 
     39 void WriteAdvertiseDataToParcel(
     40     const bluetooth::AdvertiseData& data,
     41     android::Parcel* parcel);
     42 
     43 std::unique_ptr<bluetooth::AdvertiseData> CreateAdvertiseDataFromParcel(
     44     const android::Parcel& parcel);
     45 
     46 // Helpers for converting bluetooth::AdvertiseSettings to/from Parcel
     47 
     48 void WriteAdvertiseSettingsToParcel(
     49     const bluetooth::AdvertiseSettings& settings,
     50     android::Parcel* parcel);
     51 
     52 std::unique_ptr<bluetooth::AdvertiseSettings> CreateAdvertiseSettingsFromParcel(
     53     const android::Parcel& parcel);
     54 
     55 // Helpers for converting bluetooth::UUID to/from Parcel
     56 
     57 void WriteUUIDToParcel(const bluetooth::UUID& uuid, android::Parcel* parcel);
     58 
     59 std::unique_ptr<bluetooth::UUID> CreateUUIDFromParcel(
     60     const android::Parcel& parcel);
     61 
     62 // Helpers for converting bluetooth::GattIdentifier to/from Parcel
     63 
     64 void WriteGattIdentifierToParcel(
     65     const bluetooth::GattIdentifier& gatt_id,
     66     android::Parcel* parcel);
     67 
     68 std::unique_ptr<bluetooth::GattIdentifier> CreateGattIdentifierFromParcel(
     69     const android::Parcel& parcel);
     70 
     71 // Helpers for converting bluetooth::ScanFilter to/from Parcel
     72 
     73 void WriteScanFilterToParcel(
     74     const bluetooth::ScanFilter& filter,
     75     android::Parcel* parcel);
     76 
     77 std::unique_ptr<bluetooth::ScanFilter> CreateScanFilterFromParcel(
     78     const android::Parcel& parcel);
     79 
     80 // Helpers for converting bluetooth::ScanSettings to/from Parcel
     81 
     82 void WriteScanSettingsToParcel(
     83     const bluetooth::ScanSettings& settings,
     84     android::Parcel* parcel);
     85 
     86 std::unique_ptr<bluetooth::ScanSettings> CreateScanSettingsFromParcel(
     87     const android::Parcel& parcel);
     88 
     89 // Helpers for converting bluetooth::ScanResult to/from Parcel
     90 
     91 void WriteScanResultToParcel(
     92     const bluetooth::ScanResult& scan_result,
     93     android::Parcel* parcel);
     94 
     95 std::unique_ptr<bluetooth::ScanResult> CreateScanResultFromParcel(
     96     const android::Parcel& parcel);
     97 
     98 }  // namespace binder
     99 }  // namespace ipc
    100