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 #include "device/bluetooth/bluetooth_adapter_android.h"
7 #include "base/sequenced_task_runner.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h"
10 #include "device/bluetooth/bluetooth_advertisement.h"
15 base::WeakPtr
<BluetoothAdapter
> BluetoothAdapter::CreateAdapter(
16 const InitCallback
& init_callback
) {
17 return BluetoothAdapterAndroid::CreateAdapter();
21 base::WeakPtr
<BluetoothAdapter
> BluetoothAdapterAndroid::CreateAdapter() {
22 BluetoothAdapterAndroid
* adapter
= new BluetoothAdapterAndroid();
23 return adapter
->weak_ptr_factory_
.GetWeakPtr();
26 std::string
BluetoothAdapterAndroid::GetAddress() const {
30 std::string
BluetoothAdapterAndroid::GetName() const {
34 void BluetoothAdapterAndroid::SetName(const std::string
& name
,
35 const base::Closure
& callback
,
36 const ErrorCallback
& error_callback
) {
40 bool BluetoothAdapterAndroid::IsInitialized() const {
45 bool BluetoothAdapterAndroid::IsPresent() const {
50 bool BluetoothAdapterAndroid::IsPowered() const {
55 void BluetoothAdapterAndroid::SetPowered(bool powered
,
56 const base::Closure
& callback
,
57 const ErrorCallback
& error_callback
) {
61 bool BluetoothAdapterAndroid::IsDiscoverable() const {
66 void BluetoothAdapterAndroid::SetDiscoverable(
68 const base::Closure
& callback
,
69 const ErrorCallback
& error_callback
) {
73 bool BluetoothAdapterAndroid::IsDiscovering() const {
78 void BluetoothAdapterAndroid::CreateRfcommService(
79 const BluetoothUUID
& uuid
,
80 const ServiceOptions
& options
,
81 const CreateServiceCallback
& callback
,
82 const CreateServiceErrorCallback
& error_callback
) {
84 error_callback
.Run("Not Implemented");
87 void BluetoothAdapterAndroid::CreateL2capService(
88 const BluetoothUUID
& uuid
,
89 const ServiceOptions
& options
,
90 const CreateServiceCallback
& callback
,
91 const CreateServiceErrorCallback
& error_callback
) {
93 error_callback
.Run("Not Implemented");
96 void BluetoothAdapterAndroid::RegisterAudioSink(
97 const BluetoothAudioSink::Options
& options
,
98 const AcquiredCallback
& callback
,
99 const BluetoothAudioSink::ErrorCallback
& error_callback
) {
100 error_callback
.Run(BluetoothAudioSink::ERROR_UNSUPPORTED_PLATFORM
);
103 void BluetoothAdapterAndroid::RegisterAdvertisement(
104 scoped_ptr
<BluetoothAdvertisement::Data
> advertisement_data
,
105 const CreateAdvertisementCallback
& callback
,
106 const CreateAdvertisementErrorCallback
& error_callback
) {
107 error_callback
.Run(BluetoothAdvertisement::ERROR_UNSUPPORTED_PLATFORM
);
110 BluetoothAdapterAndroid::BluetoothAdapterAndroid() : weak_ptr_factory_(this) {
113 BluetoothAdapterAndroid::~BluetoothAdapterAndroid() {
116 void BluetoothAdapterAndroid::AddDiscoverySession(
117 BluetoothDiscoveryFilter
* discovery_filter
,
118 const base::Closure
& callback
,
119 const ErrorCallback
& error_callback
) {
122 void BluetoothAdapterAndroid::RemoveDiscoverySession(
123 BluetoothDiscoveryFilter
* discovery_filter
,
124 const base::Closure
& callback
,
125 const ErrorCallback
& error_callback
) {
128 void BluetoothAdapterAndroid::SetDiscoveryFilter(
129 scoped_ptr
<BluetoothDiscoveryFilter
> discovery_filter
,
130 const base::Closure
& callback
,
131 const ErrorCallback
& error_callback
) {
134 void BluetoothAdapterAndroid::RemovePairingDelegateInternal(
135 device::BluetoothDevice::PairingDelegate
* pairing_delegate
) {
138 } // namespace device