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/nfc_property_set.h"
13 #include "dbus/object_path.h"
14 #include "dbus/object_proxy.h"
15 #include "dbus/property.h"
19 // NfcManagerClient is used to communicate with the neard Manager service.
20 class CHROMEOS_EXPORT NfcManagerClient
: public DBusClient
{
22 // Structure of properties associated with the NFC manager.
23 struct Properties
: public NfcPropertySet
{
24 // List of Adapter object paths.
25 dbus::Property
<std::vector
<dbus::ObjectPath
> > adapters
;
27 Properties(dbus::ObjectProxy
* object_proxy
,
28 const PropertyChangedCallback
& callback
);
29 ~Properties() override
;
32 // Interface for observing changes to the NFC manager. Use this interface
33 // to be notified when NFC adapters get added or removed.
34 // NOTE: Users of the NFC D-Bus client code shouldn't need to observe changes
35 // from NfcManagerClient::Observer; to get notified of changes to the list of
36 // NFC adapters, use NfcAdapterClient::Observer instead.
39 virtual ~Observer() {}
41 // Called when a new adapter with object path |object_path| is added to the
43 virtual void AdapterAdded(const dbus::ObjectPath
& object_path
) {}
45 // Called when an adapter with object path |object_path| is removed from the
47 virtual void AdapterRemoved(const dbus::ObjectPath
& object_path
) {}
49 // Called when the manager property with name |property_name| has acquired
51 virtual void ManagerPropertyChanged(const std::string
& property_name
) {}
54 ~NfcManagerClient() override
;
56 // Adds and removes observers for events on the NFC manager.
57 virtual void AddObserver(Observer
* observer
) = 0;
58 virtual void RemoveObserver(Observer
* observer
) = 0;
60 // Obtains the properties of the NFC manager service.
61 virtual Properties
* GetProperties() = 0;
63 // Creates the instance.
64 static NfcManagerClient
* Create();
67 friend class NfcClientTest
;
72 DISALLOW_COPY_AND_ASSIGN(NfcManagerClient
);
75 } // namespace chromeos
77 #endif // CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_