blob: 6a5eb388d61fdda3e5c18450187bdbc42184903a [file] [log] [blame]
David Rochbergb8b89b12012-02-28 16:11:33 -05001
2// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5#ifndef SHILL_DBUS_OBJECTMANAGER_PROXY_H_
6#define SHILL_DBUS_OBJECTMANAGER_PROXY_H_
7#include <string>
8
9#include "shill/dbus_objectmanager_proxy_interface.h"
10#include "shill/dbus_bindings/dbus-objectmanager.h"
11
12namespace shill {
13
14class DBusObjectManagerProxy : public DBusObjectManagerProxyInterface {
15 public:
16 // Constructs a org.freedesktop.DBus.ObjectManager DBus object proxy
Eric Shienbrood9a245532012-03-07 14:20:39 -050017 // at |path| owned by |service|.
David Rochbergb8b89b12012-02-28 16:11:33 -050018
Eric Shienbrood9a245532012-03-07 14:20:39 -050019 DBusObjectManagerProxy(DBus::Connection *connection,
David Rochbergb8b89b12012-02-28 16:11:33 -050020 const std::string &path,
21 const std::string &service);
22 virtual ~DBusObjectManagerProxy();
23
24 // Inherited methods from DBusObjectManagerProxyInterface.
Eric Shienbrood9a245532012-03-07 14:20:39 -050025 virtual void GetManagedObjects(Error *error,
26 const ManagedObjectsCallback &callback,
27 int timeout);
28
29 virtual void set_interfaces_added_callback(
30 const InterfacesAddedSignalCallback &callback);
31 virtual void set_interfaces_removed_callback(
32 const InterfacesRemovedSignalCallback &callback);
David Rochbergb8b89b12012-02-28 16:11:33 -050033
34 private:
35 class Proxy : public org::freedesktop::DBus::ObjectManager_proxy,
36 public DBus::ObjectProxy {
37 public:
Eric Shienbrood9a245532012-03-07 14:20:39 -050038 Proxy(DBus::Connection *connection,
David Rochbergb8b89b12012-02-28 16:11:33 -050039 const std::string &path,
40 const std::string &service);
41 virtual ~Proxy();
42
Eric Shienbrood9a245532012-03-07 14:20:39 -050043 virtual void set_interfaces_added_callback(
44 const InterfacesAddedSignalCallback &callback);
45 virtual void set_interfaces_removed_callback(
46 const InterfacesRemovedSignalCallback &callback);
47
David Rochbergb8b89b12012-02-28 16:11:33 -050048 private:
49 // Signal callbacks
50 virtual void InterfacesAdded(
51 const ::DBus::Path &object_path,
52 const DBusInterfaceToProperties &interfaces_and_properties);
53 virtual void InterfacesRemoved(const ::DBus::Path &object_path,
54 const std::vector<std::string> &interfaces);
55
56 // Method callbacks
57 virtual void GetManagedObjectsCallback(
58 const DBusObjectsWithProperties &objects_with_properties,
59 const DBus::Error &error,
60 void *call_handler);
61
Eric Shienbrood9a245532012-03-07 14:20:39 -050062 InterfacesAddedSignalCallback interfaces_added_callback_;
63 InterfacesRemovedSignalCallback interfaces_removed_callback_;
David Rochbergb8b89b12012-02-28 16:11:33 -050064
65 DISALLOW_COPY_AND_ASSIGN(Proxy);
66 };
67 Proxy proxy_;
68
69 DISALLOW_COPY_AND_ASSIGN(DBusObjectManagerProxy);
70};
71
72} // namespace shill
73
74#endif // SHILL_DBUS_OBJECTMANAGER_PROXY_H_