Skip to content

Commit 22afe86

Browse files
committed
include: let SoftDevice BLE event handlers be public
Let all SoftDevice event handlers used for BLE event observers be public, and align their documentation. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
1 parent eb29aa2 commit 22afe86

37 files changed

Lines changed: 283 additions & 226 deletions

File tree

include/bm/bluetooth/ble_adv.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,19 @@ struct ble_adv_config {
238238
};
239239

240240
/**
241-
* @brief Library's Bluetooth LE event handler.
241+
* @brief Bluetooth LE event handler for the advertising library.
242+
*
243+
* @details Handles all Bluetooth LE stack events that are of interest to the
244+
* advertising library.
245+
*
246+
* @note This handler is registered automatically by @ref BLE_ADV_DEF and is
247+
* called by the SoftDevice handler. The application does not need to call
248+
* it directly.
242249
*
243250
* @param[in] ble_evt Bluetooth LE stack event.
244-
* @param[in] ble_adv Advertising Module instance.
251+
* @param[in] adv Pointer to the @ref ble_adv instance.
245252
*/
246-
void ble_adv_on_ble_evt(const ble_evt_t *ble_evt, void *ble_adv);
253+
void ble_adv_on_ble_evt(const ble_evt_t *ble_evt, void *adv);
247254

248255
/**
249256
* @brief Initialize the Bluetooth LE advertising library.

include/bm/bluetooth/ble_db_discovery.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,19 @@ uint32_t ble_db_discovery_service_register(struct ble_db_discovery *db_discovery
241241
const ble_uuid_t *uuid);
242242

243243
/**
244-
* @brief Application's Bluetooth LE Stack event handler.
244+
* @brief Bluetooth LE event handler for the Database Discovery library.
245245
*
246-
* @param[in] ble_evt Event received.
247-
* @param[in,out] context DB discovery instance.
246+
* @details Handles all Bluetooth LE stack events that are of interest to the
247+
* Database Discovery library.
248+
*
249+
* @note This handler is registered automatically by @ref BLE_DB_DISCOVERY_DEF and
250+
* is called by the SoftDevice handler. The application does not need to
251+
* call it directly.
252+
*
253+
* @param[in] ble_evt Bluetooth LE stack event.
254+
* @param[in] db_discovery Pointer to the @ref ble_db_discovery instance.
248255
*/
249-
void ble_db_discovery_on_ble_evt(const ble_evt_t *ble_evt, void *context);
256+
void ble_db_discovery_on_ble_evt(const ble_evt_t *ble_evt, void *db_discovery);
250257

251258
#endif /* BLE_DB_DISCOVERY_H__ */
252259

include/bm/bluetooth/ble_gq.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,19 @@ uint32_t ble_gq_item_add(const struct ble_gq *gatt_queue, struct ble_gq_req *req
300300
uint32_t ble_gq_conn_handle_register(const struct ble_gq *gatt_queue, uint16_t conn_handle);
301301

302302
/**
303-
* @brief Handle Bluetooth LE events from the SoftDevice.
303+
* @brief Bluetooth LE event handler for the GATT Queue library.
304304
*
305-
* @details This function handles the Bluetooth LE events received from the SoftDevice. If an
306-
* event is relevant to the BGQ module, it is used to update internal variables,
307-
* process queued GATT requests and, if necessary, send errors to the application.
305+
* @details Handles all Bluetooth LE stack events that are of interest to the
306+
* GATT Queue library.
308307
*
309-
* @param[in] ble_evt Pointer to the event.
310-
* @param[in] gatt_queue Pointer to the @ref ble_gq instance.
308+
* @note This handler is registered automatically by @ref BLE_GQ_DEF and is
309+
* called by the SoftDevice handler. The application does not need to call
310+
* it directly.
311+
*
312+
* @param[in] ble_evt Bluetooth LE stack event.
313+
* @param[in] gq Pointer to the @ref ble_gq instance.
311314
*/
312-
void ble_gq_on_ble_evt(const ble_evt_t *ble_evt, void *gatt_queue);
315+
void ble_gq_on_ble_evt(const ble_evt_t *ble_evt, void *gq);
313316

314317
#ifdef __cplusplus
315318
}

