blob: 203f2355215fe36d50b6356954b8889ef9bb7c7b [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "base/callback.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
#include "dbus/property.h"
namespace chromeos {
// neard doesn't use the standard D-Bus interfaces for property access and
// instead defines property accessor methods in each D-Bus interface. This
// class customizes dbus::PropertySet to generate the correct method call to
// get all properties, connect to the correct signal and parse it correctly.
class NfcPropertySet : public dbus::PropertySet {
NfcPropertySet(dbus::ObjectProxy* object_proxy,
const std::string& interface,
const PropertyChangedCallback& callback);
// Destructor; we don't hold on to any references or memory that needs
// explicit clean-up, but clang thinks we might.
virtual ~NfcPropertySet();
// Caches |callback| so that it will be invoked after a call to GetAll()
// has successfully received all existing properties from the remote object.
void SetAllPropertiesReceivedCallback(const base::Closure& callback);
// dbus::PropertySet overrides
virtual void ConnectSignals() OVERRIDE;
virtual void Get(dbus::PropertyBase* property,
GetCallback callback) OVERRIDE;
virtual void GetAll() OVERRIDE;
virtual void OnGetAll(dbus::Response* response) OVERRIDE;
virtual void Set(dbus::PropertyBase* property,
SetCallback callback) OVERRIDE;
virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE;
const base::Closure& on_get_all_callback() { return on_get_all_callback_; }
// Optional callback used to notify clients when all properties were received
// after a call to GetAll.
base::Closure on_get_all_callback_;
} // namespace chromeos