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_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_
10 #include "chromeos/chromeos_export.h"
11 #include "chromeos/dbus/dbus_client.h"
12 #include "chromeos/dbus/dbus_client_implementation_type.h"
13 #include "chromeos/dbus/nfc_property_set.h"
14 #include "dbus/object_path.h"
15 #include "dbus/object_proxy.h"
16 #include "dbus/property.h"
20 // NfcManagerClient is used to communicate with the neard Manager service.
21 class CHROMEOS_EXPORT NfcManagerClient
: public DBusClient
{
23 // Structure of properties associated with the NFC manager.
24 struct Properties
: public NfcPropertySet
{
25 // List of Adapter object paths.
26 dbus::Property
<std::vector
<dbus::ObjectPath
> > adapters
;
28 Properties(dbus::ObjectProxy
* object_proxy
,
29 const PropertyChangedCallback
& callback
);
30 virtual ~Properties();
33 // Interface for observing changes to the NFC manager. Use this interface
34 // to be notified when NFC adapters get added or removed.
35 // NOTE: Users of the NFC D-Bus client code shouldn't need to observe changes
36 // from NfcManagerClient::Observer; to get notified of changes to the list of
37 // NFC adapters, use NfcAdapterClient::Observer instead.
40 virtual ~Observer() {}
42 // Called when a new adapter with object path |object_path| is added to the
44 virtual void AdapterAdded(const dbus::ObjectPath
& object_path
) {}
46 // Called when an adapter with object path |object_path| is removed from the
48 virtual void AdapterRemoved(const dbus::ObjectPath
& object_path
) {}
50 // Called when the manager property with name |property_name| has acquired
52 virtual void ManagerPropertyChanged(const std::string
& property_name
) {}
55 virtual ~NfcManagerClient();
57 // Adds and removes observers for events on the NFC manager.
58 virtual void AddObserver(Observer
* observer
) = 0;
59 virtual void RemoveObserver(Observer
* observer
) = 0;
61 // Obtains the properties of the NFC manager service.
62 virtual Properties
* GetProperties() = 0;
64 // Creates the instance.
65 static NfcManagerClient
* Create(DBusClientImplementationType type
);
68 friend class NfcClientTest
;
73 DISALLOW_COPY_AND_ASSIGN(NfcManagerClient
);
76 } // namespace chromeos
78 #endif // CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_