Skip to content
Open
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
4 changes: 4 additions & 0 deletions doc/nrf-bm/release_notes/release_notes_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ No changes since the latest nRF Connect SDK Bare Metal release.
Libraries
=========

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

* BLE Advertising library.

* :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