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.
18 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
23 #ifndef DPL_DBUS_INTERFACE_H
24 #define DPL_DBUS_INTERFACE_H
29 #include <dpl/noncopyable.h>
30 #include <dpl/dbus/dispatcher.h>
35 typedef std::shared_ptr<Interface> InterfacePtr;
37 class Interface : private DPL::Noncopyable
41 * Parses supplied XML string to produce DBus interface descriptions.
43 * @param xmlString XML string to parse.
45 * @throw DPL::DBus::Exception If error while parsing occurs.
47 static std::vector<InterfacePtr> fromXMLString(
48 const std::string& xmlString);
54 * Gets pointers to functions called on method call or property get/set
57 * @return Pointers to functions.
59 const GDBusInterfaceVTable* getVTable() const;
62 * Gets interface description.
64 * @return Interface description.
66 GDBusInterfaceInfo* getInfo() const;
69 * Sets method/property dispatcher for the interface.
71 * @param dispatcher Method call and property get/set dispatcher.
73 void setDispatcher(Dispatcher* dispatcher);
76 static void onMethodCallFunc(GDBusConnection *connection,
78 const gchar *objectPath,
79 const gchar *interfaceName,
80 const gchar *methodName,
82 GDBusMethodInvocation *invocation,
85 static GVariant* onPropertyGetFunc(GDBusConnection *connection,
87 const gchar *objectPath,
88 const gchar *interfaceName,
89 const gchar *propertyName,
93 static gboolean onPropertySetFunc(GDBusConnection *connection,
95 const gchar *objectPath,
96 const gchar *interfaceName,
97 const gchar *propertyName,
102 explicit Interface(GDBusInterfaceInfo* info);
104 static const GDBusInterfaceVTable m_vTable;
106 GDBusInterfaceInfo* m_info;
108 Dispatcher* m_dispatcher;
113 #endif // DPL_DBUS_INTERFACE_H