| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_ | |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "device/bluetooth/bluetooth_adapter.h" | |
| 12 #include "device/bluetooth/bluetooth_advertisement.h" | |
| 13 #include "device/bluetooth/bluetooth_export.h" | |
| 14 #include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" | |
| 15 | |
| 16 namespace bluez { | |
| 17 class BluetoothLEAdvertisementServiceProvider; | |
| 18 } | |
| 19 | |
| 20 namespace bluez { | |
| 21 | |
| 22 class BluetoothAdapterBlueZ; | |
| 23 | |
| 24 // The BluetoothAdvertisementBlueZ class implements BluetoothAdvertisement | |
| 25 // for platforms that use BlueZ. | |
| 26 class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementBlueZ | |
| 27 : public device::BluetoothAdvertisement, | |
| 28 public bluez::BluetoothLEAdvertisementServiceProvider::Delegate { | |
| 29 public: | |
| 30 BluetoothAdvertisementBlueZ( | |
| 31 std::unique_ptr<device::BluetoothAdvertisement::Data> data, | |
| 32 scoped_refptr<BluetoothAdapterBlueZ> adapter); | |
| 33 | |
| 34 // BluetoothAdvertisement overrides: | |
| 35 void Unregister(const SuccessCallback& success_callback, | |
| 36 const ErrorCallback& error_callback) override; | |
| 37 | |
| 38 // bluez::BluetoothLEAdvertisementServiceProvider::Delegate overrides: | |
| 39 void Released() override; | |
| 40 | |
| 41 void Register( | |
| 42 const base::Closure& success_callback, | |
| 43 const device::BluetoothAdapter::CreateAdvertisementErrorCallback& | |
| 44 error_callback); | |
| 45 | |
| 46 // Used from tests to be able to trigger events on the fake advertisement | |
| 47 // provider. | |
| 48 bluez::BluetoothLEAdvertisementServiceProvider* provider() { | |
| 49 return provider_.get(); | |
| 50 } | |
| 51 | |
| 52 private: | |
| 53 ~BluetoothAdvertisementBlueZ() override; | |
| 54 | |
| 55 // Adapter this advertisement is advertising on. | |
| 56 scoped_refptr<BluetoothAdapterBlueZ> adapter_; | |
| 57 std::unique_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementBlueZ); | |
| 60 }; | |
| 61 | |
| 62 } // namespace bluez | |
| 63 | |
| 64 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_BLUEZ_H_ | |
| OLD | NEW |