From: DoHyun Pyun Date: Wed, 16 Oct 2019 04:19:02 +0000 (+0900) Subject: Fix TCT fail issue by API calling timing X-Git-Tag: accepted/tizen/5.5/unified/20191031.023712^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a85d361ff1719456fd37d32adf68aef94e9d67b5;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Fix TCT fail issue by API calling timing 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 --- diff --git a/bt-oal/bluez_hal/src/bt-hal-event-receiver.c b/bt-oal/bluez_hal/src/bt-hal-event-receiver.c index fd1a1d5..38c838d 100644 --- a/bt-oal/bluez_hal/src/bt-hal-event-receiver.c +++ b/bt-oal/bluez_hal/src/bt-hal-event-receiver.c @@ -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); diff --git a/bt-service-adaptation/services/adapter/bt-service-core-adapter.c b/bt-service-adaptation/services/adapter/bt-service-core-adapter.c index b29eb15..7c24ccf 100644 --- a/bt-service-adaptation/services/adapter/bt-service-core-adapter.c +++ b/bt-service-adaptation/services/adapter/bt-service-core-adapter.c @@ -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: