change heremaps-uc to use dbus 85/62285/1 accepted/tizen/common/20160315.221741 accepted/tizen/ivi/20160315.123906 accepted/tizen/mobile/20160315.123805 accepted/tizen/tv/20160315.123824 accepted/tizen/wearable/20160315.123846 submit/tizen/20160315.083823
authorjomui <jongmun.woo@samsung.com>
Tue, 15 Mar 2016 07:50:24 +0000 (16:50 +0900)
committerjomui <jongmun.woo@samsung.com>
Tue, 15 Mar 2016 07:50:45 +0000 (16:50 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: I2c0b81b7a324fa69b4f93d082e66e498bc7624ea

17 files changed:
CMakeLists.txt
heremaps-uc-launcher/CMakeLists.txt [new file with mode: 0644]
heremaps-uc-launcher/config/heremaps-uc-launcher.conf [new file with mode: 0644]
heremaps-uc-launcher/heremaps-uc-launcher.manifest [new file with mode: 0644]
heremaps-uc-launcher/org.tizen.lbs.Providers.HereMapsUCLauncher.service.in [new file with mode: 0644]
heremaps-uc-launcher/src/CMakeLists.txt [new file with mode: 0644]
heremaps-uc-launcher/src/heremaps-uc-launcher.c [new file with mode: 0644]
heremaps-uc-launcher/src/heremaps-uc-launcher.h [new file with mode: 0644]
heremaps-uc/org.tizen.heremaps-uc.manifest
heremaps-uc/src/heremaps-uc-common.h
heremaps-uc/src/heremaps-uc.c
inc/here_manager.h
inc/heremaps-uc-dbus.h [new file with mode: 0644]
packaging/heremaps-uc-launcher.service [new file with mode: 0644]
packaging/maps-plugin-here.spec
src/here_manager.cpp
src/heremaps-uc-dbus.c [new file with mode: 0644]

index ab5a7ecd2269f3bdecd7ec7ffe7af8cd2920932c..d037aad6720cd14e5eb7b652ee868b4f9506d7cf 100644 (file)
@@ -4,9 +4,10 @@ PROJECT(${pkg_name} C CXX)
 
 SET(CMAKE_INSTALL_PREFIX /usr)
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(LIBDIR ${LIBDIR})
 
 # Dependencies
-SET(dependents "glib-2.0 gmodule-2.0 libxml-2.0 dlog capi-network-connection capi-appfw-app-manager capi-maps-service capi-appfw-application")
+SET(dependents "glib-2.0 gmodule-2.0 libxml-2.0 dlog capi-network-connection capi-appfw-app-manager capi-maps-service capi-appfw-application vconf")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED ${dependents})
@@ -35,6 +36,9 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
 SET(INC_DIR
        inc
        inc/engine
+
+       # UC-DBus
+       heremaps-uc-dbus/include
 )
 
 INCLUDE_DIRECTORIES(
@@ -58,6 +62,9 @@ SET(SRCS
        src/here_multirevgeocode.cpp
        src/here_route.cpp
        src/here_utils.cpp
+
+       # UC-DBus
+       src/heremaps-uc-dbus.c
 )
 
 ADD_LIBRARY(${pkg_name} SHARED ${SRCS})
@@ -82,3 +89,4 @@ INSTALL(FILES lib/${ARCH}/libheremaps-engine.so DESTINATION lib)
 #ENDIF("${BINTYPE}" STREQUAL "eng")
 
 ADD_SUBDIRECTORY(heremaps-uc)
+ADD_SUBDIRECTORY(heremaps-uc-launcher)
\ No newline at end of file
diff --git a/heremaps-uc-launcher/CMakeLists.txt b/heremaps-uc-launcher/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a535b32
--- /dev/null
@@ -0,0 +1,45 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(heremaps-uc-launcher C)
+SET(PKG_NAME heremaps-uc-launcher)
+
+# Version control
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.0.1")
+
+# Architecture
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-D_SOUND_EQ_ARCH_ARM_")
+ENDIF()
+
+SET(COMMON_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+
+SET(UC_LAUNCHER_PREFIX /usr)
+SET(BINDIR "${UC_LAUNCHER_PREFIX}/bin")
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+INCLUDE(FindPkgConfig)
+
+CONFIGURE_FILE(org.tizen.lbs.Providers.HereMapsUCLauncher.service.in org.tizen.lbs.Providers.HereMapsUCLauncher.service @ONLY)
+INSTALL(FILES org.tizen.lbs.Providers.HereMapsUCLauncher.service DESTINATION /usr/share/dbus-1/services)
+INSTALL(FILES config/heremaps-uc-launcher.conf DESTINATION ${SYSCONF_DIR}/dbus-1/session.d)
+
+# 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)
+
+SET(EXTRA_CFLAGS "")
+FOREACH(flag ${${UC_LAUNCHER_EXT_LIBS}_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${COMMON_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_DEFINITIONS("-DUC_LAUNCHER_PKG=\"${PKG_NAME}\"")
+
+ADD_SUBDIRECTORY(src)
diff --git a/heremaps-uc-launcher/config/heremaps-uc-launcher.conf b/heremaps-uc-launcher/config/heremaps-uc-launcher.conf
new file mode 100644 (file)
index 0000000..608cb59
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+       <!-- root can own the service -->
+       <policy user="root">
+               <allow own="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+
+               <!-- Allow all methods on interfaces -->
+               <allow send_destination="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+               <allow receive_sender="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+       </policy>
+
+       <policy user="system">
+               <allow own="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+               <allow send_destination="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+               <allow receive_sender="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+       </policy>
+
+       <policy context="default">
+               <allow own="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+               <allow send_destination="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+               <allow receive_sender="org.tizen.lbs.Providers.HereMapsUCLauncher"/>
+       </policy>
+</busconfig>
diff --git a/heremaps-uc-launcher/heremaps-uc-launcher.manifest b/heremaps-uc-launcher/heremaps-uc-launcher.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/heremaps-uc-launcher/org.tizen.lbs.Providers.HereMapsUCLauncher.service.in b/heremaps-uc-launcher/org.tizen.lbs.Providers.HereMapsUCLauncher.service.in
new file mode 100644 (file)
index 0000000..5377acd
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.tizen.lbs.Providers.HereMapsUCLauncher
+Exec=@BINDIR@/heremaps-uc-launcher
diff --git a/heremaps-uc-launcher/src/CMakeLists.txt b/heremaps-uc-launcher/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8bbddb3
--- /dev/null
@@ -0,0 +1,42 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT(heremaps-uc-launcher C)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+# Set ready to build
+SET(EXT_LIBS_DIRS "")
+SET(EXT_LIBS_DEFS "")
+SET(EXT_LIBS_LDFLAGS "")
+
+# Set external libraries
+SET(EXT_LIBS UC_LAUNCHER_EXT_LIBS)
+
+FOREACH(flag ${EXT_LIBS})
+    SET(EXT_LIBS_DIRS       ${EXT_LIBS_DIRS}    ${${flag}_INCLUDE_DIRS})
+    SET(EXT_LIBS_DEFS       ${EXT_LIBS_DEFS}    ${${flag}_CFLAGS_OTHER})
+    SET(EXT_LIBS_LDFLAGS    ${EXT_LIBS_LDFLAGS} ${${flag}_LDFLAGS})
+ENDFOREACH(flag)
+
+# Set ready to build
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${EXT_LIBS_DIRS})
+
+ADD_DEFINITIONS(
+    ${EXT_LIBS_DEFS}
+)
+
+SET(SRCS
+    heremaps-uc-launcher.c
+)
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-Wl,--as-needed -pie" "-ldl" ${EXT_LIBS_LDFLAGS})
+
+message(${EXT_LIBS_LDFLAGS})
+
+#install binary & edj files
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
diff --git a/heremaps-uc-launcher/src/heremaps-uc-launcher.c b/heremaps-uc-launcher/src/heremaps-uc-launcher.c
new file mode 100644 (file)
index 0000000..8878ddf
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jongmun Woo <jongmun.woo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "heremaps-uc-launcher.h"
+
+static void launch_heremaps_uc()
+{
+       LS_FUNC_ENTER
+
+       app_control_h app_control = NULL;
+       app_control_create(&app_control);
+       app_control_set_app_id(app_control, "org.tizen.heremaps-uc");
+       app_control_send_launch_request(app_control, NULL, NULL);
+       app_control_destroy(app_control);
+
+       LS_FUNC_EXIT
+}
+
+int main(int argc, char *argv[])
+{
+       LS_FUNC_ENTER
+
+       launch_heremaps_uc();
+
+       LS_FUNC_EXIT
+       return 0;
+}
diff --git a/heremaps-uc-launcher/src/heremaps-uc-launcher.h b/heremaps-uc-launcher/src/heremaps-uc-launcher.h
new file mode 100644 (file)
index 0000000..fbbf2a2
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jongmun Woo <jongmun.woo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+
+#ifndef UC_LAUNCHER_COMMON_H_
+#define UC_LAUNCHER_COMMON_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <app.h>
+#include <dlog.h>
+#include <glib.h>
+#ifndef Eina_Bool
+#include <stdbool.h>
+#endif
+#include <libintl.h>
+#include <stdio.h>
+#include <system_info.h>
+
+#if !defined(UC_LAUNCHER_PKG)
+#define UC_LAUNCHER_PKG "heremaps-uc-launcher"
+#endif
+
+#define DOMAIN_NAME UC_LAUNCHER_PKG
+
+#define TAG_UC_LAUNCHER "UC_LAUNCHER"
+#define UC_LAUNCHER_DLOG_DEBUG
+
+#ifdef UC_LAUNCHER_DLOG_DEBUG        /**< if debug mode, show filename & line number */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG TAG_UC_LAUNCHER
+#endif
+
+#define LS_LOGD(fmt,args...)  LOGD(fmt, ##args)
+#define LS_LOGW(fmt,args...)  LOGW(fmt, ##args)
+#define LS_LOGI(fmt,args...)  LOGI(fmt, ##args)
+#define LS_LOGE(fmt,args...)  LOGE(fmt, ##args)
+
+#elif UC_LAUNCHER_DLOG_RELEASE      /* if release mode */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG TAG_UC_LAUNCHER
+#endif
+
+#define LS_LOGD(fmt,args...)  LOGD(fmt, ##args)
+#define LS_LOGW(fmt,args...)  LOGW(fmt, ##args)
+#define LS_LOGI(fmt,args...)  LOGI(fmt, ##args)
+#define LS_LOGE(fmt,args...)  LOGE(fmt, ##args)
+#else                       /* if do not use dlog */
+#define LS_LOGD(...)  g_debug(__VA_ARGS__)
+#define LS_LOGW(...)  g_warning(__VA_ARGS__)
+#define LS_LOGI(...)  g_message(__VA_ARGS__)
+#define LS_LOGE(...)  g_error(__VA_ARGS__)
+#endif
+
+#define P_(s)                  dgettext(UC_LAUNCHER_PKG, s)
+#define S_(s)                  dgettext("sys_string", s)
+#define dgettext_noop(s)       (s)
+#define N_(s)                  dgettext_noop(s)
+
+#define LS_FUNC_ENTER  LS_LOGD("(%s) ENTER", __FUNCTION__);
+#define LS_FUNC_EXIT   LS_LOGD("(%s) EXIT", __FUNCTION__);
+
+
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+#endif /* UC_LAUNCHER_COMMON_H_ */
index a43bca5234bb76ba4ae1327ef74cc14334e9d3a0..a76fdbae7d915118498d7699ad37ccc98f8884f1 100644 (file)
@@ -1,8 +1,5 @@
 <manifest>
-       <define>
-               <domain name="org.tizen.heremaps-uc" />
-       </define>
        <request>
-               <domain name="org.tizen.heremaps-uc" />
+               <domain name="_" />
        </request>
 </manifest>
index ff960c10bcdac0309e18ec56eefb4a6e80efa7fd..edf0e8976ebe1f1154d3e0c699e78914fe204a96 100644 (file)
@@ -32,6 +32,7 @@ extern "C" {
 #include <dlog.h>
 #include <glib.h>
 #include <vconf.h>
+#include <vconf-internal-location-keys.h>
 #ifndef Eina_Bool
 #include <stdbool.h>
 #endif
index 2621092a7a7811fbe5ff7190f002e8a7564f93e2..bcfd3137054e470a2b21f5076ea74bae0b6e437b 100644 (file)
@@ -21,8 +21,6 @@
 
 #include "heremaps-uc-common.h"
 
-#define UC_FILE "/opt/usr/apps/org.tizen.heremaps-uc/shared/data/heremaps_uc.xml"
-
 static Evas_Object *create_conformant(Evas_Object * parent)
 {
        LS_FUNC_ENTER
@@ -60,62 +58,54 @@ static void win_del(void *data, Evas_Object * obj, void *event)
        elm_exit();
 }
 
-static void read_file(heremaps_uc_app_data *ad)
+static void read_vconf(heremaps_uc_app_data *ad)
 {
        LS_FUNC_ENTER
-       FILE *fp = fopen(UC_FILE, "r");
-       char buf[15] = {};
-       char *data = NULL, *save_token = NULL;
        app_control_h reply;
+       int enabled = 0;
        int ret = 0;
 
-       if (fp == NULL)
-               LS_LOGE("UC_FILE open fail");
-       else {
-               ret = fread(buf, 15, 1, fp);
-               fclose(fp);
-
-               if (ret > 0)
-               {
-                       data = strtok_r(buf, "=", &save_token);
-                       data = strtok_r(NULL, "=", &save_token);
-               }
-               else
-                       LS_LOGE("UC_FILE read fail");
-       }
+       ret = vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
+       if (ret != 0)
+               LS_LOGE("Fail to get vconf value");
 
        app_control_create(&reply);
-       if (data == NULL)
+       if (enabled == 0)
                app_control_add_extra_data(reply, "result", "No");
-       else if ((strcmp(data, "Yes") == 0) || (strcmp(data, "No") == 0))
-               app_control_add_extra_data(reply, "result", data);
        else
-               app_control_add_extra_data(reply, "result", "No");
+               app_control_add_extra_data(reply, "result", "Yes");
        ret = app_control_reply_to_launch_request(reply, ad->app_control, APP_CONTROL_RESULT_SUCCEEDED);
        if (ret != APP_CONTROL_ERROR_NONE)
                LS_LOGE("app_control_reply_to_launch_request fail. err=%d", ret);
        app_control_destroy(reply);
 }
 
-static void save_file(char *data, heremaps_uc_app_data *ad)
+static void save_vconf(int value, heremaps_uc_app_data *ad)
 {
-       FILE *fp = fopen(UC_FILE, "w+");
-       char buf[15] = {};
        app_control_h reply;
+       int enabled = 0;
        int ret = 0;
 
-       app_control_create(&reply);
+       ret = vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
+       if (ret != 0)
+               LS_LOGE("Fail to get vconf value");
+       else if (enabled != value) {
+               ret = vconf_set_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, value);
+               if (ret != 0)
+                       LS_LOGE("Fail to set vconf value");
+       }
 
-       if (fp == NULL) {
-               LS_LOGE("UC_FILE open fail");
+       app_control_create(&reply);
+       if (ret != 0)
                app_control_add_extra_data(reply, "result", "No");
-       } else {
-               snprintf(buf, sizeof(buf)-1, "Agree=%s", data);
-               fwrite(buf, strlen(buf), 1, fp);
-               fclose(fp);
-               LS_LOGE("result of save_file() is %s", data);
-
-               app_control_add_extra_data(reply, "result", strdup(data));
+       else {
+               if (value == 1) {
+                       LS_LOGE("Vconf value of HereMaps is true");
+                       app_control_add_extra_data(reply, "result", "Yes");
+               } else {
+                       LS_LOGE("Vconf value of HereMaps is false");
+                       app_control_add_extra_data(reply, "result", "No");
+               }
        }
 
        ret = app_control_reply_to_launch_request(reply, ad->app_control, APP_CONTROL_RESULT_SUCCEEDED);
@@ -129,7 +119,7 @@ static void disagree_btn_cb(void *data, Evas_Object * obj, void *event)
        LS_FUNC_ENTER
        heremaps_uc_app_data *ad = (heremaps_uc_app_data *) data;
 
-       save_file("No", ad);
+       save_vconf(0, ad);
 
        elm_exit();
 }
@@ -139,7 +129,7 @@ static void agree_btn_cb(void *data, Evas_Object * obj, void *event)
        LS_FUNC_ENTER
        heremaps_uc_app_data *ad = (heremaps_uc_app_data *) data;
 
-       save_file("Yes", ad);
+       save_vconf(1, ad);
 
        elm_exit();
 }
@@ -149,7 +139,7 @@ static void back_btn_cb(void *data, Evas_Object * obj, void *event)
        LS_FUNC_ENTER
        heremaps_uc_app_data *ad = (heremaps_uc_app_data *) data;
 
-       read_file(ad);
+       read_vconf(ad);
        elm_exit();
 }
 
@@ -174,6 +164,7 @@ static Evas_Object *create_win(const char *name)
 
 static Evas_Object *create_popup(Evas_Object *layout, heremaps_uc_app_data *ad)
 {
+       LS_FUNC_ENTER
        Evas_Object *popup;
        Evas_Object *disagree_btn, *agree_btn;
 
@@ -182,7 +173,6 @@ static Evas_Object *create_popup(Evas_Object *layout, heremaps_uc_app_data *ad)
        elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
        eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, back_btn_cb, ad);
        evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
        elm_object_part_text_set(popup, "title,text", P_("IDS_POSITIONING_CONSENT_TITLE"));
        elm_object_text_set(popup, P_("IDS_POSITIONING_CONSENT_BODY"));
 
@@ -201,7 +191,7 @@ static Evas_Object *create_popup(Evas_Object *layout, heremaps_uc_app_data *ad)
        evas_object_smart_callback_add(agree_btn, "clicked", agree_btn_cb, ad);
 
        evas_object_show(popup);
-
+       LS_FUNC_EXIT
        return popup;
 }
 
@@ -217,7 +207,6 @@ static void _app_terminate_cb(void *user_data)
        LS_FUNC_ENTER
 }
 
-/*
 static void _app_pause_cb(void *user_data)
 {
        LS_FUNC_ENTER
@@ -227,7 +216,6 @@ static void _app_resume_cb(void *user_data)
 {
        LS_FUNC_ENTER
 }
-*/
 
 static void _app_control_cb(app_control_h app_control, void *user_data)
 {
@@ -246,17 +234,18 @@ static void _app_control_cb(app_control_h app_control, void *user_data)
        app_control_get_extra_data(app_control, "action", &action);
        if (action != NULL) {
                if (strcmp(action, "Get") == 0) {
-                       read_file(ad);
+                       read_vconf(ad);
                        elm_exit();
                } else if (strcmp(action, "Set") == 0) {
                        app_control_get_extra_data(app_control, "value", &data);
                        LS_LOGE("DATA = %s", data);
 
                         if (data != NULL) {
-                               if ((strcmp(data, "Yes") == 0) || (strcmp(data, "No") == 0)) {
-                                       save_file(data, ad);
-                                       elm_exit();
-                               }
+                               if (strcmp(data, "Yes") == 0)
+                                       save_vconf(1, ad);
+                               else
+                                       save_vconf(0, ad);
+                               elm_exit();
                        }
                }
        }
@@ -326,19 +315,20 @@ int main(int argc, char *argv[])
        event_callback.create = _app_create_cb;
        event_callback.terminate = _app_terminate_cb;
        event_callback.app_control = _app_control_cb;
+       event_callback.pause = _app_pause_cb;
+       event_callback.resume = _app_resume_cb;
 
        ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, NULL);
        ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, NULL);
        ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED,     _app_language_changed_cb, NULL);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _app_language_changed_cb, NULL);
        ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
 
        ret = APP_ERROR_NONE;
        ret = ui_app_main(argc, argv, &event_callback, &ad);
 
