OSDN Git Service

android/daemon: Fix not reporting scan mode to Java
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Thu, 31 Oct 2013 12:42:35 +0000 (14:42 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 31 Oct 2013 13:45:19 +0000 (15:45 +0200)
After set_adapter_property() higher layer expects callback to be returned
even if property is not changes. Otherwise Java timeouts and reset Bluetooth
enetring to the loop.
...
BluetoothAdapterState( 2850): Timeout will setting scan mode..
  Continuing with disable...
...

android/adapter.c

index 7baf356..c7e97d4 100644 (file)
@@ -629,21 +629,21 @@ static uint8_t set_scan_mode(void *buf, uint16_t len)
        switch (*mode) {
        case HAL_ADAPTER_SCAN_MODE_NONE:
                if (!cur_conn && !cur_disc)
-                       return HAL_STATUS_DONE;
+                       goto done;
 
                conn = false;
                disc = false;
                break;
        case HAL_ADAPTER_SCAN_MODE_CONN:
                if (cur_conn && !cur_disc)
-                       return HAL_STATUS_DONE;
+                       goto done;
 
                conn = true;
                disc = false;
                break;
        case HAL_ADAPTER_SCAN_MODE_CONN_DISC:
                if (cur_conn && cur_disc)
-                       return HAL_STATUS_DONE;
+                       goto done;
 
                conn = true;
                disc = true;
@@ -663,6 +663,12 @@ static uint8_t set_scan_mode(void *buf, uint16_t len)
        }
 
        return HAL_STATUS_SUCCESS;
+
+done:
+       /* Android expects property changed callback */
+       scan_mode_changed();
+
+       return HAL_STATUS_DONE;
 }
 
 static uint8_t set_property(void *buf, uint16_t len)