Scan filtering with address

Dear all,

I'm new to BLE development and have as many others encountered some challenges when trying to scan for a peripheral device using the address filter in the scanning module.

When using the UUID filter and/or name filter there's no problem to find and connect to the peripheral device. 

When connected to the peripheral device a print out, in our test software, of the connected device address will be made and has the format of:

AA:BB:CC:DD:DD:EE.

As I have understood it should a BLE adress contains 6 bytes of the actual address and also 1 byte  which contains the adress type (public, random etc etc.)

  • This sums up to my first question, how should the input format be when adding the filter with the bt_scan_filter_add -function? (must the input data be of the type "bt_addr_le_t" ?)

If I then apply one of the working filters (naming filter for instance) and disables the ".connect_if_match" option I will be able to see a filter match by printing data in the callback function "

scan_filter_match". If I then print the adress type and adress array for the device matching the filter i will be given the following information:
addr->type:01
addr->a.val[0] = DD  
addr->a.val[1] = DD
addr->a.val[2] = CC
-       "       - [3] = BB
-       "       - [4] = AA
-       "       - [5] =  FF
Which sums up to the conclusion that my peripheral device currently is advertising with a random address of DD:DD:CC:BB:AA:FF. 
The adress sticks the same after reboot.
So to my question, how come I get one address when connected to the device(AA:BB:CC:DD:DD:EE) and another during advertising (DD:DD:CC:BB:AA:FF) ?
I also tried the advertising option "BT_LE_ADV_NCONN_IDENTITY" for the peripherial device but could not see any change in the data recived in the scan_filter_match function.
Kind regards,
Max
Parents Reply Children
Related