OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_PROPERTY_H_ | |
6 #define CHROMEOS_DBUS_BLUETOOTH_PROPERTY_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "dbus/message.h" | |
12 #include "dbus/object_proxy.h" | |
13 #include "dbus/property.h" | |
14 #include "third_party/cros_system_api/dbus/service_constants.h" | |
15 | |
16 namespace chromeos { | |
17 | |
18 // BlueZ predates the common D-Bus Properties API (though it inspired it), | |
19 // override dbus::PropertySet to generate the correct method call to get | |
20 // all properties, conenect to the correct signal and parse it correctly. | |
21 class BluetoothPropertySet : public dbus::PropertySet { | |
22 public: | |
23 BluetoothPropertySet(dbus::ObjectProxy* object_proxy, | |
24 const std::string& interface, | |
25 const PropertyChangedCallback& callback) | |
26 : dbus::PropertySet(object_proxy, interface, callback) {} | |
27 | |
28 // dbus::PropertySet override. | |
29 // | |
30 // Call after construction to connect property change notification | |
31 // signals. Sub-classes may override to use different D-Bus signals. | |
32 virtual void ConnectSignals() OVERRIDE; | |
33 | |
34 // dbus::PropertySet override. | |
35 // | |
36 // Requests an updated value from the remote object incurring a round-trip. | |
37 virtual void Get(dbus::PropertyBase* property, | |
38 GetCallback callback) OVERRIDE; | |
39 | |
40 // dbus::PropertySet override. | |
41 // | |
42 // Queries the remote object for values of all properties and updates | |
43 // initial values. | |
44 virtual void GetAll() OVERRIDE; | |
45 | |
46 // dbus::PropertySet override. | |
47 // | |
48 // Requests that the remote object change the property to its new value. | |
49 virtual void Set(dbus::PropertyBase* property, | |
50 SetCallback callback) OVERRIDE; | |
51 | |
52 // dbus::PropertySet override. | |
53 // | |
54 // Method connected by ConnectSignals() and called by dbus:: when | |
55 // a property is changed. | |
56 virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE; | |
57 }; | |
58 | |
59 } // namespace chromeos | |
60 | |
61 #endif // CHROMEOS_DBUS_BLUETOOTH_PROPERTY_H_ | |
OLD | NEW |