Skip to content
Merged
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
29 changes: 28 additions & 1 deletion doc/nrf-bm/release_notes/release_notes_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ Libraries

* :ref:`lib_ble_conn_params` library:

* Added missing Kconfig dependencies.
* Added:

* Missing Kconfig dependencies.
* Error event.

* Updated the name of the ``id`` member in the :c:struct:`ble_conn_params_evt` structure to :c:member:`ble_conn_params_evt.evt_type`.

* :ref:`lib_bm_zms` library:

Expand Down Expand Up @@ -175,9 +180,31 @@ Libraries
* To use errno instead of nrf_errors.
* The :c:func:`bm_storage_init` function to expect an additional input parameter of type pointer to struct :c:struct:`bm_storage_config` for configuring the storage instance that is being initialized.

* :ref:`lib_ble_service_bas` service:

* Added the error event to align event handling with other services.
The event is currently unused.

* :ref:`lib_ble_service_hrs` service:

* Added the error event to align event handling with other services.
The event is currently unused.

* :ref:`lib_ble_service_lbs` service:

* Added the error event to align event handling with other services.
The event is currently unused.

* :ref:`lib_ble_service_nus` service:

* Fixed an issue where the client context was shared between all instances.
* Added the error event to align event handling with other services.
* Updated the name of the ``type`` member in the :c:struct:`ble_nus_evt` structure to :c:member:`ble_nus_evt.evt_type`.

* BLE Gatt Queue library:

* Updated the event handling to align with other libraries.
The :c:struct:`ble_gq_req` now takes an :c:type:`ble_gq_evt_handler_t` event handler and the :c:member:`ble_gq_req.ctx` context.

