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 CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/bind.h" | |
12 #include "base/callback.h" | |
13 #include "base/observer_list.h" | |
14 #include "bluetooth_le_advertising_manager_client.h" | |
15 #include "chromeos/chromeos_export.h" | |
16 #include "dbus/object_path.h" | |
17 #include "dbus/property.h" | |
18 | |
19 namespace chromeos { | |
20 | |
21 class FakeBluetoothLEAdvertisementServiceProvider; | |
22 | |
23 // FakeBluetoothAdvertisementManagerClient simulates the behavior of the | |
24 // Bluetooth | |
25 // Daemon's profile manager object and is used both in test cases in place of a | |
26 // mock and on the Linux desktop. | |
27 class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient | |
28 : public BluetoothLEAdvertisingManagerClient { | |
29 public: | |
30 FakeBluetoothLEAdvertisingManagerClient(); | |
31 ~FakeBluetoothLEAdvertisingManagerClient() override; | |
32 | |
33 // BluetoothAdapterClient overrides: | |
armansito
2015/04/15 23:56:49
nit: Did you mean BluetoothAdvertisingManagerClien
rkc
2015/04/16 18:13:06
Done.
| |
34 void AddObserver(Observer* observer) override {} | |
35 void RemoveObserver(Observer* observer) override {} | |
36 | |
37 // DBusClient overrides: | |
38 void Init(dbus::Bus* bus) override {} | |
armansito
2015/04/15 23:56:49
nit: Just add empty definitions for these in the s
rkc
2015/04/16 18:13:06
Done.
| |
39 | |
40 // BluetoothAdvertisingManagerClient overrides: | |
41 void RegisterAdvertisement(const dbus::ObjectPath& manager_object_path, | |
42 const dbus::ObjectPath& advertisement_object_path, | |
43 const base::Closure& callback, | |
44 const ErrorCallback& error_callback) override; | |
45 | |
46 // Unregisters an advertisement with the DBus object path |obj_path| with | |
47 // BlueZ's advertisement manager. | |
48 void UnregisterAdvertisement( | |
49 const dbus::ObjectPath& manager_object_path, | |
50 const dbus::ObjectPath& advertisement_object_path, | |
51 const base::Closure& callback, | |
52 const ErrorCallback& error_callback) override; | |
53 | |
54 // Register, unregister and retrieve pointers to profile server providers. | |
55 void RegisterAdvertisementServiceProvider( | |
56 FakeBluetoothLEAdvertisementServiceProvider* service_provider); | |
57 void UnregisterAdvertisementServiceProvider( | |
58 FakeBluetoothLEAdvertisementServiceProvider* service_provider); | |
59 FakeBluetoothLEAdvertisementServiceProvider* GetAdvertisementServiceProvider( | |
60 const std::string& uuid); | |
61 | |
62 // Advertising manager path that we simulate. | |
63 static const char kAdvertisingManagerPath[]; | |
64 | |
65 private: | |
66 // Map of a D-Bus object path to the FakeBluetoothAdvertisementServiceProvider | |
67 // registered for it; maintained by RegisterAdvertisementServiceProvider() and | |
68 // UnregisterProfileServiceProvicer() called by the constructor and | |
69 // destructor of FakeBluetoothAdvertisementServiceProvider. | |
70 typedef std::map<dbus::ObjectPath, | |
71 FakeBluetoothLEAdvertisementServiceProvider*> | |
72 ServiceProviderMap; | |
73 ServiceProviderMap service_provider_map_; | |
74 | |
75 dbus::ObjectPath currently_registered_; | |
armansito
2015/04/15 23:56:49
Add a comment explaining what this variable does.
rkc
2015/04/16 18:13:05
Done.
| |
76 | |
77 // Map of Profile UUID to the D-Bus object path of the service provider | |
78 // in |service_provider_map_|. Maintained by RegisterProfile() and | |
79 // UnregisterProfile() in response to BluetoothProfile methods. | |
80 typedef std::map<std::string, dbus::ObjectPath> ProfileMap; | |
81 ProfileMap profile_map_; | |
armansito
2015/04/15 23:56:49
Remove this whole copy-pasta.
rkc
2015/04/16 18:13:06
Done.
| |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient); | |
84 }; | |
85 | |
86 } // namespace chromeos | |
87 | |
88 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
OLD | NEW |