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

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc

Issue 1116963002: Bluetooth low energy connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing debug messages Created 5 years, 7 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
Index: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
index d911388fa5616dee2aa82c4d5944498a3d48d8b7..63773af928df14e4d1ad0bd5a50f4068298557e8 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
+++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc
@@ -15,6 +15,8 @@
#include "device/bluetooth/bluetooth_discovery_session.h"
#include "device/bluetooth/bluetooth_uuid.h"
+#include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
msarda 2015/05/05 11:56:14 Sort headers.
sacomoto 2015/05/06 13:47:59 Done.
+
using device::BluetoothAdapter;
using device::BluetoothDevice;
using device::BluetoothGattConnection;
@@ -40,7 +42,7 @@ BluetoothLowEnergyConnectionFinder::~BluetoothLowEnergyConnectionFinder() {
}
void BluetoothLowEnergyConnectionFinder::Find(
- const BluetoothDevice::GattConnectionCallback& connection_callback) {
+ const ConnectionCallback& connection_callback) {
if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) {
VLOG(1) << "[BCF] Bluetooth is unsupported on this platform. Aborting.";
return;
@@ -54,11 +56,6 @@ void BluetoothLowEnergyConnectionFinder::Find(
weak_ptr_factory_.GetWeakPtr()));
}
-void BluetoothLowEnergyConnectionFinder::Find(
- const ConnectionCallback& connection_callback) {
- NOTREACHED();
-}
-
void BluetoothLowEnergyConnectionFinder::DeviceAdded(BluetoothAdapter* adapter,
BluetoothDevice* device) {
DCHECK(device);
@@ -201,9 +198,9 @@ void BluetoothLowEnergyConnectionFinder::OnCreateConnectionError(
}
void BluetoothLowEnergyConnectionFinder::OnConnectionCreated(
- scoped_ptr<BluetoothGattConnection> connection) {
+ scoped_ptr<BluetoothGattConnection> gatt_connection) {
if (connected_) {
- CloseConnection(connection.Pass());
+ CloseConnection(gatt_connection.Pass());
return;
}
@@ -211,6 +208,15 @@ void BluetoothLowEnergyConnectionFinder::OnConnectionCreated(
connected_ = true;
pending_connections_.clear();
if (!connection_callback_.is_null()) {
+ RemoteDevice remote_device;
+ remote_device.bluetooth_address = gatt_connection->GetDeviceAddress();
+ std::string remote_device_address = gatt_connection->GetDeviceAddress();
msarda 2015/05/05 11:56:14 Remove remote_device_address as it is not used.
sacomoto 2015/05/06 13:47:59 Done.
+ scoped_ptr<BluetoothLowEnergyConnection> connection =
+ scoped_ptr<BluetoothLowEnergyConnection>(
+ new BluetoothLowEnergyConnection(remote_device, adapter_,
+ remote_service_uuid_,
+ gatt_connection.Pass()));
+
connection_callback_.Run(connection.Pass());
connection_callback_.Reset();
}

Powered by Google App Engine
This is Rietveld 408576698