Samples
=======
Expand Down
11 changes: 6 additions & 5 deletions include/bm/bluetooth/ble_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ enum ble_adv_mode {
* @brief Advertising event types.
*/
enum ble_adv_evt_type {
/**
* @brief Error.
*/
BLE_ADV_EVT_ERROR,
/**
* @brief Idle; no connectable advertising is ongoing.
*/
Expand Down Expand Up @@ -120,7 +116,11 @@ enum ble_adv_evt_type {
* for directed advertising by calling @ref ble_adv_peer_addr_reply. Otherwise, it can
* ignore the event to let the device advertise in the next configured advertising mode.
*/
BLE_ADV_EVT_PEER_ADDR_REQUEST
BLE_ADV_EVT_PEER_ADDR_REQUEST,
/**
* @brief Error.
*/
BLE_ADV_EVT_ERROR,
};

/** @brief Advertising event. */
Expand All @@ -130,6 +130,7 @@ struct ble_adv_evt {
union {
/** @ref BLE_ADV_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
};
Expand Down
19 changes: 15 additions & 4 deletions include/bm/bluetooth/ble_conn_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ extern "C" {
#endif

/**
* @brief BLE connection parameter event IDs.
* @brief BLE connection parameter event types.
*/
enum ble_conn_params_evt_id {
enum ble_conn_params_evt_type {
/**
* @brief Connection parameters updated.
*/
Expand All @@ -45,6 +45,10 @@ enum ble_conn_params_evt_id {
* @brief GAP radio phy mode update procedure completed.
*/
BLE_CONN_PARAMS_EVT_RADIO_PHY_MODE_UPDATED,
/**
* @brief Error.
*/
BLE_CONN_PARAMS_EVT_ERROR,
};

/**
Expand All @@ -66,9 +70,9 @@ struct ble_conn_params_data_length {
*/
struct ble_conn_params_evt {
/**
* @brief Event ID.
* @brief Event type.
*/
enum ble_conn_params_evt_id id;
enum ble_conn_params_evt_type evt_type;
/**
* @brief Connection handle.
*/
Expand Down Expand Up @@ -98,6 +102,13 @@ struct ble_conn_params_evt {
* From @ref BLE_CONN_PARAMS_EVT_RADIO_PHY_MODE_UPDATED.
*/
ble_gap_evt_phy_update_t phy_update_evt;
/** @ref BLE_CONN_PARAMS_EVT_ERROR event data. */
struct {
/**
* @brief Error reason.
*/
uint32_t reason;
} error;
};
};

Expand Down
44 changes: 32 additions & 12 deletions include/bm/bluetooth/ble_gq.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,40 @@ enum ble_gq_req_type {
};

/**
* @brief Error handler type.
* @brief Advertising event types.
*/
typedef void (*ble_gq_req_error_cb_t)(uint16_t conn_handle, uint32_t nrf_error, void *context);

/**
* @brief Structure used to handle SoftDevice error.
*/
struct ble_gq_req_error_handler {
enum ble_gq_evt_type {
/**
* @brief Error handler to be called in case of an error from SoftDevice.
* @brief Error.
*/
ble_gq_req_error_cb_t cb;
BLE_GQ_EVT_ERROR,
};

/** @brief Gatt Queue event. */
struct ble_gq_evt {
/** @brief Advertising event type. */
enum ble_gq_evt_type evt_type;
/**
* @brief Parameter passed to the error handler;
* @brief Connection handle for which the event applies.
*/
void *ctx;
uint16_t conn_handle;
union {
/** @ref BLE_GQ_EVT_ERROR event data. */
struct {
/** Event result code. */
uint32_t reason;
} error;
};
};

/* Forward declaration */
struct ble_gq_req;

/**
* @brief Event handler type.
*/
typedef void (*ble_gq_evt_handler_t)(const struct ble_gq_req *req, struct ble_gq_evt *evt);

/**
* @brief Structure to hold a BLE GATT request.
*/
Expand All @@ -168,7 +184,11 @@ struct ble_gq_req {
/**
* @brief Error handler structure.
*/
struct ble_gq_req_error_handler error_handler;
ble_gq_evt_handler_t evt_handler;
/**
* @brief Context.
*/
void *ctx;
/**
* @brief Request type specific parameters.
*/
Expand Down
13 changes: 7 additions & 6 deletions include/bm/bluetooth/ble_qwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ extern "C" {

/** @brief Queued Writes module event types. */
enum ble_qwr_evt_type {
/** Error event */
BLE_QWR_EVT_ERROR,
/** Event that indicates that an execute write command was received for a registered handle
* and that the received data was actually written and is now ready.
*/
Expand All @@ -58,17 +56,15 @@ enum ble_qwr_evt_type {
* and that the write request must now be accepted or rejected.
*/
BLE_QWR_EVT_AUTH_REQUEST,
/** Error event */
BLE_QWR_EVT_ERROR,
};

/** @brief Queued Writes module events. */
struct ble_qwr_evt {
/** Type of the event. */
enum ble_qwr_evt_type evt_type;
union {
/** @ref BLE_QWR_EVT_ERROR event data. */
struct {
uint32_t reason;
} error;
/** @ref BLE_QWR_EVT_EXECUTE_WRITE event data. */
struct {
/** Handle of the attribute to which the event relates. */
Expand All @@ -79,6 +75,11 @@ struct ble_qwr_evt {
/** Handle of the attribute to which the event relates. */
uint16_t attr_handle;
} auth_req;
/** @ref BLE_QWR_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
};
};

Expand Down
13 changes: 12 additions & 1 deletion include/bm/bluetooth/services/ble_bas.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ enum ble_bas_evt_type {
/**
* @brief Battery level notification disabled.
*/
BLE_BAS_EVT_NOTIFICATION_DISABLED
BLE_BAS_EVT_NOTIFICATION_DISABLED,
/**
* @brief Error event.
*/
BLE_BAS_EVT_ERROR,
};

/**
Expand All @@ -57,6 +61,13 @@ struct ble_bas_evt {
* @brief Connection handle for which the event applies.
*/
uint16_t conn_handle;
union {
/** @ref BLE_BAS_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
};
};

/* Forward declaration */
Expand Down
34 changes: 25 additions & 9 deletions include/bm/bluetooth/services/ble_cgms.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,30 @@ extern "C" {

/** @brief CGM Service events. */
enum ble_cgms_evt_type {
/** Error. */
BLE_CGMS_EVT_ERROR,
/** Glucose value notification enabled. */
/**
* @brief Glucose value notification enabled.
*/
BLE_CGMS_EVT_NOTIFICATION_ENABLED,
/** Glucose value notification disabled. */
/**
* @brief Glucose value notification disabled.
*/
BLE_CGMS_EVT_NOTIFICATION_DISABLED,
/** Glucose value notification start session. */
/**
* @brief Glucose value notification start session.
*/
BLE_CGMS_EVT_START_SESSION,
/** Glucose value notification stop session. */
/**
* @brief Glucose value notification stop session.
*/
BLE_CGMS_EVT_STOP_SESSION,
/** Glucose value write communication interval. */
/**
* @brief Glucose value write communication interval.
*/
BLE_CGMS_EVT_WRITE_COMM_INTERVAL,
/**
* @brief Error.
*/
BLE_CGMS_EVT_ERROR,
};

/** @} */ /* ble_cgms_enums */
Expand All @@ -272,10 +284,14 @@ enum ble_cgms_evt_type {
struct ble_cgms_evt {
/** Event type. */
enum ble_cgms_evt_type evt_type;
/**
* @brief Connection handle for which the event applies.
*/
uint16_t conn_handle;
union {
/** @ref BLE_CGMS_EVT_ERROR event data. */
struct {
/* Error reason */
/** Error reason. */
uint32_t reason;
} error;
};
Expand Down Expand Up @@ -444,7 +460,7 @@ struct ble_cgms {
/** Pointer to BLE GATT Queue instance. */
const struct ble_gq *gatt_queue;
/** Error handler to be called in case of an error from SoftDevice. */
ble_gq_req_error_cb_t gatt_err_handler;
ble_gq_evt_handler_t ble_gq_evt_handler;
/** Handle of the CGM Service (as provided by the BLE stack). */
uint16_t service_handle;
/** GATTS characteristic handles for the different characteristics in the service. */
Expand Down
4 changes: 4 additions & 0 deletions include/bm/bluetooth/services/ble_hids.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ struct ble_hids_evt {
* @brief Event type.
*/
enum ble_hids_evt_type evt_type;
/**
* @brief Connection handle for which the event applies.
*/
uint16_t conn_handle;
/**
* @brief BLE event.
*/
Expand Down
17 changes: 16 additions & 1 deletion include/bm/bluetooth/services/ble_hrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ enum ble_hrs_evt_type {
/**
* @brief Heart rate value notifcation disabled.
*/
BLE_HRS_EVT_NOTIFICATION_DISABLED
BLE_HRS_EVT_NOTIFICATION_DISABLED,
/**
* @brief Error event.
*/
BLE_HRS_EVT_ERROR,
};

/**
Expand All @@ -67,6 +71,17 @@ struct ble_hrs_evt {
* @brief Event type.
*/
enum ble_hrs_evt_type evt_type;
/**
* @brief Connection handle for which the event applies.
*/
uint16_t conn_handle;
union {
/** @ref BLE_HRS_EVT_ERROR event data. */
struct {
/** Error reason. */
uint32_t reason;
} error;
};
};

/* Forward declaration */
Expand Down
Loading