OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
| 5 #define DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
| 6 |
| 7 #include <memory> |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "device/bluetooth/bluetooth_adapter.h" |
| 12 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 |
| 15 namespace bluetooth { |
| 16 |
| 17 // Implementation of FakeCentral in |
| 18 // src/device/bluetooth/public/interfaces/test/fake_bluetooth.mojom. |
| 19 // Implemented on top of the C++ device/bluetooth API, mainly |
| 20 // device/bluetooth/bluetooth_adapter.h. |
| 21 class FakeCentral : NON_EXPORTED_BASE(public mojom::FakeCentral), |
| 22 public device::BluetoothAdapter { |
| 23 public: |
| 24 FakeCentral(mojom::CentralState state, mojom::FakeCentralRequest request); |
| 25 |
| 26 // BluetoothAdapter overrides: |
| 27 std::string GetAddress() const override; |
| 28 std::string GetName() const override; |
| 29 void SetName(const std::string& name, |
| 30 const base::Closure& callback, |
| 31 const ErrorCallback& error_callback) override; |
| 32 bool IsInitialized() const override; |
| 33 bool IsPresent() const override; |
| 34 bool IsPowered() const override; |
| 35 void SetPowered(bool powered, |
| 36 const base::Closure& callback, |
| 37 const ErrorCallback& error_callback) override; |
| 38 bool IsDiscoverable() const override; |
| 39 void SetDiscoverable(bool discoverable, |
| 40 const base::Closure& callback, |
| 41 const ErrorCallback& error_callback) override; |
| 42 bool IsDiscovering() const override; |
| 43 UUIDList GetUUIDs() const override; |
| 44 void CreateRfcommService( |
| 45 const device::BluetoothUUID& uuid, |
| 46 const ServiceOptions& options, |
| 47 const CreateServiceCallback& callback, |
| 48 const CreateServiceErrorCallback& error_callback) override; |
| 49 void CreateL2capService( |
| 50 const device::BluetoothUUID& uuid, |
| 51 const ServiceOptions& options, |
| 52 const CreateServiceCallback& callback, |
| 53 const CreateServiceErrorCallback& error_callback) override; |
| 54 void RegisterAdvertisement( |
| 55 std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement_data, |
| 56 const CreateAdvertisementCallback& callback, |
| 57 const AdvertisementErrorCallback& error_callback) override; |
| 58 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 59 void SetAdvertisingInterval( |
| 60 const base::TimeDelta& min, |
| 61 const base::TimeDelta& max, |
| 62 const base::Closure& callback, |
| 63 const AdvertisementErrorCallback& error_callback) override; |
| 64 #endif |
| 65 device::BluetoothLocalGattService* GetGattService( |
| 66 const std::string& identifier) const override; |
| 67 void AddDiscoverySession( |
| 68 device::BluetoothDiscoveryFilter* discovery_filter, |
| 69 const base::Closure& callback, |
| 70 const DiscoverySessionErrorCallback& error_callback) override; |
| 71 void RemoveDiscoverySession( |
| 72 device::BluetoothDiscoveryFilter* discovery_filter, |
| 73 const base::Closure& callback, |
| 74 const DiscoverySessionErrorCallback& error_callback) override; |
| 75 void SetDiscoveryFilter( |
| 76 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter, |
| 77 const base::Closure& callback, |
| 78 const DiscoverySessionErrorCallback& error_callback) override; |
| 79 void RemovePairingDelegateInternal( |
| 80 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| 81 |
| 82 private: |
| 83 ~FakeCentral() override; |
| 84 |
| 85 mojom::CentralState state_; |
| 86 mojo::Binding<mojom::FakeCentral> binding_; |
| 87 }; |
| 88 |
| 89 } // namespace bluetooth |
| 90 |
| 91 #endif // DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
OLD | NEW |