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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_NFC_PROPERTY_SET_H_
6 #define CHROMEOS_DBUS_NFC_PROPERTY_SET_H_
10 #include "base/callback.h"
11 #include "dbus/message.h"
12 #include "dbus/object_proxy.h"
13 #include "dbus/property.h"
17 // neard doesn't use the standard D-Bus interfaces for property access and
18 // instead defines property accessor methods in each D-Bus interface. This
19 // class customizes dbus::PropertySet to generate the correct method call to
20 // get all properties, connect to the correct signal and parse it correctly.
21 class NfcPropertySet
: public dbus::PropertySet
{
23 NfcPropertySet(dbus::ObjectProxy
* object_proxy
,
24 const std::string
& interface
,
25 const PropertyChangedCallback
& callback
);
27 // Destructor; we don't hold on to any references or memory that needs
28 // explicit clean-up, but clang thinks we might.
29 ~NfcPropertySet() override
;
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
);
35 // dbus::PropertySet overrides
36 void ConnectSignals() override
;
37 void Get(dbus::PropertyBase
* property
, GetCallback callback
) override
;
38 void GetAll() override
;
39 void OnGetAll(dbus::Response
* response
) override
;
40 void Set(dbus::PropertyBase
* property
, SetCallback callback
) override
;
41 void ChangedReceived(dbus::Signal
* signal
) override
;
44 const base::Closure
& on_get_all_callback() { return on_get_all_callback_
; }
47 // Optional callback used to notify clients when all properties were received
48 // after a call to GetAll.
49 base::Closure on_get_all_callback_
;
51 DISALLOW_COPY_AND_ASSIGN(NfcPropertySet
);
54 } // namespace chromeos
56 #endif // CHROMEOS_DBUS_NFC_PROPERTY_SET_H_