This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Setting maxScanResponses to 0

Other Parts Discussed in Thread: BLE-STACK

I am testing scanning using BLE-STACK 1.4 and SimplePeripheralObserver. I removed the code to set maxScanResponses to 15:

// uint8 scanRes = 15;

// GAPRole_SetParameter( GAPOBSERVERROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );

This will keep the DEFAULT value of 0, however I am no longer getting any GAP_DEVICE_INFO_EVENT events. As I understand this is the maximum number of scan results to receive in a single scan (including Advertising events and Scan Responses). I really do not want any filtering.

  1. Is this the definition of maxScanResponses ?
  2. Does 0 mean infinite as described in observer.h and peripheralObserverProfile.h?
  3. Will setting to maxScanResponses  to a large number such as >175 fill the heap with responses to filter on?
  4. Is there another way to turn this filtering off?
  • Hi Daniel,

    I assume you mean simpleBLEObserver. It's setting default max scan responses to 8 by following commands

    // Maximum number of scan responses
    
    #define DEFAULT_MAX_SCAN_RES 8
    
    // Setup Observer Profile
    {
    uint8 scanRes = DEFAULT_MAX_SCAN_RES;
    GAPObserverRole_SetParameter ( GAPOBSERVERROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
    }
    

    If you do not setup the parameter, it'll be zero and you will not get any responses I think. I checked the source and there is no limiting checkpoint to allocate "to many" so be careful. it's an uint8 so you could theoretically set up to 255 max scan responses although I would not recommend that. 

    Also put some thoughts to Scan window and Scan Interval so that you may have some mathematical backup on how many you should be able to observe.

    Best Regards

    Joakim

  • Joakim,

    My goal is to receive as many advertisements as my desktop does but 0 is defined as unlimited, this is a fairly bad bug since we're not getting any advertisements. How can I work around this problem?

  • Hi Daniel,

    You could scan for short amounts of time (recharge once a second) and allow a high number of received devices which would over time allow you to catch more. How many advertisers do you anticipate in the surroundings?

    Note that the stack filters so you don't get multiple advertisements from same peer device.

    Best Regards

    Joakim

  • Joakim,

    I expect to hear from about 100 unique devices per second, some will advertise more than others. Also skipping a second isn't really reasonable for me as I could miss some broadcasts while sleeping, some broadcasters may only transmit every couple of seconds. Hearing from the same device in the same scan really isn't an problem for me, in fact it would be preferable. How can I disable the stack's filter?

    -Dan

  • Hey Daniel,

    I understand, that's a lot of devices.

    Daniel Schultze said:
    How can I disable the stack's filter?

    GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS, FALSE);

    However, you won't get an update if the advertise data is the same.

    Best Regards

    Joakim

  • Joakim Lindh said:

    How can I disable the stack's filter?

    GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS, FALSE);

    However, you won't get an update if the advertise data is the same.

    [/quote]

    I think I might be missing something here, FALSE means filter advertisements with same advertising data? If that's the case what does true mean?

  • I'm updating the advertising data in the peripheral/Broadcaster by turning advertising off, updating advert data (increasing some uint16 dummy value in the advertData) and then turning advertising back on. (This is a function that gets executed every 200ms. It has its own timer) However, my periphera/Observer only gets 1 GAP_DEVICE_INFO_EVENT if .

    What could I be missing?