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 #include "chromeos/dbus/nfc_property_set.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
12 NfcPropertySet::NfcPropertySet(dbus::ObjectProxy* object_proxy,
13 const std::string& interface,
14 const PropertyChangedCallback& callback)
15 : dbus::PropertySet(object_proxy, interface, callback) {
18 void NfcPropertySet::ConnectSignals() {
19 object_proxy()->ConnectToSignal(
21 nfc_common::kPropertyChangedSignal,
22 base::Bind(&dbus::PropertySet::ChangedReceived, GetWeakPtr()),
23 base::Bind(&dbus::PropertySet::ChangedConnected, GetWeakPtr()));
26 void NfcPropertySet::Get(dbus::PropertyBase* property,
27 GetCallback callback) {
28 NOTREACHED() << "neard does not implement Get for properties.";
31 void NfcPropertySet::GetAll() {
32 dbus::MethodCall method_call(
33 interface(), nfc_common::kGetProperties);
34 object_proxy()->CallMethod(&method_call,
35 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
36 base::Bind(&dbus::PropertySet::OnGetAll,
40 void NfcPropertySet::Set(dbus::PropertyBase* property,
41 SetCallback callback) {
42 dbus::MethodCall method_call(
43 interface(), nfc_common::kSetProperty);
44 object_proxy()->CallMethod(&method_call,
45 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
46 base::Bind(&dbus::PropertySet::OnSet,
52 void NfcPropertySet::ChangedReceived(dbus::Signal* signal) {
54 dbus::MessageReader reader(signal);
55 UpdatePropertyFromReader(&reader);
58 } // namespace chromeos