Fix JIRA issue (N_SE-56564) tizen_2.2 2.2.1_release submit/tizen_2.2/20131107.062934
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 31 Oct 2013 01:45:34 +0000 (10:45 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 31 Oct 2013 02:02:51 +0000 (11:02 +0900)
In emulator environment, bluetooth is not supported. So we should
not launch bluetooth UI.

Change-Id: I94703b88050af7c5920b6870ef37366fe720326f

CMakeLists.txt
include/bt-main-view.h
include/bt-string-define.h
include/bt-type-define.h
include/bt-util.h
packaging/ug-bluetooth-efl.spec
src/libraries/bt-util.c
src/ui/bt-main-ug.c
src/ui/bt-main-view.c

index bc8f68a..75f02e1 100644 (file)
@@ -25,7 +25,7 @@ src/libraries/bt-net-connection.c
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED elementary appcore-efl ui-gadget-1 x11 dlog vconf edbus evas edje ecore eina aul syspopup-caller gobject-2.0 capi-network-bluetooth capi-network-connection capi-appfw-application notification efl-assist glib-2.0 gio-2.0)
+pkg_check_modules(pkgs REQUIRED elementary appcore-efl ui-gadget-1 x11 dlog vconf edbus evas edje ecore eina aul syspopup-caller gobject-2.0 capi-network-bluetooth capi-network-connection capi-appfw-application notification efl-assist glib-2.0 gio-2.0 capi-system-info)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
index fce2873..7708480 100644 (file)
@@ -113,6 +113,8 @@ gboolean _bt_main_is_matched_profile(unsigned int search_type,
 
 void _bt_main_create_information_popup(bt_ug_data *ugd, char *msg);
 
+void _bt_main_create_error_destroy_popup(bt_ug_data *ugd, char *msg);
+
 void _bt_main_add_searched_title(bt_ug_data *ugd);
 
 void _bt_update_paired_item_style(bt_ug_data *ugd);
index da58908..af3d3cf 100644 (file)
@@ -188,6 +188,9 @@ extern "C" {
 /* We need to change this design ID */
 #define BT_STR_INTERNET_ACCESS _("IDS_BT_BODY_INTERNET_ACCESS_ABB2")
 
+/* Emulator not support */
+#define BT_STR_NOT_SUPPORT_IN_EMUL _("Not Support in Emulator")
+
 /* System string */
 #define BT_STR_SEARCH dgettext("sys_string", "IDS_COM_SK_SEARCH")
 #define BT_STR_STOP dgettext("sys_string", "IDS_COM_SK_STOP")
index 1752d0e..4451f9d 100644 (file)
@@ -59,6 +59,7 @@ extern "C" {
 #define BT_SEARCH_SERVICE_TIMEOUT 5
 #define BT_SELECTED_TIMEOUT 5
 #define BT_DELETED_TIMEOUT 2
+#define BT_EXIT_TIMEOUT 2100
 #define BT_VISIBILITY_TIMEOUT  1000
 
 /* Define Error type */
@@ -94,6 +95,8 @@ extern "C" {
 
 #define BT_DEFAULT_PHONE_NAME "Fraser"
 
+#define BT_EMULATOR_KEYSTR "Emulator"
+
 #define BT_SYSPOPUP_REQUEST_NAME "app-confirm-request"
 #define BT_SYSPOPUP_TWO_BUTTON_TYPE "twobtn"
 #define BT_SYSPOPUP_ONE_BUTTON_TYPE "onebtn"
index 64dd00c..dabddf6 100644 (file)
@@ -69,6 +69,8 @@ gboolean _bt_util_is_battery_low(void);
 
 gboolean _bt_util_is_flight_mode(void);
 
+gboolean _bt_util_is_emulator(void);
+
 void _bt_util_addr_type_to_addr_string(char *address,
                                               unsigned char *addr);
 
index 0d02dad..72cf07c 100644 (file)
@@ -33,6 +33,7 @@ BuildRequires: pkgconfig(capi-network-bluetooth)
 BuildRequires: pkgconfig(capi-network-connection)
 BuildRequires: pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(notification)
 BuildRequires : pkgconfig(glib-2.0)
 BuildRequires : pkgconfig(gio-2.0)
index 8f64685..67875cd 100644 (file)
@@ -17,6 +17,7 @@
 #include <bluetooth.h>
 #include <vconf.h>
 #include <aul.h>
+#include <system_info.h>
 
 #include "bt-main-ug.h"
 #include "bt-util.h"
@@ -475,6 +476,31 @@ gboolean _bt_util_is_flight_mode(void)
        return mode ? TRUE : FALSE;
 }
 
+gboolean _bt_util_is_emulator(void)
+{
+       FN_START;
+
+       gboolean mode = FALSE;
+       char *model_str = NULL;
+       int ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &model_str);
+
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               BT_ERR("fail to call system_info_get_value_string");
+               g_free(model_str);
+               return FALSE;
+       }
+
+       if (g_strcmp0(BT_EMULATOR_KEYSTR, model_str) == 0)
+               mode = TRUE;
+       else
+               mode = FALSE;
+
+       g_free(model_str);
+
+       FN_END;
+       return mode;
+}
+
 void _bt_util_addr_type_to_addr_string(char *address,
                                               unsigned char *addr)
 {
index bb8951d..fa64bc5 100644 (file)
@@ -262,6 +262,10 @@ static void *__on_create(ui_gadget_h ug, enum ug_mode mode, service_h service,
 
        ugd->ug_status = BT_UG_CREATE;
 
+       if (_bt_util_is_emulator() == TRUE)
+               _bt_main_create_error_destroy_popup(ugd, BT_STR_NOT_SUPPORT_IN_EMUL);
+
+
        FN_END;
        return ugd->base;
 }
index e3f24f1..fd937f1 100644 (file)
@@ -2772,6 +2772,40 @@ void _bt_main_popup_del_cb(void *data, Evas_Object *obj, void *event_info)
        FN_END;
 }
 
+void _bt_main_popup_del_destroy_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       FN_START;
+       retm_if(data == NULL, "Invalid argument: struct bt_appdata is NULL\n");
+
+       bt_ug_data *ugd = (bt_ug_data *)data;
+
+       if (ugd->popup) {
+               BT_DBG("delete popup\n");
+               evas_object_del(ugd->popup);
+               ugd->popup = NULL;
+       }
+
+       ugd->back_cb = NULL;
+
+       __bt_main_quit_btn_cb(ugd, NULL);
+
+       FN_END;
+}
+
+static gboolean __bt_main_error_popup_timer_cb(gpointer user_data)
+{
+       FN_START;
+
+       bt_ug_data *ugd;
+
+       ugd = (bt_ug_data *)user_data;
+
+       _bt_main_popup_del_destroy_cb((void *)ugd, NULL, NULL);
+
+       FN_END;
+       return FALSE;
+}
+
 Elm_Object_Item *_bt_main_add_paired_device(bt_ug_data *ugd, bt_dev_t *dev)
 {
        FN_START;
@@ -4328,6 +4362,27 @@ void _bt_main_create_information_popup(bt_ug_data *ugd, char *msg)
        FN_END;
 }
 
+void _bt_main_create_error_destroy_popup(bt_ug_data *ugd, char *msg)
+{
+       FN_START;
+       ret_if(ugd == NULL);
+
+       if (ugd->popup) {
+               evas_object_del(ugd->popup);
+               ugd->popup = NULL;
+       }
+       ugd->popup = _bt_create_popup(ugd->win_main,
+                                     BT_STR_ERROR,
+                                     msg, _bt_main_popup_del_destroy_cb, ugd, 2);
+
+       ugd->popup_timer =
+           g_timeout_add(BT_EXIT_TIMEOUT,
+                         (GSourceFunc) __bt_main_error_popup_timer_cb,
+                         ugd);
+
+       FN_END;
+}
+
 void _bt_main_add_searched_title(bt_ug_data *ugd)
 {
        Elm_Object_Item *git;