nrf5/drivers/bluetooth: Refactoring code to group statics for s130 and s132 into the same ifdef. Also adding two empty lines in discovery functions to make it more easy to read.

This commit is contained in:
Glenn Ruben Bakke 2017-05-14 17:14:57 +02:00 committed by glennrub
parent e8cd010f59
commit 653f4a86d5

View File

@ -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];