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>
36 typedef std::shared_ptr<Interface> InterfacePtr;
38 class Interface : private DPL::Noncopyable
42 * Parses supplied XML string to produce DBus interface descriptions.
44 * @param xmlString XML string to parse.
46 * @throw DPL::DBus::Exception If error while parsing occurs.
48 static std::vector<InterfacePtr> fromXMLString(
49 const std::string& xmlString);
55 * Gets pointers to functions called on method call or property get/set
58 * @return Pointers to functions.
60 const GDBusInterfaceVTable* getVTable() const;
63 * Gets interface description.
65 * @return Interface description.
67 GDBusInterfaceInfo* getInfo() const;
70 * Sets method/property dispatcher for the interface.
72 * @param dispatcher Method call and property get/set dispatcher.
74 void setDispatcher(Dispatcher* dispatcher);
77 static void onMethodCallFunc(GDBusConnection *connection,
79 const gchar *objectPath,
80 const gchar *interfaceName,
81 const gchar *methodName,
83 GDBusMethodInvocation *invocation,
86 static GVariant* onPropertyGetFunc(GDBusConnection *connection,
88 const gchar *objectPath,
89 const gchar *interfaceName,
90 const gchar *propertyName,
94 static gboolean onPropertySetFunc(GDBusConnection *connection,
96 const gchar *objectPath,
97 const gchar *interfaceName,
98 const gchar *propertyName,
103 explicit Interface(GDBusInterfaceInfo* info);
105 static const GDBusInterfaceVTable m_vTable;
107 GDBusInterfaceInfo* m_info;
109 Dispatcher* m_dispatcher;
115 #endif // DPL_DBUS_INTERFACE_H