David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 1 | |
| 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 | |
| 12 | namespace shill { |
| 13 | |
| 14 | class DBusObjectManagerProxy : public DBusObjectManagerProxyInterface { |
| 15 | public: |
| 16 | // Constructs a org.freedesktop.DBus.ObjectManager DBus object proxy |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 17 | // at |path| owned by |service|. |
David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 18 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 19 | DBusObjectManagerProxy(DBus::Connection *connection, |
David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 20 | const std::string &path, |
| 21 | const std::string &service); |
| 22 | virtual ~DBusObjectManagerProxy(); |
| 23 | |
| 24 | // Inherited methods from DBusObjectManagerProxyInterface. |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 25 | 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 Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | class Proxy : public org::freedesktop::DBus::ObjectManager_proxy, |
| 36 | public DBus::ObjectProxy { |
| 37 | public: |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 38 | Proxy(DBus::Connection *connection, |
David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 39 | const std::string &path, |
| 40 | const std::string &service); |
| 41 | virtual ~Proxy(); |
| 42 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 43 | virtual void set_interfaces_added_callback( |
| 44 | const InterfacesAddedSignalCallback &callback); |
| 45 | virtual void set_interfaces_removed_callback( |
| 46 | const InterfacesRemovedSignalCallback &callback); |
| 47 | |
David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 48 | 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 Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 62 | InterfacesAddedSignalCallback interfaces_added_callback_; |
| 63 | InterfacesRemovedSignalCallback interfaces_removed_callback_; |
David Rochberg | b8b89b1 | 2012-02-28 16:11:33 -0500 | [diff] [blame] | 64 | |
| 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_ |