- add sources.
[platform/framework/web/crosswalk.git] / src / chromeos / dbus / nfc_manager_client.h
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.
4
5 #ifndef CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_
7
8 #include <vector>
9
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"
17
18 namespace chromeos {
19
20 // NfcManagerClient is used to communicate with the neard Manager service.
21 class CHROMEOS_EXPORT NfcManagerClient : public DBusClient {
22  public:
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;
27
28     Properties(dbus::ObjectProxy* object_proxy,
29                const PropertyChangedCallback& callback);
30     virtual ~Properties();
31   };
32
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.
38   class Observer {
39    public:
40     virtual ~Observer() {}
41
42     // Called when a new adapter with object path |object_path| is added to the
43     // system.
44     virtual void AdapterAdded(const dbus::ObjectPath& object_path) {}
45
46     // Called when an adapter with object path |object_path| is removed from the
47     // system.
48     virtual void AdapterRemoved(const dbus::ObjectPath& object_path) {}
49
50     // Called when the manager property with name |property_name| has acquired
51     // a new value.
52     virtual void ManagerPropertyChanged(const std::string& property_name) {}
53   };
54
55   virtual ~NfcManagerClient();
56
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;
60
61   // Obtains the properties of the NFC manager service.
62   virtual Properties* GetProperties() = 0;
63
64   // Creates the instance.
65   static NfcManagerClient* Create(DBusClientImplementationType type);
66
67  protected:
68   friend class NfcClientTest;
69
70   NfcManagerClient();
71
72  private:
73   DISALLOW_COPY_AND_ASSIGN(NfcManagerClient);
74 };
75
76 }  // namespace chromeos
77
78 #endif  // CHROMEOS_DBUS_NFC_MANAGER_CLIENT_H_