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

Unified Diff: device/bluetooth/bluetooth_adapter.h

Issue 1054743003: Add CPP API for BLE advertisments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: device/bluetooth/bluetooth_adapter.h
diff --git a/device/bluetooth/bluetooth_adapter.h b/device/bluetooth/bluetooth_adapter.h
index 87734d24527bb7204accf9cad08fb5bf26b25397..6737944e1eca7fb95e902eb8bafb534206239c29 100644
--- a/device/bluetooth/bluetooth_adapter.h
+++ b/device/bluetooth/bluetooth_adapter.h
@@ -14,12 +14,14 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "device/bluetooth/bluetooth_advertisement.h"
#include "device/bluetooth/bluetooth_audio_sink.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
namespace device {
+class BluetoothAdvertisement;
class BluetoothDiscoveryFilter;
class BluetoothDiscoverySession;
class BluetoothGattCharacteristic;
@@ -174,22 +176,26 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapter
// The ErrorCallback is used for methods that can fail in which case it is
// called, in the success case the callback is simply not called.
- typedef base::Closure ErrorCallback;
+ using ErrorCallback = base::Closure;
// The InitCallback is used to trigger a callback after asynchronous
// initialization, if initialization is asynchronous on the platform.
- typedef base::Callback<void()> InitCallback;
-
- typedef base::Callback<void(scoped_ptr<BluetoothDiscoverySession>)>
- DiscoverySessionCallback;
- typedef std::vector<BluetoothDevice*> DeviceList;
- typedef std::vector<const BluetoothDevice*> ConstDeviceList;
- typedef base::Callback<void(scoped_refptr<BluetoothSocket>)>
- CreateServiceCallback;
- typedef base::Callback<void(const std::string& message)>
- CreateServiceErrorCallback;
- typedef base::Callback<void(scoped_refptr<BluetoothAudioSink>)>
- AcquiredCallback;
+ using InitCallback = base::Callback<void()>;
+
+ using DiscoverySessionCallback =
+ base::Callback<void(scoped_ptr<BluetoothDiscoverySession>)>;
+ using DeviceList = std::vector<BluetoothDevice*>;
+ using ConstDeviceList = std::vector<const BluetoothDevice*>;
+ using CreateServiceCallback =
+ base::Callback<void(scoped_refptr<BluetoothSocket>)>;
+ using CreateServiceErrorCallback =
+ base::Callback<void(const std::string& message)>;
+ using AcquiredCallback =
+ base::Callback<void(scoped_refptr<BluetoothAudioSink>)>;
+ using CreateAdvertisementCallback =
+ base::Callback<void(scoped_refptr<BluetoothAdvertisement>)>;
+ using CreateAdvertisementErrorCallback =
+ base::Callback<void(BluetoothAdvertisement::ErrorCode)>;
armansito 2015/04/24 22:11:00 Why did you do this here? I prefer that you perfor
rkc 2015/04/24 22:55:24 I agree in principle, but in this one case, I had
// Returns a weak pointer to a new adapter. For platforms with asynchronous
// initialization, the returned adapter will run the |init_callback| once
@@ -369,13 +375,20 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapter
const AcquiredCallback& callback,
const BluetoothAudioSink::ErrorCallback& error_callback) = 0;
+ // Creates and registers an advertisement for broadcast over the LE channel.
+ // The created advertisement will be returned via the success callback.
+ virtual void RegisterAdvertisement(
+ scoped_ptr<BluetoothAdvertisement::Data> advertisement_data,
+ const CreateAdvertisementCallback& callback,
+ const CreateAdvertisementErrorCallback& error_callback) = 0;
+
protected:
friend class base::RefCounted<BluetoothAdapter>;
friend class BluetoothDiscoverySession;
- typedef std::map<const std::string, BluetoothDevice*> DevicesMap;
- typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority>
- PairingDelegatePair;
+ using DevicesMap = std::map<const std::string, BluetoothDevice*>;
+ using PairingDelegatePair =
+ std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority>;
armansito 2015/04/24 22:11:00 Same as above. Do this typedef -> using conversion
rkc 2015/04/24 22:55:24 Since this really isn't directly next to my new co
BluetoothAdapter();
virtual ~BluetoothAdapter();

Powered by Google App Engine
This is Rietveld 408576698