+ bt_le_status_t le_status = BT_LE_DEACTIVATED;
+
+ le_status = _bt_adapter_get_le_status();
+
+ BT_INFO("Current state [%d], LE [%d]", adapter_state, le_status);
+
+ if (adapter_state == BT_DEACTIVATING ||
+ adapter_state == BT_TERMINATING ||
+ le_status == BT_LE_DEACTIVATING) {
+ BT_DBG("Disabling in progress");
+ return BLUETOOTH_ERROR_IN_PROGRESS;
+ }
+
+ if (adapter_state == BT_DEACTIVATED) {
+ BT_DBG("Already disabled");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ if (adapter_state == BT_ACTIVATING || le_status == BT_LE_ACTIVATING) {
+ BT_ERR("Enabling in progress");
+ return BLUETOOTH_ERROR_DEVICE_BUSY;
+ }
+
+ /* TODO: Need to add the function to disconnect all devices */
+ /* __bt_disconnect_all(); */
+