4 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 int register_dbus_signal(const char *object,
23 const char *iface, const char *signal,
24 GDBusSignalCallback callback, void *data, int *id)
27 GDBusConnection *conn;
30 #if !GLIB_CHECK_VERSION(2, 35, 0)
34 conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
36 _E("fail to get dbus connection : %s", err->message);
41 /* subscribe signal */
42 sid = g_dbus_connection_signal_subscribe(conn,
43 NULL, iface, signal, object,
44 NULL, G_DBUS_SIGNAL_FLAGS_NONE,
45 callback, data, NULL);
47 _E("fail to connect %s signal", signal);
57 void unregister_dbus_signal(int *id)
60 GDBusConnection *conn;
65 conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
67 _E("fail to get dbus connection : %s", err->message);
72 /* unsubscribe signal */
73 g_dbus_connection_signal_unsubscribe(conn, *id);