|
7 | 7 | #include <nrf_error.h> |
8 | 8 | #include <stdint.h> |
9 | 9 |
|
| 10 | +#include <bm/bluetooth/ble_gq.h> |
10 | 11 | #include <bm/bluetooth/ble_racp.h> |
11 | 12 | #include <bm/bluetooth/services/ble_date_time.h> |
12 | 13 | #include <bm/bluetooth/services/ble_cgms.h> |
|
23 | 24 | LOG_MODULE_REGISTER(ble_cgms, CONFIG_BLE_CGMS_LOG_LEVEL); |
24 | 25 |
|
25 | 26 | /* GATT errors and nrf_ble_gq errors event handler. */ |
26 | | -static void gatt_error_handler(uint16_t conn_handle, uint32_t nrf_error, void *ctx) |
| 27 | +static void ble_gq_evt_handler(const struct ble_gq_req *req, struct ble_gq_evt *gq_evt) |
27 | 28 | { |
28 | 29 | struct ble_cgms_evt evt = { |
29 | 30 | .evt_type = BLE_CGMS_EVT_ERROR, |
30 | | - .error.reason = nrf_error, |
| 31 | + .error.reason = gq_evt->error.reason, |
31 | 32 | }; |
32 | | - struct ble_cgms *cgms = (struct ble_cgms *)ctx; |
| 33 | + struct ble_cgms *cgms = (struct ble_cgms *)gq_evt->error.ctx; |
33 | 34 |
|
34 | | - if (nrf_error != NRF_ERROR_INVALID_STATE) { |
35 | | - LOG_ERR("GATT error, nrf_error %d", nrf_err); |
| 35 | + if (gq_evt->error.reason != NRF_ERROR_INVALID_STATE) { |
| 36 | + LOG_ERR("GATT error, nrf_error %d", gq_evt->error.reason); |
36 | 37 | if (cgms->evt_handler) { |
37 | 38 | cgms->evt_handler(cgms, &evt); |
38 | 39 | } |
@@ -205,7 +206,7 @@ uint32_t ble_cgms_init(struct ble_cgms *cgms, const struct ble_cgms_config *cgms |
205 | 206 | cgms->is_session_started = false; |
206 | 207 | cgms->nb_run_session = 0; |
207 | 208 | cgms->conn_handle = BLE_CONN_HANDLE_INVALID; |
208 | | - cgms->gatt_err_handler = gatt_error_handler; |
| 209 | + cgms->ble_gq_evt_handler = ble_gq_evt_handler; |
209 | 210 |
|
210 | 211 | memcpy(cgms->calibration_val[0].value, init_calib_val, BLE_CGMS_MAX_CALIB_LEN); |
211 | 212 |
|
|
0 commit comments