4 Replies Latest reply on Apr 29, 2018 6:07 PM by vmore_3321141

    Scan BLE forever

    vmore_3321141

      Hello All!

       

      I have a really basic question on how I can continuously scan for BLE packets. There seems to be two APIs - observe and scan, and I have been able to use them as console commands to scan for packets. I tried spinning a new thread and enclosed the scan/observe call in a while 1 loop but that doesn't actually seem right. what is the right way to continually scan for BLE packets?

       

      For example, this didn't work for me:

       

      while ( 1 )
          {
                  wiced_result_t scan_result;
                  do {
                      scan_result = wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_HIGH_DUTY, WICED_TRUE, (wiced_bt_ble_scan_result_cback_t *) hello_sensor_scan_ble_callback);
                  } while (scan_result != WICED_BT_BUSY);
      
              // wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_HIGH_DUTY, WICED_TRUE, (wiced_bt_ble_scan_result_cback_t *) hello_sensor_scan_ble_callback);
          }
      

      Thanks!