Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8462)

Unified Diff: device/bluetooth/bluetooth_device_chromeos.cc

Issue 333983003: device/bluetooth: Implement BluetoothGattConnection on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | device/bluetooth/bluetooth_gatt_chromeos_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_chromeos.cc
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc
index e0fc0fde0824e01cc0397b5a0c4edc6577ec3357..c8085699ef6b0231a2685fcf9c3a0d3197649672 100644
--- a/device/bluetooth/bluetooth_device_chromeos.cc
+++ b/device/bluetooth/bluetooth_device_chromeos.cc
@@ -18,6 +18,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "dbus/bus.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#include "device/bluetooth/bluetooth_gatt_connection_chromeos.h"
#include "device/bluetooth/bluetooth_pairing_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/bluetooth_socket.h"
@@ -453,8 +454,13 @@ void BluetoothDeviceChromeOS::ConnectToService(
void BluetoothDeviceChromeOS::CreateGattConnection(
const GattConnectionCallback& callback,
const ConnectErrorCallback& error_callback) {
- // TODO(armansito): Implement.
- error_callback.Run(ERROR_UNSUPPORTED_DEVICE);
+ // TODO(armansito): Until there is a way to create a reference counted GATT
+ // connection in bluetoothd, simply do a regular connect.
+ Connect(NULL,
+ base::Bind(&BluetoothDeviceChromeOS::OnCreateGattConnection,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback),
+ error_callback);
}
void BluetoothDeviceChromeOS::StartConnectionMonitor(
@@ -568,6 +574,14 @@ void BluetoothDeviceChromeOS::OnConnect(bool after_pairing,
callback.Run();
}
+void BluetoothDeviceChromeOS::OnCreateGattConnection(
+ const GattConnectionCallback& callback) {
+ scoped_ptr<device::BluetoothGattConnection> conn(
+ new BluetoothGattConnectionChromeOS(
+ adapter_, GetAddress(), object_path_));
+ callback.Run(conn.Pass());
+}
+
void BluetoothDeviceChromeOS::OnConnectError(
bool after_pairing,
const ConnectErrorCallback& error_callback,
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | device/bluetooth/bluetooth_gatt_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698