1 //
2 // Copyright (C) 2012 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_CELLULAR_DBUS_OBJECTMANAGER_PROXY_INTERFACE_H_
18 #define SHILL_CELLULAR_DBUS_OBJECTMANAGER_PROXY_INTERFACE_H_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include <base/callback.h>
25 
26 #include "shill/key_value_store.h"
27 
28 namespace shill {
29 
30 class Error;
31 
32 typedef std::map<std::string, KeyValueStore> InterfaceToProperties;
33 typedef std::map<std::string, InterfaceToProperties>
34     ObjectsWithProperties;
35 typedef base::Callback<void(const ObjectsWithProperties&, const Error&)>
36     ManagedObjectsCallback;
37 typedef base::Callback<void(const InterfaceToProperties&, const Error&)>
38     InterfaceAndPropertiesCallback;
39 typedef base::Callback<void(const std::string&,
40                             const InterfaceToProperties&)>
41     InterfacesAddedSignalCallback;
42 typedef base::Callback<void(const std::string&,
43                             const std::vector<std::string>&)>
44     InterfacesRemovedSignalCallback;
45 
46 // These are the methods that a org.freedesktop.DBus.ObjectManager
47 // proxy must support.  The interface is provided so that it can be
48 // mocked in tests.  All calls are made asynchronously. Call completion
49 // is signalled via the callbacks passed to the methods.
50 class DBusObjectManagerProxyInterface {
51  public:
~DBusObjectManagerProxyInterface()52   virtual ~DBusObjectManagerProxyInterface() {}
53   virtual void GetManagedObjects(Error* error,
54                                  const ManagedObjectsCallback& callback,
55                                  int timeout) = 0;
56   virtual void set_interfaces_added_callback(
57       const InterfacesAddedSignalCallback& callback) = 0;
58   virtual void set_interfaces_removed_callback(
59       const InterfacesRemovedSignalCallback& callback) = 0;
60 };
61 
62 }  // namespace shill
63 
64 #endif  // SHILL_CELLULAR_DBUS_OBJECTMANAGER_PROXY_INTERFACE_H_
65