Fix the bug that we can't search devices
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 27 Aug 2012 04:30:54 +0000 (13:30 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 28 Aug 2012 06:51:12 +0000 (15:51 +0900)
[Issue] P120824-0224 (Sub issue)

[Problem] We can't search the device sometimes

[Cause] The comparision code was wrong

[Solution] Correct the codes

Change-Id: I923585686ebf97ada1aed8cc58097cda946c74b0

debian/changelog
include/bt-main-ug.h
packaging/ug-bluetooth-efl.spec
src/libraries/bt-callback.c
src/libraries/bt-ipc-handler.c
src/ui/bt-main-ug.c
src/ui/bt-main-view.c

index 712d6ef..ba33c5a 100644 (file)
@@ -1,3 +1,19 @@
+ug-setting-bluetooth-efl (0.2.111) unstable; urgency=low
+
+  * Upload the package
+  * Git: magnolia/apps/home/ug-bluetooth-efl
+  * Tag: ug-setting-bluetooth-efl_0.2.111
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Mon, 27 Aug 2012 13:14:06 +0900
+
+ug-setting-bluetooth-efl (0.2.110) unstable; urgency=low
+
+  * Upload the package
+  * Git: magnolia/apps/home/ug-bluetooth-efl
+  * Tag: ug-setting-bluetooth-efl_0.2.110
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Mon, 27 Aug 2012 10:49:22 +0900
+
 ug-setting-bluetooth-efl (0.2.109) unstable; urgency=low
 
   * Upload the package
index bf9b1a4..b44670e 100644 (file)
@@ -140,7 +140,6 @@ typedef struct {
        bool search_req;
        bool aul_launching_req;
        bool aul_pairing_req;
-       bool syspoup_req;
        unsigned int op_status;
        unsigned int ug_status;
        unsigned int search_type;
index 08c7aac..81d6af2 100644 (file)
@@ -5,7 +5,7 @@
 
 Name:       ug-bluetooth-efl
 Summary:    UI gadget about the bluetooth
-Version: 0.2.109
+Version: 0.2.111
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    TO BE FILLED IN
index f0ec0f8..3a4b228 100644 (file)
@@ -418,7 +418,6 @@ void _bt_cb_bonding_created(int result, bt_device_info_s *dev_info,
                        _bt_main_launch_syspopup(ugd, BT_SYSPOPUP_REQUEST_NAME,
                                        BT_STR_BLUETOOTH_ERROR_TRY_AGAIN_Q,
                                        BT_SYSPOPUP_TWO_BUTTON_TYPE);
-                       ugd->syspoup_req = TRUE;
                }
        } else {
                bt_dev_t *new_dev = NULL;
index 13d24e6..196a78a 100644 (file)
@@ -85,8 +85,6 @@ static void __bt_ipc_receive_popup_event(void *data, DBusMessage * msg)
 
        ugd = (bt_ug_data *)data;
 
-       retm_if(ugd->syspoup_req == FALSE, "This response is not mine\n");
-
        member = (char *)dbus_message_get_member(msg);
        retm_if(member == NULL, "dbus signal member get failed\n");
 
@@ -106,8 +104,6 @@ static void __bt_ipc_receive_popup_event(void *data, DBusMessage * msg)
        }
 
        _bt_ipc_unregister_popup_event_signal(ugd->EDBusHandle, data);
-
-       ugd->syspoup_req = FALSE;
 }
 
 /**********************************************************************
index a740a67..b9f70c7 100644 (file)
@@ -240,7 +240,6 @@ static void *__on_create(ui_gadget_h ug, enum ug_mode mode, service_h service,
 
        bt_ug_data *ugd = NULL;
        Evas_Object *bg = NULL;
-       int state;
 
        if (!ug || !priv)
                return NULL;
@@ -345,7 +344,6 @@ static void __on_destroy(ui_gadget_h ug, service_h service, void *priv)
        FN_START;
 
        bt_ug_data *ugd = NULL;
-       int state;
 
        if (!ug || !priv)
                return;
index 8956dae..e72ada7 100644 (file)
@@ -1166,18 +1166,8 @@ static void __bt_main_paired_item_sel_cb(void *data, Evas_Object *obj,
 
        if (ugd->op_status == BT_SEARCHING) {
                ret = bt_adapter_stop_device_discovery();
-               if(ret == BT_ERROR_NONE) {
-                       ugd->op_status = BT_ACTIVATED;
-
-                       if (ugd->status_item)
-                               elm_genlist_item_update(ugd->status_item);
-
-                       if (ugd->paired_title)
-                               elm_genlist_item_update(ugd->paired_title);
-
-                       if (ugd->searched_title)
-                               elm_genlist_item_update(ugd->searched_title);
-               }
+               if(ret != BT_ERROR_NONE)
+                       BT_DBG("Fail to stop discovery");
                return;
        }
 
@@ -1304,7 +1294,6 @@ static void __bt_main_paired_item_sel_cb(void *data, Evas_Object *obj,
                        _bt_main_launch_syspopup(ugd, BT_SYSPOPUP_REQUEST_NAME,
                                        BT_STR_UNABLE_TO_SEND,
                                        BT_SYSPOPUP_ONE_BUTTON_TYPE);
-                       ugd->syspoup_req = TRUE;
                }
 
                free(value);
@@ -1335,8 +1324,8 @@ static void __bt_main_searched_item_sel_cb(void *data, Evas_Object *obj,
        retm_if(data == NULL, "Invalid argument: bt_ug_data is NULL\n");
 
        ugd = (bt_ug_data *)data;
-       if (ugd->op_status == BT_PAIRING || ugd->syspoup_req == TRUE)
-               return;
+
+       ret_if(ugd->op_status == BT_PAIRING);
 
        item = (Elm_Object_Item *)event_info;
 
@@ -1383,10 +1372,8 @@ static void __bt_main_searched_item_sel_cb(void *data, Evas_Object *obj,
 
        if (ugd->op_status == BT_SEARCHING) {
                ret = bt_adapter_stop_device_discovery();
-               if(ret == BT_ERROR_NONE)
-                       ugd->op_status = BT_ACTIVATED;
-               else
-                       return;
+               if(ret != BT_ERROR_NONE)
+                       BT_DBG("Fail to stop discovery");
        } else {
                if (_bt_util_is_battery_low() == TRUE) {
                        /* Battery is critical low */
