OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "device/bluetooth/bluetooth_adapter_mac.h" | 5 #include "device/bluetooth/bluetooth_adapter_mac.h" |
6 | 6 |
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> | 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> |
8 #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> | 8 #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> |
9 #import <IOBluetooth/objc/IOBluetoothHostController.h> | 9 #import <IOBluetooth/objc/IOBluetoothHostController.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/sequenced_task_runner.h" | 18 #include "base/sequenced_task_runner.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
21 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "device/bluetooth/bluetooth_device_mac.h" | 23 #include "device/bluetooth/bluetooth_device_mac.h" |
| 24 #include "device/bluetooth/bluetooth_socket_mac.h" |
| 25 #include "device/bluetooth/bluetooth_uuid.h" |
24 | 26 |
25 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | 27 // Replicate specific 10.7 SDK declarations for building with prior SDKs. |
26 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 28 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
27 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 29 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
28 | 30 |
29 @interface IOBluetoothHostController (LionSDKDeclarations) | 31 @interface IOBluetoothHostController (LionSDKDeclarations) |
30 - (NSString*)nameAsString; | 32 - (NSString*)nameAsString; |
31 - (BluetoothHCIPowerState)powerState; | 33 - (BluetoothHCIPowerState)powerState; |
32 @end | 34 @end |
33 | 35 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool BluetoothAdapterMac::IsDiscovering() const { | 173 bool BluetoothAdapterMac::IsDiscovering() const { |
172 return discovery_status_ == DISCOVERING || | 174 return discovery_status_ == DISCOVERING || |
173 discovery_status_ == DISCOVERY_STOPPING; | 175 discovery_status_ == DISCOVERY_STOPPING; |
174 } | 176 } |
175 | 177 |
176 void BluetoothAdapterMac::ReadLocalOutOfBandPairingData( | 178 void BluetoothAdapterMac::ReadLocalOutOfBandPairingData( |
177 const BluetoothOutOfBandPairingDataCallback& callback, | 179 const BluetoothOutOfBandPairingDataCallback& callback, |
178 const ErrorCallback& error_callback) { | 180 const ErrorCallback& error_callback) { |
179 } | 181 } |
180 | 182 |
| 183 void BluetoothAdapterMac::CreateRfcommService( |
| 184 const BluetoothUUID& uuid, |
| 185 int channel, |
| 186 bool insecure, |
| 187 const CreateServiceCallback& callback, |
| 188 const CreateServiceErrorCallback& error_callback) { |
| 189 // TODO(keybuk): implement. |
| 190 NOTIMPLEMENTED(); |
| 191 } |
| 192 |
| 193 void BluetoothAdapterMac::CreateL2capService( |
| 194 const BluetoothUUID& uuid, |
| 195 int psm, |
| 196 const CreateServiceCallback& callback, |
| 197 const CreateServiceErrorCallback& error_callback) { |
| 198 // TODO(keybuk): implement. |
| 199 NOTIMPLEMENTED(); |
| 200 } |
| 201 |
181 void BluetoothAdapterMac::AddDiscoverySession( | 202 void BluetoothAdapterMac::AddDiscoverySession( |
182 const base::Closure& callback, | 203 const base::Closure& callback, |
183 const ErrorCallback& error_callback) { | 204 const ErrorCallback& error_callback) { |
184 if (discovery_status_ == DISCOVERING) { | 205 if (discovery_status_ == DISCOVERING) { |
185 num_discovery_listeners_++; | 206 num_discovery_listeners_++; |
186 callback.Run(); | 207 callback.Run(); |
187 return; | 208 return; |
188 } | 209 } |
189 on_start_discovery_callbacks_.push_back( | 210 on_start_discovery_callbacks_.push_back( |
190 std::make_pair(callback, error_callback)); | 211 std::make_pair(callback, error_callback)); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 iter != callback_list.end(); | 379 iter != callback_list.end(); |
359 ++iter) { | 380 ++iter) { |
360 if (success) | 381 if (success) |
361 ui_task_runner_->PostTask(FROM_HERE, iter->first); | 382 ui_task_runner_->PostTask(FROM_HERE, iter->first); |
362 else | 383 else |
363 ui_task_runner_->PostTask(FROM_HERE, iter->second); | 384 ui_task_runner_->PostTask(FROM_HERE, iter->second); |
364 } | 385 } |
365 } | 386 } |
366 | 387 |
367 } // namespace device | 388 } // namespace device |
OLD | NEW |