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_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
6 #define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/values.h" | |
14 #include "chromeos/chromeos_export.h" | |
15 #include "chromeos/dbus/dbus_client.h" | |
16 #include "dbus/object_path.h" | |
17 | |
18 namespace chromeos { | |
19 | |
20 // BluetoothAdvertisingManagerClient is used to communicate with the advertising | |
21 // manager object of the BlueZ daemon. | |
22 class CHROMEOS_EXPORT BluetoothLEAdvertisingManagerClient : public DBusClient { | |
23 public: | |
24 // Interface for observing changes to advertising managers. | |
25 class Observer { | |
26 public: | |
27 virtual ~Observer() {} | |
28 | |
29 // Called when an advertising manager with object path |object_path| is | |
30 // added to the system. | |
31 virtual void AdvertisingManagerAdded(const dbus::ObjectPath& object_path) {} | |
32 | |
33 // Called when an advertising manager with object path |object_path| is | |
34 // removed from the system. | |
35 virtual void AdvertisingManagerRemoved( | |
36 const dbus::ObjectPath& object_path) {} | |
37 }; | |
38 | |
39 ~BluetoothLEAdvertisingManagerClient() override; | |
40 | |
41 // Adds and removes observers for events which change the advertising | |
42 // managers on the system. | |
43 virtual void AddObserver(Observer* observer) = 0; | |
44 virtual void RemoveObserver(Observer* observer) = 0; | |
45 | |
46 // The ErrorCallback is used by advertising manager methods to indicate | |
47 // failure. It receives two arguments: the name of the error in |error_name| | |
48 // and an optional message in |error_message|. | |
49 using ErrorCallback = base::Callback<void(const std::string& error_name, | |
50 const std::string& error_message)>; | |
51 | |
52 // Registers an advertisement with the DBus object path | |
53 // |advertisement_object_path| with BlueZ's advertising manager. | |
54 virtual void RegisterAdvertisement( | |
55 const dbus::ObjectPath& manager_object_path, | |
56 const dbus::ObjectPath& advertisement_object_path, | |
57 const base::Closure& callback, | |
58 const ErrorCallback& error_callback) = 0; | |
59 | |
60 // Unregisters an advertisement with the DBus object path | |
61 // |advertisement_object_path| with BlueZ's advertising manager. | |
62 virtual void UnregisterAdvertisement( | |
63 const dbus::ObjectPath& manager_object_path, | |
64 const dbus::ObjectPath& advertisement_object_path, | |
65 const base::Closure& callback, | |
66 const ErrorCallback& error_callback) = 0; | |
67 | |
68 // Creates the instance. | |
69 static BluetoothLEAdvertisingManagerClient* Create(); | |
70 | |
71 // Constants used to indicate exceptional error conditions. | |
72 static const char kNoResponseError[]; | |
73 | |
74 protected: | |
75 BluetoothLEAdvertisingManagerClient(); | |
76 | |
77 private: | |
78 DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisingManagerClient); | |
79 }; | |
80 | |
81 } // namespace chromeos | |
82 | |
83 #endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
OLD | NEW |