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. | |
48 // It receives two arguments: the name of the error in |error_name| and | |
49 // an optional message in |error_message|. | |
50 using ErrorCallback = base::Callback<void(const std::string& error_name, | |
51 const std::string& error_message)>; | |
52 | |
53 // Registers an advertisement with the DBus object path |obj_path| with | |
Marie Janssen
2015/04/14 16:47:24
|advertisement_object_path| - also this can probab
rkc
2015/04/14 17:54:32
Done.
| |
54 // BlueZ's advertising manager. | |
55 virtual void RegisterAdvertisement( | |
56 const dbus::ObjectPath& manager_object_path, | |
57 const dbus::ObjectPath& advertisement_object_path, | |
58 const base::Closure& callback, | |
59 const ErrorCallback& error_callback) = 0; | |
60 | |
61 // Unregisters an advertisement with the DBus object path |obj_path| with | |
Marie Janssen
2015/04/14 16:47:24
ditto
rkc
2015/04/14 17:54:32
Done.
| |
62 // BlueZ's advertising manager. | |
63 virtual void UnregisterAdvertisement( | |
64 const dbus::ObjectPath& manager_object_path, | |
65 const dbus::ObjectPath& advertisement_object_path, | |
66 const base::Closure& callback, | |
67 const ErrorCallback& error_callback) = 0; | |
68 | |
69 // Creates the instance. | |
70 static BluetoothLEAdvertisingManagerClient* Create(); | |
71 | |
72 // Constants used to indicate exceptional error conditions. | |
73 static const char kNoResponseError[]; | |
74 | |
75 protected: | |
76 BluetoothLEAdvertisingManagerClient(); | |
77 | |
78 private: | |
79 DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisingManagerClient); | |
80 }; | |
81 | |
82 } // namespace chromeos | |
83 | |
84 #endif // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_ | |
OLD | NEW |