1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_
8 #include "base/memory/weak_ptr.h"
9 #include "device/bluetooth/bluetooth_adapter.h"
12 class SequencedTaskRunner
;
17 // The BluetoothAdapterAndroid class implements BluetoothAdapter for the
19 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final
20 : public BluetoothAdapter
{
22 static base::WeakPtr
<BluetoothAdapter
> CreateAdapter();
25 std::string
GetAddress() const override
;
26 std::string
GetName() const override
;
27 void SetName(const std::string
& name
,
28 const base::Closure
& callback
,
29 const ErrorCallback
& error_callback
) override
;
30 bool IsInitialized() const override
;
31 bool IsPresent() const override
;
32 bool IsPowered() const override
;
33 void SetPowered(bool powered
,
34 const base::Closure
& callback
,
35 const ErrorCallback
& error_callback
) override
;
36 bool IsDiscoverable() const override
;
37 void SetDiscoverable(bool discoverable
,
38 const base::Closure
& callback
,
39 const ErrorCallback
& error_callback
) override
;
40 bool IsDiscovering() const override
;
41 void CreateRfcommService(
42 const BluetoothUUID
& uuid
,
43 const ServiceOptions
& options
,
44 const CreateServiceCallback
& callback
,
45 const CreateServiceErrorCallback
& error_callback
) override
;
46 void CreateL2capService(
47 const BluetoothUUID
& uuid
,
48 const ServiceOptions
& options
,
49 const CreateServiceCallback
& callback
,
50 const CreateServiceErrorCallback
& error_callback
) override
;
51 void RegisterAudioSink(
52 const BluetoothAudioSink::Options
& options
,
53 const AcquiredCallback
& callback
,
54 const BluetoothAudioSink::ErrorCallback
& error_callback
) override
;
55 void RegisterAdvertisement(
56 scoped_ptr
<BluetoothAdvertisement::Data
> advertisement_data
,
57 const CreateAdvertisementCallback
& callback
,
58 const CreateAdvertisementErrorCallback
& error_callback
) override
;
61 BluetoothAdapterAndroid();
62 ~BluetoothAdapterAndroid() override
;
65 void AddDiscoverySession(BluetoothDiscoveryFilter
* discovery_filter
,
66 const base::Closure
& callback
,
67 const ErrorCallback
& error_callback
) override
;
68 void RemoveDiscoverySession(BluetoothDiscoveryFilter
* discovery_filter
,
69 const base::Closure
& callback
,
70 const ErrorCallback
& error_callback
) override
;
71 void SetDiscoveryFilter(scoped_ptr
<BluetoothDiscoveryFilter
> discovery_filter
,
72 const base::Closure
& callback
,
73 const ErrorCallback
& error_callback
) override
;
74 void RemovePairingDelegateInternal(
75 BluetoothDevice::PairingDelegate
* pairing_delegate
) override
;
80 // Note: This should remain the last member so it'll be destroyed and
81 // invalidate its weak pointers before any other members are destroyed.
82 base::WeakPtrFactory
<BluetoothAdapterAndroid
> weak_ptr_factory_
;
84 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid
);
89 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_