include/bm/bluetooth/ble_qwr.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,19 @@ uint32_t ble_qwr_init(struct ble_qwr *qwr, const struct ble_qwr_config *qwr_conf
180180
uint32_t ble_qwr_conn_handle_assign(struct ble_qwr *qwr, uint16_t conn_handle);
181181

182182
/**
183-
* @brief Function for handling Bluetooth LE stack events.
183+
* @brief Bluetooth LE event handler for the Queued Writes module.
184184
*
185-
* @details Handles all events from the Bluetooth LE stack that are of interest to the
185+
* @details Handles all Bluetooth LE stack events that are of interest to the
186186
* Queued Writes module.
187187
*
188-
* @param[in] ble_evt Event received.
189-
* @param[in] context Queued Writes structure.
188+
* @note This handler is registered automatically by @ref BLE_QWR_DEF and is
189+
* called by the SoftDevice handler. The application does not need to call
190+
* it directly.
191+
*
192+
* @param[in] ble_evt Bluetooth LE stack event.
193+
* @param[in] qwr Pointer to the @ref ble_qwr instance.
190194
*/
191-
void ble_qwr_on_ble_evt(const ble_evt_t *ble_evt, void *context);
195+
void ble_qwr_on_ble_evt(const ble_evt_t *ble_evt, void *qwr);
192196

193197
#if (CONFIG_BLE_QWR_MAX_ATTR > 0)
194198
/**

include/bm/bluetooth/ble_scan.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ extern "C" {
4242
*/
4343
#define BLE_SCAN_DEF(_name) \
4444
static struct ble_scan _name; \
45-
extern void ble_scan_on_ble_evt(const ble_evt_t *ble_evt, void *ctx); \
4645
NRF_SDH_BLE_OBSERVER(_name##_obs, ble_scan_on_ble_evt, &_name, HIGH)
4746

4847
/**
@@ -565,10 +564,17 @@ uint32_t ble_scan_all_filter_remove(struct ble_scan *scan);
565564
uint32_t ble_scan_params_set(struct ble_scan *scan, const ble_gap_scan_params_t *scan_params);
566565

567566
/**
568-
* @brief Handler for Bluetooth LE stack events.
567+
* @brief Bluetooth LE event handler for the Scanning library.
569568
*
570-
* @param[in] ble_evt Bluetooth LE event.
571-
* @param[in,out] scan Scan library instance.
569+
* @details Handles all Bluetooth LE stack events that are of interest to the
570+
* Scanning library.
571+
*
572+
* @note This handler is registered automatically by @ref BLE_SCAN_DEF and is
573+
* called by the SoftDevice handler. The application does not need to call
574+
* it directly.
575+
*
576+
* @param[in] ble_evt Bluetooth LE stack event.
577+
* @param[in] scan Pointer to the @ref ble_scan instance.
572578
*/
573579
void ble_scan_on_ble_evt(const ble_evt_t *ble_evt, void *scan);
574580

include/bm/bluetooth/services/ble_bas.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ extern "C" {
2929
*/
3030
#define BLE_BAS_DEF(_name) \
3131
static struct ble_bas _name; \
32-
extern void ble_bas_on_ble_evt(const ble_evt_t *ble_evt, void *ctx); \
3332
NRF_SDH_BLE_OBSERVER(_name##_obs, ble_bas_on_ble_evt, &_name, HIGH)
3433

3534
/** @brief Default security configuration. */
@@ -218,6 +217,21 @@ uint32_t ble_bas_init(struct ble_bas *bas, const struct ble_bas_config *bas_conf
218217
uint32_t ble_bas_battery_level_update(struct ble_bas *bas, uint16_t conn_handle,
219218
uint8_t battery_level);
220219

220+
/**
221+
* @brief Bluetooth LE event handler for the Battery Service.
222+
*
223+
* @details Handles all Bluetooth LE stack events that are of interest to the
224+
* Battery Service.
225+
*
226+
* @note This handler is registered automatically by @ref BLE_BAS_DEF and is
227+
* called by the SoftDevice handler. The application does not need to call
228+
* it directly.
229+
*
230+
* @param[in] ble_evt Bluetooth LE stack event.
231+
* @param[in] bas Pointer to the @ref ble_bas instance.
232+
*/
233+
void ble_bas_on_ble_evt(const ble_evt_t *ble_evt, void *bas);
234+
221235
#ifdef __cplusplus
222236
}
223237
#endif

include/bm/bluetooth/services/ble_bas_client.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,19 @@ uint32_t ble_bas_client_init(struct ble_bas_client *bas_client,
157157
const struct ble_bas_client_config *bas_client_config);
158158

159159
/**
160-
* @brief Handle Bluetooth LE events from the SoftDevice.
160+
* @brief Bluetooth LE event handler for the Battery Service Client.
161161
*
162-
* @details This function handles the Bluetooth LE events received from the SoftDevice. If a
163-
* Bluetooth LE event is relevant to the Battery Service Client module, the function uses
164-
* the event's data to update interval variables and, if necessary, send events to the
165-
* application.
162+
* @details Handles all Bluetooth LE stack events that are of interest to the
163+
* Battery Service Client.
166164
*
167-
* @note This function must be called by the application.
165+
* @note This handler is registered automatically by @ref BLE_BAS_CLIENT_DEF and
166+
* is called by the SoftDevice handler. The application does not need to
167+
* call it directly.
168168
*
169-
* @param[in] ble_evt Bluetooth LE event.
170-
* @param[in] context Battery Service client structure.
169+
* @param[in] ble_evt Bluetooth LE stack event.
170+
* @param[in] bas_client Pointer to the @ref ble_bas_client instance.
171171
*/
172-
void ble_bas_client_on_ble_evt(const ble_evt_t *ble_evt, void *context);
172+
void ble_bas_client_on_ble_evt(const ble_evt_t *ble_evt, void *bas_client);
173173

174174
/**
175175
* @brief Enable notifications on the Battery Level characteristic.

include/bm/bluetooth/services/ble_bms.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,19 @@ uint32_t ble_bms_auth_response(struct ble_bms *bms, bool authorize);
314314
uint32_t ble_bms_init(struct ble_bms *bms, struct ble_bms_config *bms_config);
315315

316316
/**
317-
* @brief Handle Bond Management Bluetooth LE stack events.
317+
* @brief Bluetooth LE event handler for the Bond Management Service.
318318
*
319-
* @details This function handles all events from the Bluetooth LE stack that are of interest to the
319+
* @details Handles all Bluetooth LE stack events that are of interest to the
320320
* Bond Management Service.
321321
*
322-
* @param[in] ble_evt Event received.
323-
* @param[in] context BMS structure.
322+
* @note This handler is registered automatically by @ref BLE_BMS_DEF and is
323+
* called by the SoftDevice handler. The application does not need to call
324+
* it directly.
325+
*
326+
* @param[in] ble_evt Bluetooth LE stack event.
327+
* @param[in] bms Pointer to the @ref ble_bms instance.
324328
*/
325-
void ble_bms_on_ble_evt(const ble_evt_t *ble_evt, void *context);
329+
void ble_bms_on_ble_evt(const ble_evt_t *ble_evt, void *bms);
326330

327331
/**
328332
* @brief Handle events from the @ref nrf_ble_qwr.

include/bm/bluetooth/services/ble_cgms.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,19 @@ struct ble_cgms {
590590
uint32_t ble_cgms_init(struct ble_cgms *cgms, const struct ble_cgms_config *cgms_init);
591591

592592
/**
593-
* @brief Function for handling the application's Bluetooth LE stack events.
593+
* @brief Bluetooth LE event handler for the Continuous Glucose Monitoring Service.
594594
*
595-
* @details Handles all events from the Bluetooth LE stack that are of interest to the CGM Service.
595+
* @details Handles all Bluetooth LE stack events that are of interest to the
596+
* Continuous Glucose Monitoring Service.
596597
*
597-
* @param[in] ble_evt Event received.
598-
* @param[in] context Instance of the CGM Service.
598+
* @note This handler is registered automatically by @ref BLE_CGMS_DEF and is
599+
* called by the SoftDevice handler. The application does not need to call
600+
* it directly.
601+
*
602+
* @param[in] ble_evt Bluetooth LE stack event.
603+
* @param[in] cgms Pointer to the @ref ble_cgms instance.
599604
*/
600-
void ble_cgms_on_ble_evt(const ble_evt_t *ble_evt, void *context);
605+
void ble_cgms_on_ble_evt(const ble_evt_t *ble_evt, void *cgms);
601606

602607
/**
603608
* @brief Report a new glucose measurement to the CGM Service module.

include/bm/bluetooth/services/ble_hids.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,19 @@ struct ble_hids {
700700
};
701701

702702
/**
703-
* @brief Function for handling the Application's Bluetooth LE Stack events.
703+
* @brief Bluetooth LE event handler for the HID Service.
704704
*
705-
* @details Handles all events from the Bluetooth LE stack of interest to the HID Service.
705+
* @details Handles all Bluetooth LE stack events that are of interest to the
706+
* HID Service.
706707
*
707-
* @note This function is registered with a NRF_SDH_BLE_OBSERVER and is called automatically
708-
* by the SoftDevice Handler.
708+
* @note This handler is registered automatically by @ref BLE_HIDS_DEF and is
709+
* called by the SoftDevice handler. The application does not need to call
710+
* it directly.
709711
*
710-
* @param[in] ble_evt Event received.
711-
* @param[in] context HID Service structure.
712+
* @param[in] ble_evt Bluetooth LE stack event.
713+
* @param[in] hids Pointer to the @ref ble_hids instance.
712714
*/
713-
void ble_hids_on_ble_evt(const ble_evt_t *ble_evt, void *context);
715+
void ble_hids_on_ble_evt(const ble_evt_t *ble_evt, void *hids);
714716

715717
/**
716718
* @brief Function for initializing the HID Service.

0 commit comments

Comments
 (0)