-       if (ret != APP_ERROR_NONE) {
+       if (ret != APP_ERROR_NONE)
                LS_LOGE("ui_app_main() is failed. err=%d", ret);
-       }
 
        return ret;
 
index 97da6a1065cbc33277b745755faa31c5af8bfbc7..898404b9b9b73055e2f54de6956688f89eefaf03 100644 (file)
@@ -39,8 +39,6 @@
 #include <common/ApplicationContext.h>
 #include <common/HereConfig.h>
 
-#define UC_FILE "/opt/usr/apps/org.tizen.heremaps-uc/shared/data/heremaps_uc.xml"
-
 HERE_PLUGIN_BEGIN_NAMESPACE
 
 class HereManager;
@@ -86,7 +84,6 @@ public:
        static HereManager* GetHandler();
        static void Close();
        static here_error_e CheckAgreement();
-       static bool GetAgreement(void);
 
 private:
        here_error_e SetCredentials();
diff --git a/inc/heremaps-uc-dbus.h b/inc/heremaps-uc-dbus.h
new file mode 100644 (file)
index 0000000..4c59621
--- /dev/null
@@ -0,0 +1,64 @@
+/* Copyright 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file       heremaps-uc-dbus.h
+ * @brief      This file contains the internal definitions and structures related to heremaps-uc-dbus.
+ */
+#ifndef __UC_DBUS_H__
+#define __UC_DBUS_H__
+
+#include <gio/gio.h>
+#include <tizen_error.h>
+#include <dlog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAPS_LOGD(fmt,args...)  LOGD(fmt, ##args)
+#define MAPS_LOGW(fmt,args...)  LOGW(fmt, ##args)
+#define MAPS_LOGI(fmt,args...)  LOGI(fmt, ##args)
+#define MAPS_LOGE(fmt,args...)  LOGE(fmt, ##args)
+#define MAPS_SECLOG(fmt,args...)  SECURE_LOGD(fmt, ##args)
+
+#define MAPS_FUNC_ENTER     MAPS_LOGD("(%s) ENTER", __FUNCTION__);
+#define MAPS_FUNC_EXIT      MAPS_LOGD("(%s) EXIT", __FUNCTION__);
+
+/**
+* @brief        Error and handle for heremaps-uc-dbus
+*/
+typedef enum {
+    HEREMAPS_UC_DBUS_ERROR_NONE,
+    HEREMAPS_UC_DBUS_ERROR_MEMORY,
+    HEREMAPS_UC_DBUS_ERROR_CONNECTION,
+    HEREMAPS_UC_DBUS_ERROR_DBUS_CALL,
+} heremaps_uc_dbus_error_e;
+
+
+/**
+* @brief        API to launch heremaps-uc-launcher.
+* @return       int
+* @retval       HEREMAPS_UC_DBUS_ERROR_NONE if success
+                               HEREMAPS_UC_DBUS_ERROR_MEMORY if failure
+                               HEREMAPS_UC_DBUS_ERROR_CONNECTION if failure
+                HEREMAPS_UC_DBUS_ERROR_DBUS_CALL if failure
+*/
+int heremaps_uc_dbus_launch_receiver();
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __UC_DBUS_H__ */
diff --git a/packaging/heremaps-uc-launcher.service b/packaging/heremaps-uc-launcher.service
new file mode 100644 (file)
index 0000000..67d9a40
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=HereMaps-UC Launcher daemon
+Requires=heremaps-uc-launcher.service
+
+[Service]
+EnvironmentFile=/run/tizen-system-env
+Type=dbus
+BusName=org.tizen.lbs.Providers.HereMapsUCLauncher
+ExecStart=/usr/bin/heremaps-uc-launcher
+MemoryLimit=10M
index 9c80636c8ead53533dc34f8d92cb4b14a3a7945c..2edfdcbcb6fc2e14d4fbc3659246ad9c0ad6673b 100644 (file)
@@ -1,7 +1,7 @@
 Name:       maps-plugin-here
 Summary:    Tizen HERE Maps Plug-in Library
