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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "device/bluetooth/bluetooth_advertisement.h"
17 #include "device/bluetooth/bluetooth_audio_sink.h" 18 #include "device/bluetooth/bluetooth_audio_sink.h"
18 #include "device/bluetooth/bluetooth_device.h" 19 #include "device/bluetooth/bluetooth_device.h"
19 #include "device/bluetooth/bluetooth_export.h" 20 #include "device/bluetooth/bluetooth_export.h"
20 21
21 namespace device { 22 namespace device {
22 23
24 class BluetoothAdvertisement;
23 class BluetoothDiscoveryFilter; 25 class BluetoothDiscoveryFilter;
24 class BluetoothDiscoverySession; 26 class BluetoothDiscoverySession;
25 class BluetoothGattCharacteristic; 27 class BluetoothGattCharacteristic;
26 class BluetoothGattDescriptor; 28 class BluetoothGattDescriptor;
27 class BluetoothGattService; 29 class BluetoothGattService;
28 class BluetoothSocket; 30 class BluetoothSocket;
29 class BluetoothUUID; 31 class BluetoothUUID;
30 struct BluetoothAdapterDeleter; 32 struct BluetoothAdapterDeleter;
31 33
32 // BluetoothAdapter represents a local Bluetooth adapter which may be used to 34 // BluetoothAdapter represents a local Bluetooth adapter which may be used to
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // will be called on success with a BluetoothAudioSink which is to be owned by 365 // will be called on success with a BluetoothAudioSink which is to be owned by
364 // the caller of this method. |error_callback| will be called on failure with 366 // the caller of this method. |error_callback| will be called on failure with
365 // a message indicating the cause. 367 // a message indicating the cause.
366 typedef base::Callback<void(scoped_refptr<BluetoothAudioSink>)> 368 typedef base::Callback<void(scoped_refptr<BluetoothAudioSink>)>
367 AcquiredCallback; 369 AcquiredCallback;
368 virtual void RegisterAudioSink( 370 virtual void RegisterAudioSink(
369 const BluetoothAudioSink::Options& options, 371 const BluetoothAudioSink::Options& options,
370 const AcquiredCallback& callback, 372 const AcquiredCallback& callback,
371 const BluetoothAudioSink::ErrorCallback& error_callback) = 0; 373 const BluetoothAudioSink::ErrorCallback& error_callback) = 0;
372 374
375 // Creates and registers an advertisement for broadcast over the LE channel.
376 // The created advertisement will be returned via the success callback.
377 typedef base::Callback<void(scoped_refptr<BluetoothAdvertisement>)>
scheib 2015/04/16 22:11:32 http://google-styleguide.googlecode.com/svn/trunk/
rkc 2015/04/17 19:57:08 Going with consistency here. This positioning of t
scheib 2015/04/21 23:13:25 https://codereview.chromium.org/1100483005 is land
rkc 2015/04/23 19:32:16 Done.
378 CreateAdvertisementCallback;
379 typedef base::Callback<void(BluetoothAdvertisement::ErrorCode)>
380 CreateAdvertisementErrorCallback;
381 virtual void RegisterAdvertisement(
382 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data,
383 const CreateAdvertisementCallback& callback,
384 const CreateAdvertisementErrorCallback& error_callback) = 0;
385
373 protected: 386 protected:
374 friend class base::RefCountedThreadSafe<BluetoothAdapter, 387 friend class base::RefCountedThreadSafe<BluetoothAdapter,
375 BluetoothAdapterDeleter>; 388 BluetoothAdapterDeleter>;
376 friend struct BluetoothAdapterDeleter; 389 friend struct BluetoothAdapterDeleter;
377 friend class BluetoothDiscoverySession; 390 friend class BluetoothDiscoverySession;
378 BluetoothAdapter(); 391 BluetoothAdapter();
379 virtual ~BluetoothAdapter(); 392 virtual ~BluetoothAdapter();
380 393
381 // Called by RefCountedThreadSafeDeleteOnCorrectThread to destroy this. 394 // Called by RefCountedThreadSafeDeleteOnCorrectThread to destroy this.
382 virtual void DeleteOnCorrectThread() const = 0; 395 virtual void DeleteOnCorrectThread() const = 0;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter. 496 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter.
484 struct BluetoothAdapterDeleter { 497 struct BluetoothAdapterDeleter {
485 static void Destruct(const BluetoothAdapter* adapter) { 498 static void Destruct(const BluetoothAdapter* adapter) {
486 adapter->DeleteOnCorrectThread(); 499 adapter->DeleteOnCorrectThread();
487 } 500 }
488 }; 501 };
489 502
490 } // namespace device 503 } // namespace device
491 504
492 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 505 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698