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

whitelist response

Hi, 

I am running the following setup, both on nRF52840-DK: 

1. Central : Always scans , when he finds devices with NUS service -> Initiate a connection 

2. Peripheral : advertise with "BLE_GAP_ADV_FP_FILTER_CONNREQ" , using a whitelist. 

So, if a Central that is not in the Peripheral whitelist  tries to connect - connect will not happen . otherwise - NUS is connected and working. so far so good !

Now - on the Central side : 

1. when a central that is not on the peripheral's whitelist tries to connect ( using sd_ble_gap_connect) - I do not get "BLE_EVT_GAP_CONNECTED" event which is ok. BUT - I do not get any other indication that the connection is rejected . ( not even TIMEOUT or TERMINATED ) . I'd like to be able to tell when my connection has been rejected 

2. After the above event, scanning does not work any more .  

I'd like to get your help understanding how to fix the above 

Thanks, 

Ran 

Parents
  • Hi,

    What have you set as the timeout parameter in p_scan_params struct that you pass to sd_ble_gap_connect? If you set this to 0, you will not get any TIMEOUT events. You can call sd_ble_gap_connect_cancel() to cancel the connection establishment procedure.

    Best regards,
    Jørgen

  • Thanks, I am using timeout 0 . 

    1. I'd like to scan with "0" timeout ( continuously ) BUT connect with timeout .

    How do I do that ? have another instance of p_scan_param ? ( 1 for scan and 1 for sd_ble_gap_connect? ) 

    2. Why does sd_ble_gap_connect needs scanning parameters ? we pass connection param as a parameter .

    If I set scan timeout =x ,  I assume I get the following  :

    when scanning timeout elapse I get : p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_CONN

    When calling sd_ble_gap_connet and connection does not happen , I get p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN.

    Is this correct ? 

    Ran

  • ran said:
    How do I do that ? have another instance of p_scan_param ? ( 1 for scan and 1 for sd_ble_gap_connect? ) 

    Yes, you should use two separate instances.

    ran said:
    2. Why does sd_ble_gap_connect needs scanning parameters ? we pass connection param as a parameter .

    The connect procedure will actually start a new scan with a given target device address. It will require the scan_params to setup the scan.

    ran said:

    If I set scan timeout =x ,  I assume I get the following  :

    when scanning timeout elapse I get : p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_CONN

    When calling sd_ble_gap_connet and connection does not happen , I get p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN.


    Is this correct ?

    No, it should be the other way around.

Reply
  • ran said:
    How do I do that ? have another instance of p_scan_param ? ( 1 for scan and 1 for sd_ble_gap_connect? ) 

    Yes, you should use two separate instances.

    ran said:
    2. Why does sd_ble_gap_connect needs scanning parameters ? we pass connection param as a parameter .

    The connect procedure will actually start a new scan with a given target device address. It will require the scan_params to setup the scan.

    ran said:

    If I set scan timeout =x ,  I assume I get the following  :

    when scanning timeout elapse I get : p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_CONN

    When calling sd_ble_gap_connet and connection does not happen , I get p_gap_evt->params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN.


    Is this correct ?

    No, it should be the other way around.

Children
No Data
Related