-Version:    0.1.9
-Release:    2
+Version:    0.2.0
+Release:    1
 Group:      Location/Libraries
 License:    Apache-2.0 and HERE
 Source0:    %{name}-%{version}.tar.gz
@@ -10,6 +10,8 @@ ExclusiveArch:  %ix86 x86_64 %arm aarch64
 BuildRequires: cmake
 # for here plugin
 BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(gio-unix-2.0)
 BuildRequires: pkgconfig(gmodule-2.0)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(dlog)
@@ -66,7 +68,7 @@ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 %endif
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=lib -DARCH=%{ARCH}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=lib -DARCH=%{ARCH} -DSYSCONF_DIR=%{_sysconfdir}
 make %{?jobs:-j%jobs}
 
 %install
@@ -90,6 +92,7 @@ cp -a lib/%{ARCH}/libheremaps-engine.so* %{buildroot}%{_prefix}/lib/
 %{_prefix}/lib/libheremaps-engine.so*
 /usr/share/license/maps-plugin-here
 
+
 %package -n org.tizen.heremaps-uc
 Summary:    HereMaps UC popup
 Requires:   %{name} = %{version}-%{release}
@@ -103,3 +106,18 @@ This package provides UI interface to get consents from users to the HERE platfo
 /usr/apps/org.tizen.heremaps-uc/bin/*
 /usr/apps/org.tizen.heremaps-uc/res/locale
 /usr/share/packages/org.tizen.heremaps-uc.xml
+
+
+%package -n heremaps-uc-launcher
+Summary:    HereMpas-UC Launcher deamon
+Requires:   %{name} = %{version}-%{release}
+
+%description -n heremaps-uc-launcher
+This package is for launching the org.tizen.heremaps-uc application. 
+
+%files -n heremaps-uc-launcher
+%manifest heremaps-uc-launcher/heremaps-uc-launcher.manifest
+%defattr(-,root,root,-)
+/usr/bin/heremaps-uc-launcher
+/usr/share/dbus-1/services/org.tizen.lbs.Providers.HereMapsUCLauncher.service
+%config %{_sysconfdir}/dbus-1/session.d/heremaps-uc-launcher.conf
index b855bad0b159d010929285fabae1b34f067400e4..17d2e74463ef9ddb61bc21c09628d7f0e4cc809b 100644 (file)
 #include "here_place.h"
 #include "here_route.h"
 #include "here_utils.h"
+#include "heremaps-uc-dbus.h"
 #include <common/HereConfig.h>
 #include <app.h>
 #include <iostream>
 #include <fstream>
 #include <string>
+#include <vconf.h>
+#include <vconf-internal-location-keys.h>
 
 using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
 using namespace TIZEN_MAPS_NAMESPACE_PREFIX;
@@ -496,53 +499,42 @@ here_error_e HereManager::CheckAgreement()
        const char UTC_APP[] = "core.capi-maps-service-tests";
        const char ITC_APP[] = "native.capi-maps-service-itc";
 
+       int enabled = 0;
+       int ret = 0;
        char *strAppId = NULL;
        here_error_e error = HERE_ERROR_NONE;
 
-       pid_t nProcessId = getpid();
-       int nRet = app_manager_get_app_id(nProcessId, &strAppId);
-       if (nRet != APP_MANAGER_ERROR_NONE)
-       {
-               MAPS_LOGI("Get app_id [%ld]. nRet[%d]", nProcessId, nRet);
-               error = HERE_ERROR_SERVICE_NOT_AVAILABLE;
-       }
-       else if (strncmp(strAppId, UTC_APP, strlen(UTC_APP)) &&
-               strncmp(strAppId, ITC_APP, strlen(ITC_APP)) &&
-               strncmp(strAppId, UTC_TPK_APP, strlen(UTC_TPK_APP)) &&
-               strncmp(strAppId, ITC_TPK_APP, strlen(ITC_TPK_APP)) &&
-               !HereManager::GetAgreement())
-       {
-               MAPS_LOGD("Not agreed yet");
+       ret = vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
+       MAPS_LOGD("VCONFKEY_LOCATION_HEREMAPS_CONSENT is %d", enabled);
+       if (ret != 0 || enabled == 0) {
                error = HERE_ERROR_SERVICE_NOT_AVAILABLE;
+               if (ret != 0)
+                       MAPS_LOGD("Fail to get vconf value");
+
+               pid_t nProcessId = getpid();
+               ret = app_manager_get_app_id(nProcessId, &strAppId);
+               if (ret != APP_MANAGER_ERROR_NONE)
+                       MAPS_LOGI("Get app_id [%ld]. nRet[%d]", nProcessId, ret);
+               else if (!strncmp(strAppId, UTC_APP, strlen(UTC_APP)) ||
+                               !strncmp(strAppId, ITC_APP, strlen(ITC_APP)) ||
+                               !strncmp(strAppId, UTC_TPK_APP, strlen(UTC_TPK_APP)) ||
+                               !strncmp(strAppId, ITC_TPK_APP, strlen(ITC_TPK_APP))) { 
+                       MAPS_LOGD("Requested by tct");
+                       error = HERE_ERROR_NONE;
+               }
        }
 
-       g_free(strAppId);
-       return error;
-}
-
-bool HereManager::GetAgreement(void)
-{
-       std::ifstream file (UC_FILE);
-       bool isAgree = false;
-       std::string line;
-       std::string value;
-
-       if (file.is_open()) {
-               getline(file, line);
-               value = line.substr(6);
-               if (value.compare("Yes") == 0)
-                       isAgree = true;
-               else
-                       MAPS_LOGD("UC was set No");
-               file.close();
-       } else {
-               char buff[256], *p;
-               p = strerror_r(errno, buff, sizeof(buff));
-               if (p)
-                       MAPS_LOGD("UC file open fail. %s (%d)", p, errno);
-       }
+       if (error != HERE_ERROR_NONE) {
+               MAPS_LOGD("heremaps_uc_dbus_launch_receiver is called");
+               ret = heremaps_uc_dbus_launch_receiver();
+               if (ret != HEREMAPS_UC_DBUS_ERROR_NONE)
+                       MAPS_LOGD("heremaps_uc_dbus_launch_receiver fail");
+       } else
+               MAPS_LOGD("Vconf value of HereMaps is true");
 
-       return isAgree;
+       if (strAppId != NULL)
+               g_free(strAppId);
+       return error;
 }
 
 HERE_PLUGIN_END_NAMESPACE
diff --git a/src/heremaps-uc-dbus.c b/src/heremaps-uc-dbus.c
new file mode 100644 (file)
index 0000000..16abef7
--- /dev/null
@@ -0,0 +1,100 @@
+/* Copyright 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include "heremaps-uc-dbus.h"
+
+/**
+* @brief        information for DBUS
+*/
+#define UC_RECEIVER_NAME       "org.tizen.lbs.Providers.HereMapsUCLauncher"
+#define UC_RECEIVER_PATH       "/org/tizen/lbs/Providers/HereMapsUCLauncher"
+#define UC_INTERFACE_NAME      "org.tizen.lbs.HereMapsUCLauncher"
+
+
+typedef struct _heremaps_uc_dbus_s {
+       GDBusConnection *conn;
+       gchar *service_name;
+       gchar *service_path;
+       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;
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       heremaps_uc_dbus_s *handle = g_new0(heremaps_uc_dbus_s, 1);
+       g_return_val_if_fail(handle, HEREMAPS_UC_DBUS_ERROR_MEMORY);
+
+       handle->conn = NULL;
+
+       /* get addr of dbus */
+       bus_addr = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION, NULL, &error);
+       if (!bus_addr) {
+               MAPS_LOGD("Fail to get addr of bus.");
+               return HEREMAPS_UC_DBUS_ERROR_CONNECTION;
+       }
+       MAPS_LOGD("bus_addr: %s", bus_addr);
+
+       /* connect and setup dbus */
+       handle->conn = g_dbus_connection_new_for_address_sync(bus_addr,
+                                                       G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+                                                       G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+                                                       NULL, NULL, &error);
+       if (!handle->conn) {
+               if (error && error->message) {
+                       MAPS_LOGD("Fail to get GBus. ErrCode[%d], Msg[%s]", error->code, error->message);
+                       g_error_free(error);
+                       error = NULL;
+               }
+               return HEREMAPS_UC_DBUS_ERROR_CONNECTION;
+       }
+       MAPS_LOGD("handle->conn: %p", handle->conn);
+       g_free(bus_addr);
+
+       handle->service_name = g_strdup(UC_RECEIVER_NAME);
+       handle->service_path = g_strdup(UC_RECEIVER_PATH);
+       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);
+
+       if (handle->conn) {
+               g_object_unref(handle->conn);
+               handle->conn = NULL;
+       }
+       g_free(handle->service_path);
+       g_free(handle->service_name);
+       g_free(handle->signal_path);
+       g_free(handle);
+
+       return HEREMAPS_UC_DBUS_ERROR_NONE;
+}
+