static int _enabler_proxy_init(comp_manager_s *handle)
{
- int ret = COMP_ERROR_NONE;
GError *error = NULL;
+ const gchar *name;
+ int ret;
+
handle->enabler_proxy = enabler_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE, COMP_DBUS_SERVICE,
COMP_DBUS_ENABLER_PATH, NULL, &error);
return COMP_ERROR_IO_ERROR;
/* LCOV_EXCL_STOP */
}
+
+ handle->system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (NULL == handle->system_bus) {
+ /* LCOV_EXCL_START */
+ if (error != NULL) {
+ _ERR("Failed to connect to system bus [%s]", error->message);
+ g_error_free(error);
+ }
+ return COMP_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
+ }
+
+ name = g_dbus_connection_get_unique_name(handle->system_bus);
+ _DBG("Unique dbus name %s", name);
+
+ enabler_call_add_ref_sync(handle->enabler_proxy, name, &ret, NULL, &error);
+ if (error) {
+ /* LCOV_EXCL_START */
+ _ERR("Failed to add reference [%s]", error->message);
+ g_error_free(error);
+ return COMP_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
+ }
+
return ret;
}
static void _enabler_proxy_deinit(comp_manager_s *handle)
{
- int ret;
+ g_object_unref(handle->system_bus);
+ handle->system_bus = NULL;
- enabler_call_disable_sync(handle->enabler_proxy, &ret, NULL, NULL);
g_object_unref(handle->enabler_proxy);
handle->enabler_proxy = NULL;
}
Group *group_proxy; /**< To receive signal from companion-manager */
Enabler *enabler_proxy; /**< Enbler proxy */
+ GDBusConnection *system_bus; /**< GDBus System Bus */
group_found_cb_t group_found_cb; /**< When it called after finding a every single group */
group_find_finish_cb_t group_find_finish_cb; /**< When it called the group finging time is up */