Is ble_adv_stop() missing from sdk-nrf-bm?

Hello, I'm working on a BLE peripheral (nRF54L15) using the S115 SoftDevice in the bare metal SDK.

I'm considering a feature to stop BLE advertising before the advertising timeout expires, but I don't see a method in the ble_adv API: https://github.com/nrfconnect/sdk-nrf-bm/blob/v1.0.0/include/bm/bluetooth/ble_adv.h

For evaluation I was able to successfully use `sd_ble_gap_adv_stop()` and manually set the ble_adv->mode_current to BLE_ADV_MODE_IDLE. But it raised some questions about why the ble_adv module doesn't provide a stop method along with the start. Is this something that's intentionally not supported? What are the risks of bypassing the ble_adv module and using the softdevice call instead?

My evaluation implementation below:

int SoftDeviceAdapter::adv_stop(struct ble_adv *ble_adv)
{
    if (ble_adv == nullptr)
    {
        return -1;
    }

    // Call SoftDevice to stop advertising
    int err = sd_ble_gap_adv_stop(ble_adv->adv_handle);

    // NRF_ERROR_INVALID_STATE means advertising is not running. This is fine, we want it stopped.
    if (err && err != NRF_ERROR_INVALID_STATE)
    {
        LOG_ERROR("Failed to stop advertising, nrf_error %#x", err);
        return err;
    }

    // Manually reset the state to IDLE
    ble_adv->mode_current = BLE_ADV_MODE_IDLE;

    return 0;
}

Parents Reply Children
No Data
Related