Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions applications/firmware_loader/ble_mcumgr/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ static int ble_change_address(void)
int main(void)
{
int err;
uint32_t nrf_err;
struct ble_adv_config ble_adv_cfg = {
.conn_cfg_tag = CONFIG_NRF_SDH_BLE_CONN_TAG,
.evt_handler = ble_adv_evt_handler,
Expand Down Expand Up @@ -231,17 +232,15 @@ int main(void)
ble_adv_cfg.sr_data.uuid_lists.complete.uuid = &adv_uuid_list[0];
ble_adv_cfg.sr_data.uuid_lists.complete.len = ARRAY_SIZE(adv_uuid_list);

err = ble_adv_init(&ble_adv, &ble_adv_cfg);

if (err) {
LOG_ERR("Failed to initialize advertising, err %d", err);
nrf_err = ble_adv_init(&ble_adv, &ble_adv_cfg);
if (nrf_err) {
LOG_ERR("Failed to initialize advertising, nrf_error %#x", nrf_err);
return 0;
}

err = ble_adv_start(&ble_adv, BLE_ADV_MODE_FAST);

if (err) {
LOG_ERR("Failed to start advertising, err %d", err);
nrf_err = ble_adv_start(&ble_adv, BLE_ADV_MODE_FAST);
if (nrf_err) {
LOG_ERR("Failed to start advertising, nrf_error %#x", err);
return 0;
}

Expand Down
54 changes: 27 additions & 27 deletions doc/nrf-bm/libraries/bluetooth/ble_peer_manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ The following code example shows how the Peer Manager is initialized:

static int peer_manager_init(bool erase_bonds)
{
uint32_t err;
uint32_t nrf_err;
ble_gap_sec_params_t sec_param;

err = pm_init();
if (err) {
nrf_err = pm_init();
if (nrf_err) {
return -EFAULT;
}

Expand All @@ -179,15 +179,15 @@ The following code example shows how the Peer Manager is initialized:
.kdist_peer.id = 1,
};

err = pm_sec_params_set(&sec_param);
if (err) {
LOG_ERR("pm_sec_params_set() failed, err: 0x%x", err);
nrf_err = pm_sec_params_set(&sec_param);
if (nrf_err) {
LOG_ERR("pm_sec_params_set() failed, nrf_error: 0x%x", nrf_err);
return -EFAULT;
}

err = pm_register(pm_evt_handler);
if (err) {
LOG_ERR("pm_register() failed, err: 0x%x", err);
nrf_err = pm_register(pm_evt_handler);
if (nrf_err) {
LOG_ERR("pm_register() failed, nrf_error: 0x%x", nrf_err);
return -EFAULT;
}
}
Expand Down Expand Up @@ -348,25 +348,25 @@ The store operation is finished when either the :c:enum:`PM_EVT_PEER_DATA_UPDATE

.. code-block:: c

uint32_t err;
uint32_t nrf_err;
pm_store_token_t store_token;

err = pm_peer_data_remote_db_store(peer_id, array_of_services, number_of_services, &store_token);
if (err != NRF_ERROR_BUSY) {
return err;
nrf_err = pm_peer_data_remote_db_store(peer_id, array_of_services, number_of_services, &store_token);
if (nrf_err != NRF_ERROR_BUSY) {
return nrf_err;
}

The :c:func:`pm_peer_data_remote_db_store`, :c:func:`pm_peer_data_bonding_store`, and :c:func:`pm_peer_data_app_data_store` functions call the :c:func:`pm_peer_data_store` function.
The :c:func:`pm_peer_data_store` function can also be used directly, as in the following example:

.. code-block:: c

uint32_t err;
uint32_t nrf_err;
pm_store_token_t store_token;

err = pm_peer_data_store(peer_id, PM_PEER_DATA_ID_GATT_REMOTE, array_of_services, number_of_services, &store_token);
if (err != NRF_ERROR_BUSY) {
return err;
nrf_err = pm_peer_data_store(peer_id, PM_PEER_DATA_ID_GATT_REMOTE, array_of_services, number_of_services, &store_token);
if (nrf_err != NRF_ERROR_BUSY) {
return nrf_err;
}

Using a whitelist
Expand All @@ -392,9 +392,9 @@ The following example shows how to use the :c:func:`pm_whitelist_set` function t
}

/* Whitelist peers. */
err = pm_whitelist_set(peer_ids, n_peer_ids);
if (err != NRF_SUCCESS) {
return err;
nrf_err = pm_whitelist_set(peer_ids, n_peer_ids);
if (nrf_err != NRF_SUCCESS) {
return nrf_err;
}
}

Expand All @@ -409,7 +409,7 @@ The following example shows how to use the :c:func:`pm_whitelist_set` function t
* previously whitelisted using pm_whitelist_set().
*/

uint32_t err;
uint32_t nrf_err;

/* Storage for the whitelist. */
ble_gap_irk_t irks[8] = {0};
Expand All @@ -418,15 +418,15 @@ The following example shows how to use the :c:func:`pm_whitelist_set` function t
uint32_t irk_cnt = 8;
uint32_t addr_cnt = 8;

err = pm_whitelist_get(addrs, &addr_cnt, irks, &irk_cnt);
if (err != NRF_SUCCESS) {
return err;
nrf_err = pm_whitelist_get(addrs, &addr_cnt, irks, &irk_cnt);
if (nrf_err != NRF_SUCCESS) {
return nrf_err;
}

/* Apply the whitelist. */
err = ble_advertising_whitelist_reply(addrs, addr_cnt, irks, irk_cnt);
if (err != NRF_SUCCESS) {
return err;
nrf_err = ble_advertising_whitelist_reply(addrs, addr_cnt, irks, irk_cnt);
if (nrf_err != NRF_SUCCESS) {
return nrf_err;
}

break;
Expand Down
20 changes: 16 additions & 4 deletions doc/nrf-bm/release_notes/release_notes_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ Boards

* MCUboot partition size has been reduced from 36 KiB to 31 KiB for the following board targets:

* `bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot`
* `bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot`
* `bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot`
* ``bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot``
* ``bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot``
* ``bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot``

* Removed unused peripheral nodes from Devicetree.

DFU
===

* Support for KMU usage for MCUboot keys has been added, along with west auto-provisioning support (`west flash --erase` or `west flash --recover` must be used during first programming of a board to program the KMU with the keys).
* Support for KMU usage for MCUboot keys has been added, along with west auto-provisioning support (``west flash --erase`` or ``west flash --recover`` must be used during first programming of a board to program the KMU with the keys).
This feature can be controlled with sysbuild Kconfig options :kconfig:option:`SB_CONFIG_BM_BOOTLOADER_MCUBOOT_SIGNATURE_USING_KMU` to use KMU for key storage and :kconfig:option:`SB_CONFIG_BM_BOOTLOADER_MCUBOOT_GENERATE_DEFAULT_KMU_KEYFILE` to auto-provision the KMU when using the above west flash commands.
* The code for the UART MCUmgr application has now been refactored into a separate library to facilitate reuse in other applications.

Expand All @@ -68,6 +68,18 @@ No changes since the latest nRF Connect SDK Bare Metal release.
Libraries
=========

* Updated the following libraries and BLE services to return ``nrf_errors`` instead of ``errnos``:

* BLE Advertising library.
* :ref:`lib_ble_conn_params` library.
* BLE Gatt Queue library.
* BLE QWR library.
* BLE Record Access Control Point library.
* :ref:`lib_ble_service_bas` service.
* :ref:`lib_ble_service_dis` service.
* :ref:`lib_ble_service_hrs` service.
* :ref:`lib_ble_service_lbs` service.

* :ref:`lib_ble_conn_params` library:

* Added missing Kconfig dependencies.
Expand Down
61 changes: 31 additions & 30 deletions include/bm/bluetooth/ble_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct ble_adv_evt {
union {
/** @ref BLE_ADV_EVT_ERROR event data. */
struct {
int reason;
uint32_t reason;
} error;
};
};
Expand Down Expand Up @@ -256,19 +256,19 @@ void ble_adv_on_ble_evt(const ble_evt_t *ble_evt, void *ble_adv);
* @param[in] ble_adv BLE advertising instance.
* @param[in] ble_adv_config Initialization configuration.
*
* @retval 0 On success.
* @retval -FAULT If @p ble_adv or @p ble_adv_config are @c NULL.
* @retval -EINVAL If the configuration @p ble_adv_config is invalid.
* @retval NRF_SUCCESS On success.
* @retval NRF_ERROR_NULL If @p ble_adv or @p ble_adv_config are @c NULL.
* @retval NRF_ERROR_INVALID_PARAM If the configuration @p ble_adv_config is invalid.
*/
int ble_adv_init(struct ble_adv *ble_adv, struct ble_adv_config *ble_adv_config);
uint32_t ble_adv_init(struct ble_adv *ble_adv, struct ble_adv_config *ble_adv_config);

/**
* @brief Set the connection configuration tag used for connections.
*
* @param[in] ble_adv BLE advertising instance.
* @param[in] ble_cfg_tag Connection configuration tag.
*/
int ble_adv_conn_cfg_tag_set(struct ble_adv *ble_adv, uint8_t ble_cfg_tag);
uint32_t ble_adv_conn_cfg_tag_set(struct ble_adv *ble_adv, uint8_t ble_cfg_tag);

/**
* @brief Start advertising in given mode.
Expand All @@ -279,12 +279,12 @@ int ble_adv_conn_cfg_tag_set(struct ble_adv *ble_adv, uint8_t ble_cfg_tag);
* @param[in] ble_adv BLE advertising instance.
* @param[in] mode Desired advertising mode.
*
* @retval 0 On success.
* @retval -EPERM Library is not initialized.
* @retval -EFAULT @p ble_adv is @c NULL.
* @retval -EINVAL Invalid parameters.
* @retval NRF_SUCCESS On success.
* @retval NRF_ERROR_INVALID_STATE Library is not initialized.
* @retval NRF_ERROR_NULL @p ble_adv is @c NULL.
* @retval NRF_ERROR_INVALID_PARAM Invalid parameters.
*/
int ble_adv_start(struct ble_adv *ble_adv, enum ble_adv_mode mode);
uint32_t ble_adv_start(struct ble_adv *ble_adv, enum ble_adv_mode mode);

/**
* @brief Set the peer address for directed advertising.
Expand All @@ -296,12 +296,12 @@ int ble_adv_start(struct ble_adv *ble_adv, enum ble_adv_mode mode);
* @param[in] p_advertising Advertising Module instance.
* @param[in] p_peer_addr Pointer to a peer address.
*
* @retval 0 On success.
* @retval -EPERM Library is not initialized.
* @retval -EFAULT @p ble_adv is @c NULL.
* @retval -EINVAL Invalid parameters.
* @retval NRF_SUCCESS On success.
* @retval NRF_ERROR_INVALID_STATE Library is not initialized.
* @retval NRF_ERROR_NULL @p ble_adv is @c NULL.
* @retval NRF_ERROR_INVALID_PARAM Invalid parameters.
*/
int ble_adv_peer_addr_reply(struct ble_adv *ble_adv, const ble_gap_addr_t *peer_addr);
uint32_t ble_adv_peer_addr_reply(struct ble_adv *ble_adv, const ble_gap_addr_t *peer_addr);

/**
* @brief Set a whitelist for fast and slow advertising.
Expand All @@ -315,14 +315,14 @@ int ble_adv_peer_addr_reply(struct ble_adv *ble_adv, const ble_gap_addr_t *peer_
* @param[in] gap_irks The list of peer IRK to whitelist.
* @param[in] irk_cnt The number of peer IRK to whitelist.
*
* @retval 0 On success.
* @retval -EPERM Library is not initialized.
* @retval -EFAULT @p ble_adv is @c NULL.
* @retval -EINVAL Invalid parameters.
* @retval NRF_SUCCESS On success.
* @retval NRF_ERROR_INVALID_STATE Library is not initialized.
* @retval NRF_ERROR_NULL @p ble_adv is @c NULL.
* @retval NRF_ERROR_INVALID_PARAM Invalid parameters.
*/
int ble_adv_whitelist_reply(struct ble_adv *ble_adv,
const ble_gap_addr_t *gap_addrs, uint32_t addr_cnt,
const ble_gap_irk_t *gap_irks, uint32_t irk_cnt);
uint32_t ble_adv_whitelist_reply(struct ble_adv *ble_adv,
const ble_gap_addr_t *gap_addrs, uint32_t addr_cnt,
const ble_gap_irk_t *gap_irks, uint32_t irk_cnt);

/**
* @brief Restart advertising without whitelist.
Expand All @@ -332,11 +332,12 @@ int ble_adv_whitelist_reply(struct ble_adv *ble_adv,
*
* @param[in] ble_adv Advertising Module instance.
*
* @retval 0 On success.
* @retval -EPERM Library is not initialized.
* @retval -EFAULT @p ble_adv is @c NULL.
* @retval NRF_SUCCESS On success.
* @retval NRF_ERROR_INVALID_STATE Library is not initialized.
* @retval NRF_ERROR_NULL @p ble_adv is @c NULL.
* @retval NRF_ERROR_INVALID_PARAM Invalid advertising parameters.
*/
int ble_adv_restart_without_whitelist(struct ble_adv *ble_adv);
uint32_t ble_adv_restart_without_whitelist(struct ble_adv *ble_adv);

/**@brief Function for updating advertising data.
*
Expand All @@ -355,9 +356,9 @@ int ble_adv_restart_without_whitelist(struct ble_adv *ble_adv);
* @retval @ref NRF_SUCCESS or any error from @ref ble_advdata_encode or
* @ref sd_ble_gap_adv_set_configure().
*/
int ble_adv_data_update(struct ble_adv *ble_adv,
const struct ble_adv_data *adv,
const struct ble_adv_data *sr);
uint32_t ble_adv_data_update(struct ble_adv *ble_adv,
const struct ble_adv_data *adv,
const struct ble_adv_data *sr);

#ifdef __cplusplus
}
Expand Down
10 changes: 6 additions & 4 deletions include/bm/bluetooth/ble_adv_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ struct ble_adv_data {
* @param[out] buf Output buffer.
* @param[in,out] len Size of @p buf on input, length of encoded data on output.
*
* @retval 0 If the operation was successful.
* @retval -EINVAL Invalid parameter.
* @retval -E2BIG Buffer is too small to encode all data.
* @retval NRF_SUCCESS If the operation was successful.
* @retval NRF_ERROR_INVALID_ADDR Invalid address.
* @retval NRF_ERROR_INVALID_PARAM Invalid parameter provided in the adverising data context.
* @retval NRF_ERROR_NULL @p ble_adv_data, @p buf or @p len is NULL.
* @retval NRF_ERROR_DATA_SIZE Buffer is too small to encode all data.
*
* @warning This API may override the application's request to use the long name and use a short
* name instead. This truncation will occur in case the long name does not fit the provided buffer
Expand All @@ -199,7 +201,7 @@ struct ble_adv_data {
* application can specify, and if the preference is too large to fit in the provided buffer, the
* name can be truncated further.
*/
int ble_adv_data_encode(const struct ble_adv_data *ble_adv_data, uint8_t *buf, uint16_t *len);
uint32_t ble_adv_data_encode(const struct ble_adv_data *ble_adv_data, uint8_t *buf, uint16_t *len);

/**
* @brief Search Advertising or Scan Response data for specific data types.
Expand Down
Loading
Loading