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

SDk12 ble_app_hrs_rscs_relay has no BLE_ADV_EVT_IDLE in on_adv_evt

Hi I use ble_app_hrs_rscs_relay example with sdk12 and when the APP_ADV_TIMEOUT_IN_SECONDS is reach the nrf52 stop advertising but the on_adv_evt has no BLE_ADV_EVT_IDLE flag coming.

I do ble_advertising_start only now. Do I need call sd_ble_gap_scan_start on the same time with this example.

Thanks

Parents
  • FormerMember
    0 FormerMember

    The reason for the problem is a bug in ble_evt_dispatch():

    When there is a BLE event, the BLE events will be forwarded to the relevant modules based on the roles. However, when there is an advertising timeout, no role is assigned, and hence, the BLE event is not forwarded to the advertising module. The following line will make the advertising timeout being forwarded to BLE peripheral event handling:

    if ( (role == BLE_GAP_ROLE_PERIPH) || (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) )
    

    Update 17.01.2017: To make sure that it is the advertising event that occurs, it is also necessary to check the event id, the code could then look like the following:

    if ( (role == BLE_GAP_ROLE_PERIPH) ||((p_ble_evt->header.evt_id == BLE_GAP_EVT_TIMEOUT) && (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING))  )
    {
        ....
    
Reply
  • FormerMember
    0 FormerMember

    The reason for the problem is a bug in ble_evt_dispatch():

    When there is a BLE event, the BLE events will be forwarded to the relevant modules based on the roles. However, when there is an advertising timeout, no role is assigned, and hence, the BLE event is not forwarded to the advertising module. The following line will make the advertising timeout being forwarded to BLE peripheral event handling:

    if ( (role == BLE_GAP_ROLE_PERIPH) || (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) )
    

    Update 17.01.2017: To make sure that it is the advertising event that occurs, it is also necessary to check the event id, the code could then look like the following:

    if ( (role == BLE_GAP_ROLE_PERIPH) ||((p_ble_evt->header.evt_id == BLE_GAP_EVT_TIMEOUT) && (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING))  )
    {
        ....
    
Children
Related