This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

A peripheral that scans for nonconnectable advertisements to get data

I thought this would be rather simple as I would design a BLE peripheral in the usual way but the source of data for the peripheral comes from a sensor sending nonconnectable advertisements.

The logical approach seemed to be 

  • start advertising
  • wait for a connection event and then start a scanner
  • in the received advertisement callback, place the packet in a queue
  • read the queue and convert the data to the appropriate measurement characteristic expected by the central I am connected with
  • notify the data

However, when looking at the sd_ble_gap_scan_start documentation for s140 it is unclear to me what it can do. I have the following questions/uncertainties:

  1. The method seems strongly coupled to the sd_ble_gap_connect method which I have no intention to use. What are the consequences of that?
  2. I cannot use addresses as filters or whitelists but I could have used manufacturer data if such a filter existed. So I assume there is no hardware filtering on this scanner and I will need to do it myself in the advertisement callback - if there is a more efficient means of filtering out unwanted advertisements that would be nice (like non-connectable only)
  3. I am not even sure the method will pass up non-connectable advertisements - there is no mention of them in the documentation.
  4. Will the fact I have configured SoftDevice as a peripheral make it impossible to scan in the first place? How can I be both an Observer and a peripheral? (Note observer here is not the 'observer' mentioned in the Nordic SDK - I don't know what those observers are. Observer here is the BTLE watcher of broadcasts.)
  5. What kind of conflict will arise by scanning at the same time as being connected - can I run the scanner at 'full throttle'?

Thanks

Parents
  • Hi Brian, 

    I don't see any problem with what you want to achieve. But note that there is only one radio on the nRF52 so the softdevice has to switch between different role. If you have lots of data to transfer between the peripheral and its central, the scan duty cycle will be reduced resulting that you can't catch 100% of all advertising packets. 

    1. If you don't use connect_if_match, the sd_ble_gap_connect () will not be called when there is a matched advertising packet. 

    2. No, any filter except from using address will need to be done in the code, including the advertising data. 

    3. Yes, it should show non-connectable advertising packet AFAIK. 

    4. There is no limitation that the peripheral can't scan. The softdevice (S140) supports all roles concurrently. 

     5. As I mentioned in the beginning. The scheduler on the softdevice handle different task concurrently based on priority. You can read more about the priority of different roles/tasks of the softdevice here

Reply
  • Hi Brian, 

    I don't see any problem with what you want to achieve. But note that there is only one radio on the nRF52 so the softdevice has to switch between different role. If you have lots of data to transfer between the peripheral and its central, the scan duty cycle will be reduced resulting that you can't catch 100% of all advertising packets. 

    1. If you don't use connect_if_match, the sd_ble_gap_connect () will not be called when there is a matched advertising packet. 

    2. No, any filter except from using address will need to be done in the code, including the advertising data. 

    3. Yes, it should show non-connectable advertising packet AFAIK. 

    4. There is no limitation that the peripheral can't scan. The softdevice (S140) supports all roles concurrently. 

     5. As I mentioned in the beginning. The scheduler on the softdevice handle different task concurrently based on priority. You can read more about the priority of different roles/tasks of the softdevice here

Children
No Data
Related