12 Replies Latest reply on Nov 12, 2020 4:14 AM by RoHe_4370821 Branched from an earlier discussion.

    Re: Problems with whitelist...

      Hello JacobT_81

       

      As a follow on to our discussion here: Re: How to scan non-connectable BLE devices ?

       

      I already tested the patch.

      I found some problems in the whitelist.

       

      1- if we active the whitelist we couldn't get no scan results.

      2- So we clear the whitelist and print the size of it, we always get 128

       

       

      BR,

      Gustavo

        • 1. Re: How to scan non-connectable BLE devices ?
          JacobT_81

          gucoc_2136321

           

          To help isolate the issue, can you confirm that your whitelist was fully functional when you used the wiced_bt_ble_scan function?

           

          Jacob

          • 2. Re: How to scan non-connectable BLE devices ?

            JacobT_81

             

            We have the same problem.

             

            I think that the problem is on the white_list functions.

             

            uint8_t wiced_bt_ble_get_white_list_size(void)

            this function always return 128

             

            wiced_bool_t wiced_bt_ble_update_advertising_white_list(wiced_bool_t add, wiced_bt_device_address_t remote_bda);

            this update function returns WICED_TRUE, but the white_list_size if the same 128.

             

            Gustavo

            • 3. Re: How to scan non-connectable BLE devices ?
              JacobT_81

              I reproduced the behavior you're seeing.

               

              I can't fix it from the application level, but I was once again able to jump over a few layers and get it working via raw HCI commands. This only works with the wiced_bt_ble_observe_patch that I provided in the previous thread here: Re: How to scan non-connectable BLE devices ? It doesn't work otherwise because it requires initialization of the white list through my patch. The regular wiced_btm_ble_update_advertisement_filter_policy will not init the white list for scans.

               

              I updated my previous patch to include white list implementation. See the attached file for details.

               

              Or you can easily use the HCI command yourself:

               

                        extern BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);

                        UINT8 bda[6] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};

               

                        btsnd_hcic_ble_add_white_list (BLE_ADDR_PUBLIC, bda);

               

                        wiced_bt_ble_observe_patch(........);

               

              Again this is all packaged up in the attached patch file API for your use.

               

              *one thing to note is that I couldn't get it working with anything other than specifying BLE_ADDR_PUBLIC as the first parameter of the HCI command. I tested different address bit patterns according the the spec and BLE_ADDR_RANDOM always failed..

               

              I will bring these issues to engineering. Perhaps I'm missing something, but it looks like our stack doesn't consider scans to be a valid use-case for the white list and never pushes the HCI commands because adv hasn't been started. This is my best guess based on the limited search I did through the code. I'm unsure why this would be the case, but I'll post updates if they come.

               

              Please let me know if the patch works for you.

               

              Jacob

              2 of 2 people found this helpful
              • 4. Re: Problems with whitelist...
                JacobT_81

                Hi gucoc_2136321,

                 

                Did this patch work for you?

                 

                Jacob

                • 5. Re: Problems with whitelist...

                  No,

                   

                  may be some thing is wrong. in attach the src code.

                   

                  #include "wiced.h"
                  #include "platform.h"
                  #include "wiced_bt_ble.h"
                  #include "wiced_bt_dev.h"
                  #include "wiced_bt_cfg.h"
                  #include "wiced_bt_stack.h"
                  #include "wiced_bt_ble_observe_patch.h"
                  #include "wiced_bt_ble_observe_with_white_list_patch.h"
                  
                  #define num_of_white_list_addrs 2
                  
                  void ble_scan_results_callback( wiced_bt_ble_scan_results_t* p_scan_result, uint8_t* p_adv_data )
                  {
                      if ( p_scan_result != NULL )
                      {
                      printf("rssi - %d\n", p_scan_result->rssi);
                      printf("remote_bd_addr - %02X:%02X:%02X:%02X:%02X:%02X\n", p_scan_result->remote_bd_addr[0], p_scan_result->remote_bd_addr[1], p_scan_result->remote_bd_addr[2],p_scan_result->remote_bd_addr[3], p_scan_result->remote_bd_addr[4], p_scan_result->remote_bd_addr[5]);
                      printf("ble_evt_type - %d\n", p_scan_result->ble_evt_type);
                      printf("ble_addr_type - %d\n", p_scan_result->ble_addr_type);
                      printf("flag - %d\n", p_scan_result->flag);
                      }
                  
                  
                      printf ("list size - %u\n", wiced_bt_ble_get_white_list_size()); //<== allways 128???
                  
                  
                      printf("-------------------------------------\n");
                  }
                  
                  
                  /* Bluetooth management event handler */
                  static wiced_bt_dev_status_t ble_hps_client_stack_init_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t* p_event_data )
                  {
                      wiced_bt_dev_status_t bt_dev_status = p_event_data->enabled.status;
                  
                    uint8_t addr_array[num_of_white_list_addrs * BD_ADDR_LEN] = { 0xDE, 0x9E, 0x75, 0x34, 0x7C, 0x0B,
                    0x0B, 0x7C, 0x34, 0x75, 0x9E, 0xDE};
                  
                  
                      switch ( event )
                      {
                          case BTM_ENABLED_EVT:
                  
                  
                              /* Initialize GATT REST API Server once Bluetooth controller and host stack is enabled */
                              if ( bt_dev_status == WICED_BT_SUCCESS )
                              {
                                  printf("Scanning for peripheral devices\n");
                  
                  
                                  if(WICED_FALSE == wiced_bt_ble_clear_white_list())
                    printf("error - clear white list\n");
                  
                  
                    printf ("white list size - %u\n", wiced_bt_ble_get_white_list_size());
                  
                  
                    wiced_bt_ble_observe_with_white_list_patch( WICED_TRUE, //enable,
                    BTM_BLE_SCAN_MODE_ACTIVE, //scan_type,
                    4800, //scan_int
                    400, //scan_win
                    1, //scan_filter_policy
                    0, //duration
                    BLE_ADDR_PUBLIC, //addr_type
                    0, //duplicate_filt
                    num_of_white_list_addrs, //num_of_white_list_addrs
                    addr_array, //addr_array
                    ble_scan_results_callback); //p_scan_result_cback
                              }
                              else
                              {
                                  bt_dev_status = WICED_BT_ERROR;
                              }
                              break;
                  
                  
                          default:
                              WPRINT_LIB_INFO( ( "Unhandled event[%u]\n", (unsigned int)event ) );
                              break;
                      }
                  
                  
                      return bt_dev_status;
                  }
                  
                  void application_start( )
                  {
                      /* Initialise the WICED device */
                      //wiced_init();
                     while(WICED_BT_SUCCESS != wiced_bt_stack_init( ble_hps_client_stack_init_callback, &wiced_bt_cfg_settings2, wiced_bt_cfg_buf_pools2 ));
                  
                  
                  }
                  
                  • 6. Re: Problems with whitelist...
                    JacobT_81

                    Try my parameters:

                     

                    #define MAX_ADDR_COUNT 4
                    
                    //Add here the addresses you want to listen for
                    uint8_t BD_ADDRS[MAX_ADDR_COUNT * BD_ADDR_LEN] = {
                      0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                      0x00, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                      0xc0, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                      0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xc0
                    };
                    
                    wiced_bt_ble_observe_with_white_list_patch
                    (
                              1, /*1 on, 0 off*/
                              1, /*1 active, 0 passive*/
                              18, /*in BT slots*/
                              18, /*in BT slots*/
                              1, /*1 whitelist filter, 0 no filter*/
                              255, /*max 255 in whole seconds*/
                              BLE_ADDR_RANDOM, /*BLE_ADDR_PUBLIC, BLE_ADDR_RANDOM, BLE_ADDR_PUBLIC_ID, BLE_ADDR_RANDOM_ID*/
                              1, /*1 on, 0 off*/
                              MAX_ADDR_COUNT, /*num of whitelist addrs*/
                              BD_ADDRS, /*array of wl addrs*/
                              ble_scanner_results_cb /*cb*/
                    );
                    

                     

                     

                    Jacob

                    • 7. Re: Problems with whitelist...

                      Hello,

                       

                      The same result, I couldn't get any scan results.

                       

                      BR,

                      Gustavo

                      • 8. Re: Problems with whitelist...
                        JacobT_81

                        It's virtually identical to yours, but please try the included sample app.

                         

                        What hardware are you working on?

                         

                        Jacob

                        • 9. Re: Problems with whitelist...
                          JacobT_81

                          Hi gucoc_2136321,

                           

                          Were you able to get the code working?

                           

                          Jacob

                          • 10. Re: Problems with whitelist...

                            Hello JacobT_81,

                             

                            Doesn't work, my hardware is the board:

                            BCM9WCD5EVAL1_3 with boardcom BCM943341WCD1_2

                             

                            Gustavo

                            • 11. Re: Problems with whitelist...
                              AxLi_1746341

                              The latest feedback shows it's still does not work.

                              How is the status of this issue?

                              • 12. Re: Problems with whitelist...
                                RoHe_4370821

                                Hello JacobT_81,

                                 

                                I am using WICED-SDK Version: Wiced_006.004.000.0061 on a 4343W device. I have found that I have to use wiced_bt_ble_observe() to receive advertisements from a peripheral that advertises with only Flags bit 2 set. However, I would like to be able to whitelist two such peripheral devices.

                                 

                                I see you offered a patch back in 2016. There appears to be no positive feedback from the customer regarding the patch. Please could you let me know if there are any new recommendations for whitelisting BD addresses whilst using wiced_bt_ble_observe().

                                 

                                Regards,
                                Rob