| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ | 5 #ifndef CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ |
| 6 #define CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ | 6 #define CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "dbus/message.h" | 11 #include "dbus/message.h" |
| 11 #include "dbus/object_proxy.h" | 12 #include "dbus/object_proxy.h" |
| 12 #include "dbus/property.h" | 13 #include "dbus/property.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 // neard doesn't use the standard D-Bus interfaces for property access and | 17 // neard doesn't use the standard D-Bus interfaces for property access and |
| 17 // instead defines property accessor methods in each D-Bus interface. This | 18 // instead defines property accessor methods in each D-Bus interface. This |
| 18 // class customizes dbus::PropertySet to generate the correct method call to | 19 // class customizes dbus::PropertySet to generate the correct method call to |
| 19 // get all properties, connect to the correct signal and parse it correctly. | 20 // get all properties, connect to the correct signal and parse it correctly. |
| 20 class NfcPropertySet : public dbus::PropertySet { | 21 class NfcPropertySet : public dbus::PropertySet { |
| 21 public: | 22 public: |
| 22 NfcPropertySet(dbus::ObjectProxy* object_proxy, | 23 NfcPropertySet(dbus::ObjectProxy* object_proxy, |
| 23 const std::string& interface, | 24 const std::string& interface, |
| 24 const PropertyChangedCallback& callback); | 25 const PropertyChangedCallback& callback); |
| 25 | 26 |
| 27 // Destructor; we don't hold on to any references or memory that needs |
| 28 // explicit clean-up, but clang thinks we might. |
| 29 virtual ~NfcPropertySet(); |
| 30 |
| 31 // Caches |callback| so that it will be invoked after a call to GetAll() |
| 32 // has successfully received all existing properties from the remote object. |
| 33 void SetAllPropertiesReceivedCallback(const base::Closure& callback); |
| 34 |
| 26 // dbus::PropertySet overrides | 35 // dbus::PropertySet overrides |
| 27 virtual void ConnectSignals() OVERRIDE; | 36 virtual void ConnectSignals() OVERRIDE; |
| 28 virtual void Get(dbus::PropertyBase* property, | 37 virtual void Get(dbus::PropertyBase* property, |
| 29 GetCallback callback) OVERRIDE; | 38 GetCallback callback) OVERRIDE; |
| 30 virtual void GetAll() OVERRIDE; | 39 virtual void GetAll() OVERRIDE; |
| 40 virtual void OnGetAll(dbus::Response* response) OVERRIDE; |
| 31 virtual void Set(dbus::PropertyBase* property, | 41 virtual void Set(dbus::PropertyBase* property, |
| 32 SetCallback callback) OVERRIDE; | 42 SetCallback callback) OVERRIDE; |
| 33 virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE; | 43 virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE; |
| 34 | 44 |
| 35 private: | 45 private: |
| 46 // Optional callback used to notify clients when all properties were received |
| 47 // after a call to GetAll. |
| 48 base::Closure on_get_all_callback_; |
| 49 |
| 36 DISALLOW_COPY_AND_ASSIGN(NfcPropertySet); | 50 DISALLOW_COPY_AND_ASSIGN(NfcPropertySet); |
| 37 }; | 51 }; |
| 38 | 52 |
| 39 } // namespace chromeos | 53 } // namespace chromeos |
| 40 | 54 |
| 41 #endif // CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ | 55 #endif // CHROMEOS_DBUS_NFC_PROPERTY_SET_H_ |
| OLD | NEW |