blob: d3324db9b6e14397305e1b2956cfb2186710c09e [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
17 // at |path| owned by |service|. Caught signals and asynchronous
18 // method replies will be dispatched to |delegate|.
19
20 DBusObjectManagerProxy(DBusObjectManagerProxyDelegate *delegate,
21 DBus::Connection *connection,
22 const std::string &path,
23 const std::string &service);
24 virtual ~DBusObjectManagerProxy();
25
26 // Inherited methods from DBusObjectManagerProxyInterface.
27 virtual void GetManagedObjects(AsyncCallHandler *call_handler, int timeout);
28
29 private:
30 class Proxy : public org::freedesktop::DBus::ObjectManager_proxy,
31 public DBus::ObjectProxy {
32 public:
33 Proxy(DBusObjectManagerProxyDelegate *delegate,
34 DBus::Connection *connection,
35 const std::string &path,
36 const std::string &service);
37 virtual ~Proxy();
38
39 private:
40 // Signal callbacks
41 virtual void InterfacesAdded(
42 const ::DBus::Path &object_path,
43 const DBusInterfaceToProperties &interfaces_and_properties);
44 virtual void InterfacesRemoved(const ::DBus::Path &object_path,
45 const std::vector<std::string> &interfaces);
46
47 // Method callbacks
48 virtual void GetManagedObjectsCallback(
49 const DBusObjectsWithProperties &objects_with_properties,
50 const DBus::Error &error,
51 void *call_handler);
52
53 DBusObjectManagerProxyDelegate *delegate_;
54
55 DISALLOW_COPY_AND_ASSIGN(Proxy);
56 };
57 Proxy proxy_;
58
59 DISALLOW_COPY_AND_ASSIGN(DBusObjectManagerProxy);
60};
61
62} // namespace shill
63
64#endif // SHILL_DBUS_OBJECTMANAGER_PROXY_H_