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