P130323-4663 - Bluetooth visibility timer updation incorrect
authorDivya Yadav <divya.yadav@samsung.com>
Wed, 27 Mar 2013 06:32:09 +0000 (12:02 +0530)
committerGerrit Code Review <gerrit2@kim11>
Fri, 5 Apr 2013 06:05:06 +0000 (15:05 +0900)
Issue: Sometimes visibility timer in UI updates from 5:00
to 4:58 directly and misses 4:59.

Cause: Use of API g_timeout_add_seconds, whose definition
says that the first call of the timer may not be precise
for timeouts of one second.

Fix: Use of API g_timeout_add resolves the problem

Change-Id: I4f53545b98474b20cdb0c0e1343148ccbd259856

include/bt-type-define.h
src/ui/bt-main-view.c

index 204814f..bd34727 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_SEARCH_SERVICE_TIMEOUT 5
 #define BT_SELECTED_TIMEOUT 5
 #define BT_DELETED_TIMEOUT 2
+#define BT_VISIBILITY_TIMEOUT  1000
 
 /* Define Error type */
 #define BT_UG_FAIL -1
 
 /* Define Error type */
 #define BT_UG_FAIL -1
index 2190bfe..6892397 100644 (file)
@@ -387,8 +387,8 @@ static void __bt_main_timeout_value_item_sel(void *data, Evas_Object *obj,
                        /* Set current time snapshot */
                        time(&(ugd->start_time));
                        ugd->remain_time = timeout;
                        /* Set current time snapshot */
                        time(&(ugd->start_time));
                        ugd->remain_time = timeout;
-                       ugd->timeout_id = g_timeout_add_seconds(1,
-                                       __bt_main_visible_timeout_cb, ugd);
+                       ugd->timeout_id = g_timeout_add(BT_VISIBILITY_TIMEOUT,
+                               (GSourceFunc)__bt_main_visible_timeout_cb, ugd);
                }
        }
 
                }
        }
 
@@ -3763,8 +3763,8 @@ void _bt_main_init_status(bt_ug_data *ugd, void *data)
                if (ugd->remain_time > 0) {
                        /* Set current time snapshot */
                        time(&(ugd->start_time));
                if (ugd->remain_time > 0) {
                        /* Set current time snapshot */
                        time(&(ugd->start_time));
-                       ugd->timeout_id = g_timeout_add_seconds(1,
-                                       __bt_main_visible_timeout_cb, ugd);
+                       ugd->timeout_id = g_timeout_add(BT_VISIBILITY_TIMEOUT,
+                               (GSourceFunc)__bt_main_visible_timeout_cb, ugd);
                } else {
                        ugd->visibility_timeout = 0;
                }
                } else {
                        ugd->visibility_timeout = 0;
                }