diff --git a/nrf5/drivers/bluetooth/ble_drv.c b/nrf5/drivers/bluetooth/ble_drv.c index 3961d609e8..0050c91417 100644 --- a/nrf5/drivers/bluetooth/ble_drv.c +++ b/nrf5/drivers/bluetooth/ble_drv.c @@ -67,24 +67,23 @@ if (ble_drv_stack_enabled() == 0) { \ static volatile bool m_adv_in_progress; static volatile bool m_tx_in_progress; -static volatile bool m_primary_service_found; -static volatile bool m_characteristic_found; static ble_drv_gap_evt_callback_t gap_event_handler; static ble_drv_gatts_evt_callback_t gatts_event_handler; -#if (BLUETOOTH_SD == 130) || (BLUETOOTH_SD == 132) -static ble_drv_adv_evt_callback_t adv_event_handler; -static ble_drv_gattc_evt_callback_t gattc_event_handler; -static ble_drv_disc_add_service_callback_t disc_add_service_handler; -static ble_drv_disc_add_char_callback_t disc_add_char_handler; -static ble_drv_gattc_char_data_callback_t gattc_char_data_handle; -#endif - static mp_obj_t mp_gap_observer; static mp_obj_t mp_gatts_observer; #if (BLUETOOTH_SD == 130) || (BLUETOOTH_SD == 132) +static volatile bool m_primary_service_found; +static volatile bool m_characteristic_found; + +static ble_drv_adv_evt_callback_t adv_event_handler; +static ble_drv_gattc_evt_callback_t gattc_event_handler; +static ble_drv_disc_add_service_callback_t disc_add_service_handler; +static ble_drv_disc_add_char_callback_t disc_add_char_handler; +static ble_drv_gattc_char_data_callback_t gattc_char_data_handle; + static mp_obj_t mp_adv_observer; static mp_obj_t mp_gattc_observer; static mp_obj_t mp_gattc_disc_service_observer; @@ -922,6 +921,7 @@ static void ble_evt_handler(ble_evt_t * p_ble_evt) { case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: BLE_DRIVER_LOG("BLE EVT PRIMARY SERVICE DISCOVERY RESPONSE\n"); BLE_DRIVER_LOG(">>> service count: %d\n", p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.count); + for (uint16_t i = 0; i < p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.count; i++) { ble_gattc_service_t * p_service = &p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i]; @@ -946,6 +946,7 @@ static void ble_evt_handler(ble_evt_t * p_ble_evt) { case BLE_GATTC_EVT_CHAR_DISC_RSP: BLE_DRIVER_LOG("BLE EVT CHAR DISCOVERY RESPONSE\n"); BLE_DRIVER_LOG(">>> characteristic count: %d\n", p_ble_evt->evt.gattc_evt.params.char_disc_rsp.count); + for (uint16_t i = 0; i < p_ble_evt->evt.gattc_evt.params.char_disc_rsp.count; i++) { ble_gattc_char_t * p_char = &p_ble_evt->evt.gattc_evt.params.char_disc_rsp.chars[i];