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_chromeos.h" | 5 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 const ErrorCallback& error_callback) { | 236 const ErrorCallback& error_callback) { |
237 error_callback.Run(); | 237 error_callback.Run(); |
238 } | 238 } |
239 | 239 |
240 void BluetoothAdapterChromeOS::CreateRfcommService( | 240 void BluetoothAdapterChromeOS::CreateRfcommService( |
241 const BluetoothUUID& uuid, | 241 const BluetoothUUID& uuid, |
242 int channel, | 242 int channel, |
243 bool insecure, | 243 bool insecure, |
244 const CreateServiceCallback& callback, | 244 const CreateServiceCallback& callback, |
245 const CreateServiceErrorCallback& error_callback) { | 245 const CreateServiceErrorCallback& error_callback) { |
246 // TODO(keybuk): implement. | 246 VLOG(1) << object_path_.value() << ": Creating RFCOMM service: " |
247 NOTIMPLEMENTED(); | 247 << uuid.canonical_value(); |
| 248 scoped_refptr<BluetoothSocketChromeOS> socket = |
| 249 BluetoothSocketChromeOS::CreateBluetoothSocket( |
| 250 ui_task_runner_, |
| 251 socket_thread_, |
| 252 NULL, |
| 253 net::NetLog::Source()); |
| 254 socket->Listen(this, |
| 255 BluetoothSocketChromeOS::kRfcomm, |
| 256 uuid, |
| 257 channel, |
| 258 insecure, |
| 259 base::Bind(callback, socket), |
| 260 error_callback); |
248 } | 261 } |
249 | 262 |
250 void BluetoothAdapterChromeOS::CreateL2capService( | 263 void BluetoothAdapterChromeOS::CreateL2capService( |
251 const BluetoothUUID& uuid, | 264 const BluetoothUUID& uuid, |
252 int psm, | 265 int psm, |
253 const CreateServiceCallback& callback, | 266 const CreateServiceCallback& callback, |
254 const CreateServiceErrorCallback& error_callback) { | 267 const CreateServiceErrorCallback& error_callback) { |
255 // TODO(keybuk): implement. | 268 VLOG(1) << object_path_.value() << ": Creating L2CAP service: " |
256 NOTIMPLEMENTED(); | 269 << uuid.canonical_value(); |
| 270 scoped_refptr<BluetoothSocketChromeOS> socket = |
| 271 BluetoothSocketChromeOS::CreateBluetoothSocket( |
| 272 ui_task_runner_, |
| 273 socket_thread_, |
| 274 NULL, |
| 275 net::NetLog::Source()); |
| 276 socket->Listen(this, |
| 277 BluetoothSocketChromeOS::kL2cap, |
| 278 uuid, |
| 279 psm, |
| 280 false, |
| 281 base::Bind(callback, socket), |
| 282 error_callback); |
257 } | 283 } |
258 | 284 |
259 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( | 285 void BluetoothAdapterChromeOS::RemovePairingDelegateInternal( |
260 BluetoothDevice::PairingDelegate* pairing_delegate) { | 286 BluetoothDevice::PairingDelegate* pairing_delegate) { |
261 // Before removing a pairing delegate make sure that there aren't any devices | 287 // Before removing a pairing delegate make sure that there aren't any devices |
262 // currently using it; if there are, clear the pairing context which will | 288 // currently using it; if there are, clear the pairing context which will |
263 // make any responses no-ops. | 289 // make any responses no-ops. |
264 for (DevicesMap::iterator iter = devices_.begin(); | 290 for (DevicesMap::iterator iter = devices_.begin(); |
265 iter != devices_.end(); ++iter) { | 291 iter != devices_.end(); ++iter) { |
266 BluetoothDeviceChromeOS* device_chromeos = | 292 BluetoothDeviceChromeOS* device_chromeos = |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 933 |
908 // If the queued request resulted in a pending call, then let it | 934 // If the queued request resulted in a pending call, then let it |
909 // asynchonously process the remaining queued requests once the pending | 935 // asynchonously process the remaining queued requests once the pending |
910 // call returns. | 936 // call returns. |
911 if (discovery_request_pending_) | 937 if (discovery_request_pending_) |
912 return; | 938 return; |
913 } | 939 } |
914 } | 940 } |
915 | 941 |
916 } // namespace chromeos | 942 } // namespace chromeos |
OLD | NEW |