Fix TCT fail issue by API calling timing 96/215796/1 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.023712 accepted/tizen/5.5/unified/mobile/hotfix/20201027.083548 accepted/tizen/unified/20191017.011746 submit/tizen/20191016.055918 submit/tizen_5.5/20191031.000003 submit/tizen_5.5_mobile_hotfix/20201026.185103 tizen_5.5.m2_release
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 16 Oct 2019 04:19:02 +0000 (13:19 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 16 Oct 2019 04:48:13 +0000 (13:48 +0900)
Befor and after sending BR/EDR or LE discovery command,
we should wait some time before recieving the complete event.
Otherwise the discoverying operation can be failed in the
stack layer, and the discoverying state wiil be not matched .

Change-Id: Ia9a07c9c2e3d8c907119d28e12dfac337a40cd44
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-oal/bluez_hal/src/bt-hal-event-receiver.c
bt-service-adaptation/services/adapter/bt-service-core-adapter.c

index fd1a1d5..38c838d 100644 (file)
@@ -400,7 +400,7 @@ static void __bt_hal_adapter_property_changed_event(GVariant *msg)
                        }
 
                } else if (!g_strcmp0(key, "LEDiscovering")) {
-//                     GVariant *result;
+                       GVariant *result;
 
                        is_le_discovering = g_variant_get_boolean(value);
                        DBG("##LE Discovering = [%d]", is_le_discovering);
@@ -408,7 +408,6 @@ static void __bt_hal_adapter_property_changed_event(GVariant *msg)
                        if (is_le_discovering)
                                continue;
 
-#if 0 /* No need to stop le discovery in case LEDiscovering is false */
                        adapter_proxy = _bt_hal_get_adapter_proxy();
                        if (adapter_proxy == NULL) {
                                ERR("adapter_proxy == NULL");
@@ -428,7 +427,6 @@ static void __bt_hal_adapter_property_changed_event(GVariant *msg)
                                continue;
                        }
                        g_variant_unref(result);
-#endif
 
                        size += __bt_insert_hal_properties(buf + size,
                                HAL_PROP_ADAPTER_LE_DISCOVERY_FINISHED, sizeof(gboolean), &is_le_discovering);
index b29eb15..7c24ccf 100644 (file)
@@ -1470,19 +1470,10 @@ static int __bt_adapter_state_discovery_request(gboolean enable,
        case ADAPTER_DISCOVERY_STARTING: {
                BT_INFO("Adapter is currently in discovery starting state, state [%d]",
                                adapter_discovery_state);
-               if (enable) {
-                       return BLUETOOTH_ERROR_IN_PROGRESS;
-               } else {
-                       result = adapter_stop_inquiry();
-                       if (result != OAL_STATUS_SUCCESS) {
-                               BT_ERR("Discover stop failed: %d", result);
-                               result = BLUETOOTH_ERROR_INTERNAL;
-                       } else {
-                               BT_ERR("Stop Discovery Triggered successfully");
-                               __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STOPPING);
-                               result = BLUETOOTH_ERROR_NONE;
-                       }
-               }
+
+               result = enable ?  BLUETOOTH_ERROR_IN_PROGRESS :
+                                       BLUETOOTH_ERROR_DEVICE_BUSY;
+
                break;
        }
        case ADAPTER_DISCOVERY_STOPPED: {
@@ -1512,23 +1503,10 @@ static int __bt_adapter_state_discovery_request(gboolean enable,
        case ADAPTER_DISCOVERY_STOPPING: {
                BT_INFO("Adapter is currently in discovery stopping state, state [%d]",
                                adapter_discovery_state);
-               if (!enable)
-                       return BLUETOOTH_ERROR_NOT_IN_OPERATION;
-               else {
-                       BT_DBG("max_resp: %u, duration: %u, cod: 0x%X", max_response, duration, mask);
-                       if (!is_custom)
-                               result = adapter_start_inquiry(duration);
-                       else
-                               result = adapter_start_custom_inquiry(role);
-                       if (result != OAL_STATUS_SUCCESS) {
-                               BT_ERR("Start Discovery failed: %d", result);
-                               result = BLUETOOTH_ERROR_INTERNAL;
-                       } else {
-                               BT_ERR("Start Discovery Triggered successfully");
-                       __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STARTING);
-                               result = BLUETOOTH_ERROR_NONE;
-                       }
-               }
+
+               result = enable ?  BLUETOOTH_ERROR_DEVICE_BUSY :
+                                       BLUETOOTH_ERROR_NOT_IN_OPERATION;
+
                break;
        }
        default: