void ble_ancs_c_on_ble_evt(ble_ancs_c_t * p_ancs, const ble_evt_t * p_ble_evt) { uint16_t evt = p_ble_evt->header.evt_id; switch (evt) { case BLE_GATTC_EVT_WRITE_RSP: on_evt_write_rsp(); break; case BLE_GATTC_EVT_HVX: on_evt_gattc_notif(p_ancs, p_ble_evt); break; default: break; } }
void client_handling_ble_evt_handler(ble_evt_t * p_ble_evt) { client_t * p_client = NULL; uint32_t index = client_find(p_ble_evt->evt.gattc_evt.conn_handle); if (index != MAX_CLIENTS) { p_client = &m_client[index]; } switch (p_ble_evt->header.evt_id) { case BLE_GATTC_EVT_WRITE_RSP: if ((p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION) || (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION)) { uint32_t err_code = dm_security_setup_req(&p_client->handle); APP_ERROR_CHECK(err_code); } on_evt_write_rsp(p_ble_evt, p_client); break; case BLE_GATTC_EVT_HVX: on_evt_hvx(p_ble_evt, p_client, index); break; case BLE_GATTC_EVT_TIMEOUT: on_evt_timeout(p_ble_evt, p_client); break; default: break; } if (p_client != NULL) { ble_db_discovery_on_ble_evt(&(p_client->srv_db), p_ble_evt); } }