From: DoHyun Pyun Date: Thu, 31 Oct 2013 01:45:34 +0000 (+0900) Subject: Fix JIRA issue (N_SE-56564) X-Git-Tag: 2.2.1_release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_2.2;p=apps%2Fhome%2Fug-bluetooth-efl.git Fix JIRA issue (N_SE-56564) In emulator environment, bluetooth is not supported. So we should not launch bluetooth UI. Change-Id: I94703b88050af7c5920b6870ef37366fe720326f --- diff --git a/CMakeLists.txt b/CMakeLists.txt index bc8f68a..75f02e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/include/bt-main-view.h b/include/bt-main-view.h index fce2873..7708480 100644 --- a/include/bt-main-view.h +++ b/include/bt-main-view.h @@ -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); diff --git a/include/bt-string-define.h b/include/bt-string-define.h index da58908..af3d3cf 100644 --- a/include/bt-string-define.h +++ b/include/bt-string-define.h @@ -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") diff --git a/include/bt-type-define.h b/include/bt-type-define.h index 1752d0e..4451f9d 100644 --- a/include/bt-type-define.h +++ b/include/bt-type-define.h @@ -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" diff --git a/include/bt-util.h b/include/bt-util.h index 64dd00c..dabddf6 100644 --- a/include/bt-util.h +++ b/include/bt-util.h @@ -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); diff --git a/packaging/ug-bluetooth-efl.spec b/packaging/ug-bluetooth-efl.spec index 0d02dad..72cf07c 100644 --- a/packaging/ug-bluetooth-efl.spec +++ b/packaging/ug-bluetooth-efl.spec @@ -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) diff --git a/src/libraries/bt-util.c b/src/libraries/bt-util.c index 8f64685..67875cd 100644 --- a/src/libraries/bt-util.c +++ b/src/libraries/bt-util.c @@ -17,6 +17,7 @@ #include #include #include +#include #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) { diff --git a/src/ui/bt-main-ug.c b/src/ui/bt-main-ug.c index bb8951d..fa64bc5 100644 --- a/src/ui/bt-main-ug.c +++ b/src/ui/bt-main-ug.c @@ -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; } diff --git a/src/ui/bt-main-view.c b/src/ui/bt-main-view.c index e3f24f1..fd937f1 100644 --- a/src/ui/bt-main-view.c +++ b/src/ui/bt-main-view.c @@ -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;