# Dependencies
SET(dependents
glib-2.0
+ gio-2.0
+ gio-unix-2.0
gmodule-2.0
libxml-2.0
dlog
# Check external libraries
INCLUDE(FindPkgConfig)
-pkg_check_modules(UC_LAUNCHER_EXT_LIBS REQUIRED glib-2.0 gthread-2.0 capi-appfw-application capi-system-info evas dlog ecore)
+pkg_check_modules(UC_LAUNCHER_EXT_LIBS REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 gthread-2.0 capi-appfw-application capi-system-info evas dlog ecore)
SET(EXTRA_CFLAGS "")
FOREACH(flag ${${UC_LAUNCHER_EXT_LIBS}_CFLAGS})
*/
#include "heremaps-uc-launcher.h"
+#include <gio/gio.h>
+
+#define UC_RECEIVER_NAME "org.tizen.lbs.Providers.HereMapsUCLauncher"
+
+GMainLoop *loop = NULL;
+
+static void on_bus_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data)
+{
+ LS_LOGD("HereMapsUCLauncher: Acquired the bus <%s>", name);
+
+ g_main_loop_quit(loop);
+ LS_LOGD("HereMapsUCLauncher: g_main_loop_quit");
+}
+
+static void on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ LS_LOGD("HereMapsUCLauncher: Acquired the name <%s> on the system bus", name);
+}
+
+static void on_name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ LS_LOGD("HereMapsUCLauncher: Lost the name <%s> on the system bus", name);
+}
static void launch_heremaps_uc()
{
app_control_send_launch_request(app_control, NULL, NULL);
app_control_destroy(app_control);
+ gchar *service_name = g_strdup(UC_RECEIVER_NAME);
+ guint owner_id = g_bus_own_name(G_BUS_TYPE_SESSION, service_name, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL);
+ LS_LOGD("g_bus_own_name id=[%d]", owner_id);
+
+ loop = g_main_loop_new(NULL, TRUE);
+
+ LS_LOGD("HereMapsUCLauncher: g_main_loop_quit");
+ g_main_loop_run(loop);
+
+ g_main_loop_unref(loop);
+ LS_LOGD("HereMapsUCLauncher: g_main_loop_unref");
+
+ g_bus_unown_name(owner_id);
+ LS_LOGD("g_bus_unown_name");
+
+ g_free(service_name);
+ LS_LOGD("g_free service_name");
+
+ loop = NULL;
+
LS_FUNC_EXIT
}
extern "C" {
#endif
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "HERE_PLUGIN"
+
#define MAPS_LOGD(fmt,args...) LOGD(fmt, ##args)
#define MAPS_LOGW(fmt,args...) LOGW(fmt, ##args)
#define MAPS_LOGI(fmt,args...) LOGI(fmt, ##args)
gchar *signal_path;
} heremaps_uc_dbus_s;
-static void heremaps_uc_ready_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
-{
- MAPS_FUNC_ENTER
-
- GError *error = NULL;
- g_dbus_proxy_new_finish(res, &error);
-}
-
EXPORT_API int heremaps_uc_dbus_launch_receiver()
{
MAPS_FUNC_ENTER
char *bus_addr = NULL;
GError *error = NULL;
+ GDBusProxy *proxy = NULL;
#if !GLIB_CHECK_VERSION(2, 35, 0)
g_type_init();
handle->signal_path = g_strdup_printf("%s/%s", handle->service_path, "SAMSUNG");
MAPS_LOGD("Object Path [%s]", handle->signal_path);
- g_dbus_proxy_new(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, UC_INTERFACE_NAME, NULL, heremaps_uc_ready_cb, NULL);
+ proxy = g_dbus_proxy_new_sync(handle->conn, G_DBUS_PROXY_FLAGS_NONE, NULL, handle->service_name, handle->signal_path, UC_INTERFACE_NAME, NULL, NULL);
+ if (proxy) {
+ MAPS_LOGD("proxy: %p", proxy);
+ g_object_unref(proxy);
+ } else {
+ if (error) {
+ MAPS_LOGD("Fail to get proxy Error[%s]", error->message);
+ g_error_free(error);
+ }
+ }
if (handle->conn) {
g_object_unref(handle->conn);