Skip to content

Commit 1b81cd8

Browse files
committed
bluetooth: services: ble_bas: return errors from SoftDevice directly
Return erros from SoftDevice directly. Signed-off-by: Emanuele Di Santo <[email protected]>
1 parent a7572e2 commit 1b81cd8

File tree

2 files changed

+7
-4
lines changed
  • include/bm/bluetooth/services
  • subsys/bluetooth/services/ble_bas

2 files changed

+7
-4
lines changed

include/bm/bluetooth/services/ble_bas.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ struct ble_bas {
179179
*
180180
* @retval NRF_SUCCESS On success.
181181
* @retval NRF_ERROR_NULL If @p bas or @p bas_config are @c NULL.
182-
* @retval NRF_ERROR_INVALID_PARAM Invalid parameters.
182+
* @return In addition, this function may return any error returned by these SoftDevice functions:
183+
* - @ref sd_ble_gatts_service_add(),
184+
* - @ref sd_ble_gatts_characteristic_add(),
185+
* - @ref sd_ble_gatts_descriptor_add().
183186
*/
184187
uint32_t ble_bas_init(struct ble_bas *bas, const struct ble_bas_config *bas_config);
185188

subsys/bluetooth/services/ble_bas/bas.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ uint32_t ble_bas_init(struct ble_bas *bas, const struct ble_bas_config *cfg)
144144
&bas->service_handle);
145145
if (nrf_err) {
146146
LOG_ERR("Failed to add battery service, nrf_error %#x", nrf_err);
147-
return NRF_ERROR_INVALID_PARAM;
147+
return nrf_err;
148148
}
149149

150150
/* Add battery level characteristic */
151151
nrf_err = battery_level_char_add(bas, cfg);
152152
if (nrf_err) {
153153
LOG_ERR("Failed to add battery service characteristic, nrf_error %#x", nrf_err);
154-
return NRF_ERROR_INVALID_PARAM;
154+
return nrf_err;
155155
}
156156

157157
/* Add reference descriptor if present */
@@ -160,7 +160,7 @@ uint32_t ble_bas_init(struct ble_bas *bas, const struct ble_bas_config *cfg)
160160
if (nrf_err) {
161161
LOG_ERR("Failed to add report reference descriptor, nrf_error %#x",
162162
nrf_err);
163-
return NRF_ERROR_INVALID_PARAM;
163+
return nrf_err;
164164
}
165165
}
166166

0 commit comments

Comments
 (0)