@@ -2100,7 +2087,7 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev)
 {
        FN_START;
 
-       Elm_Object_Item *git;
+       Elm_Object_Item *git = NULL;
 
        retvm_if(ugd == NULL, NULL, "Invalid argument: ugd is NULL\n");
        retvm_if(dev == NULL, NULL, "Invalid argument: dev is NULL\n");
@@ -2109,11 +2096,11 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev)
                _bt_main_add_searched_title(ugd);
 
        /* Searched device Item */
-       if (ugd->searched_device == NULL)
+       if (ugd->searched_device == NULL) {
                git = elm_genlist_item_insert_after(ugd->main_genlist, ugd->searched_itc,
                                        dev, NULL, ugd->searched_title, ELM_GENLIST_ITEM_NONE,
                                        __bt_main_searched_item_sel_cb, ugd);
-       else {
+       else {
                bt_dev_t *item_dev = NULL;
                Elm_Object_Item *item = NULL;
                Elm_Object_Item *next = NULL;
@@ -2121,13 +2108,15 @@ Elm_Object_Item *_bt_main_add_searched_device(bt_ug_data *ugd, bt_dev_t *dev)
                item = elm_genlist_item_next_get(ugd->searched_title);
 
                /* check the RSSI value of searched device list add arrange its order */
-               while (item != NULL) {
+               while (item != NULL
+                        || item != ugd->searched_padding) {
                        item_dev = _bt_main_get_dev_info(ugd->searched_device, item);
                        retv_if(item_dev == NULL, NULL);
 
                        if (item_dev->rssi > dev->rssi) {
                                next = elm_genlist_item_next_get(item);
-                               if (next == NULL) {
+                               if (next == NULL
+                                   || next == ugd->searched_padding) {
                                        git = elm_genlist_item_insert_after(ugd->main_genlist,
                                                        ugd->searched_itc,
                                                        dev, NULL, item, ELM_GENLIST_ITEM_NONE,
@@ -2247,7 +2236,12 @@ int _bt_main_draw_list_view(bt_ug_data *ugd)
                                if (!ret) {
                                        ugd->op_status = BT_SEARCHING;
                                        elm_toolbar_item_icon_set(ugd->scan_item,
-                                                               BT_ICON_CONTROLBAR_STOP);
+                                                       BT_ICON_CONTROLBAR_STOP);
+
+                                       elm_genlist_item_update(ugd->status_item);
+
+                                       if (ugd->searched_title == NULL)
+                                               _bt_main_add_searched_title(ugd);
                                } else
                                        BT_DBG("Operation failed : Error Cause[%d]", ret);
                        }