Fix TCT fail issue by API calling timing
[platform/core/connectivity/bluetooth-frwk.git] / bt-service-adaptation / services / adapter / bt-service-core-adapter.c
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: