2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file object_proxy.h
18 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
23 #ifndef DPL_DBUS_OBJECT_PROXY_H
24 #define DPL_DBUS_OBJECT_PROXY_H
28 #include <dpl/dbus/exception.h>
29 #include <dpl/dbus/method_proxy.h>
36 * Represents a remote object attached to a DBus service.
44 * Creates method proxy object.
46 * The object is used to call remote methods.
48 * @param interface Name of the DBus interface.
49 * @param name Name of the method to call.
50 * @return Proxy to remote method.
51 * @throw DBus::ConnectionClosedException If connection is closed.
53 template<typename Result, typename ... Args>
54 MethodProxyPtr<Result, Args ...> createMethodProxy(
55 const std::string& interface,
56 const std::string& name)
58 if (g_dbus_connection_is_closed(m_connection)) {
59 ThrowMsg(DBus::ConnectionClosedException, "Connection closed.");
62 return MethodProxyPtr<Result, Args ...>(
63 new MethodProxy<Result, Args ...>(m_connection,
71 friend class Connection;
73 ObjectProxy(GDBusConnection* connection,
74 const std::string& serviceName,
75 const std::string& objectPath);
77 GDBusConnection* m_connection;
78 std::string m_serviceName;
79 std::string m_objectPath;