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_device_chromeos.h" | 5 #include "device/bluetooth/bluetooth_device_chromeos.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 | 436 |
437 void BluetoothDeviceChromeOS::ConnectToService( | 437 void BluetoothDeviceChromeOS::ConnectToService( |
438 const BluetoothUUID& uuid, | 438 const BluetoothUUID& uuid, |
439 const ConnectToServiceCallback& callback, | 439 const ConnectToServiceCallback& callback, |
440 const ConnectToServiceErrorCallback& error_callback) { | 440 const ConnectToServiceErrorCallback& error_callback) { |
441 VLOG(1) << object_path_.value() << ": Connecting to service: " | 441 VLOG(1) << object_path_.value() << ": Connecting to service: " |
442 << uuid.canonical_value(); | 442 << uuid.canonical_value(); |
443 scoped_refptr<BluetoothSocketChromeOS> socket = | 443 scoped_refptr<BluetoothSocketChromeOS> socket = |
444 BluetoothSocketChromeOS::CreateBluetoothSocket( | 444 BluetoothSocketChromeOS::CreateBluetoothSocket( |
445 ui_task_runner_, | 445 ui_task_runner_, socket_thread_); |
446 socket_thread_, | 446 socket->Connect(this, uuid, base::Bind(callback, socket), error_callback); |
447 NULL, | |
448 net::NetLog::Source()); | |
449 socket->Connect(this, uuid, | |
450 base::Bind(callback, socket), | |
451 error_callback); | |
452 } | 447 } |
453 | 448 |
454 void BluetoothDeviceChromeOS::CreateGattConnection( | 449 void BluetoothDeviceChromeOS::CreateGattConnection( |
455 const GattConnectionCallback& callback, | 450 const GattConnectionCallback& callback, |
456 const ConnectErrorCallback& error_callback) { | 451 const ConnectErrorCallback& error_callback) { |
457 // TODO(armansito): Until there is a way to create a reference counted GATT | 452 // TODO(armansito): Until there is a way to create a reference counted GATT |
458 // connection in bluetoothd, simply do a regular connect. | 453 // connection in bluetoothd, simply do a regular connect. |
459 Connect(NULL, | 454 Connect(NULL, |
460 base::Bind(&BluetoothDeviceChromeOS::OnCreateGattConnection, | 455 base::Bind(&BluetoothDeviceChromeOS::OnCreateGattConnection, |
461 weak_ptr_factory_.GetWeakPtr(), | 456 weak_ptr_factory_.GetWeakPtr(), |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 void BluetoothDeviceChromeOS::OnForgetError( | 709 void BluetoothDeviceChromeOS::OnForgetError( |
715 const ErrorCallback& error_callback, | 710 const ErrorCallback& error_callback, |
716 const std::string& error_name, | 711 const std::string& error_name, |
717 const std::string& error_message) { | 712 const std::string& error_message) { |
718 LOG(WARNING) << object_path_.value() << ": Failed to remove device: " | 713 LOG(WARNING) << object_path_.value() << ": Failed to remove device: " |
719 << error_name << ": " << error_message; | 714 << error_name << ": " << error_message; |
720 error_callback.Run(); | 715 error_callback.Run(); |
721 } | 716 } |
722 | 717 |
723 } // namespace chromeos | 718 } // namespace chromeos |
OLD | NEW |