/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the scheduler in the main loop after a BLE stack event has * been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { if((p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_CENTRAL) || (m_conn_handle_central_hrs == p_ble_evt->evt.gap_evt.conn_handle) || (m_conn_handle_central_rsc == p_ble_evt->evt.gap_evt.conn_handle)) { dm_ble_evt_handler(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); ble_hrs_c_on_ble_evt(&m_ble_hrs_c, p_ble_evt); ble_rscs_c_on_ble_evt(&m_ble_rsc_c, p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_central_evt(p_ble_evt); } if((p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH) || (m_conn_handle_peripheral == p_ble_evt->evt.gap_evt.conn_handle)) { ble_hrs_on_ble_evt(&m_hrs, p_ble_evt); ble_rscs_on_ble_evt(&m_rscs, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); on_ble_peripheral_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); } }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); ble_ancs_c_on_ble_evt(&m_ancs_c, p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the scheduler in the main loop after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_lmxs_on_ble_evt(&g_LmxServ, p_ble_evt); ble_bas_on_ble_evt(&g_BatServ, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); ble_dfu_on_ble_evt(&m_dfus, p_ble_evt); on_ble_evt(p_ble_evt); ble_nus_on_ble_evt(&m_nus, p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_cscs_on_ble_evt(&m_cscs, p_ble_evt); ble_bas_on_ble_evt(&m_bas, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the scheduler in the main loop after a BLE stack event has * been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); ble_rscs_c_on_ble_evt(&m_ble_rsc_c, p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the scheduler in the main loop after a BLE stack event has * been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); ble_hrs_c_on_ble_evt(&m_ble_hrs_c, p_ble_evt); ble_bas_c_on_ble_evt(&m_ble_bas_c, p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); ble_ias_on_ble_evt(&m_ias, p_ble_evt); ble_lls_on_ble_evt(&m_lls, p_ble_evt); ble_bas_on_ble_evt(&m_bas, p_ble_evt); ble_ias_c_on_ble_evt(&m_ias_c, p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); ble_ancs_c_on_ble_evt(&m_ancs_c, p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); }
/**@brief Dispatches a stack event to all modules with a stack BLE event handler. * * @details This function is called from the Stack event interrupt handler after a stack BLE * event has been received. * * @param[in] p_ble_evt Stack Bluetooth event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { #ifdef BONDING_ENABLE dm_ble_evt_handler(p_ble_evt); #endif // BONDING_ENABLE ble_hrs_on_ble_evt(&m_hrs, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); /*YOUR_JOB add calls to _on_ble_evt functions from each service your application is using ble_xxs_on_ble_evt(&m_xxs, p_ble_evt); ble_yys_on_ble_evt(&m_yys, p_ble_evt); */ }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_hrs_on_ble_evt(&m_hrs, p_ble_evt); ble_bas_on_ble_evt(&m_bas, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); #ifdef BLE_DFU_APP_SUPPORT /** @snippet [Propagating BLE Stack events to DFU Service] */ ble_dfu_on_ble_evt(&m_dfus, p_ble_evt); /** @snippet [Propagating BLE Stack events to DFU Service] */ #endif // BLE_DFU_APP_SUPPORT on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { // APPL_LOG("ble_evt_dispatch evt_id %d \r\n", (int)p_ble_evt->header.evt_id); dm_ble_evt_handler(p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); if (p_ble_evt->header.evt_id == BLE_GAP_EVT_DISCONNECTED || p_ble_evt->header.evt_id == BLE_GAP_EVT_TIMEOUT) { advertising_init(); } on_ble_evt(p_ble_evt); bluetooth_on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); ble_rscs_on_ble_evt(&m_rscs, p_ble_evt); ble_bas_on_ble_evt(&m_bas, p_ble_evt); ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); #ifdef BLE_DFU_APP_SUPPORT /** @snippet [Propagating BLE Stack events to DFU Service] */ ble_dfu_on_ble_evt(&m_dfus, p_ble_evt); /** @snippet [Propagating BLE Stack events to DFU Service] */ #endif // BLE_DFU_APP_SUPPORT #ifdef BLE_DATA_SYNC_SUPPORT /** @snippet [Propagating BLE Stack events to data sync Service] */ ble_data_sync_on_ble_evt(&m_data_syncs, p_ble_evt); /** @snippet [Propagating BLE Stack events to data sync Service] */ #endif // BLE_DATA_SYNC_SUPPORT }
/**@brief Function for dispatching a S110 SoftDevice event to all modules with a S110 SoftDevice * event handler. * * @details This function is called from the S110 SoftDevice event interrupt handler after a S110 * SoftDevice event has been received. * * @param[in] p_ble_evt S110 SoftDevice event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { #ifdef BLE_DFU_APP_SUPPORT dm_ble_evt_handler(p_ble_evt); #endif ble_conn_params_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt); ble_nus_on_ble_evt(&m_nus, p_ble_evt); #if ENABLE_NEW_SERVECE new_service_nus_on_ble_evt(&new_m_nus, p_ble_evt); #endif #ifdef BLE_DFU_APP_SUPPORT /** @snippet [Propagating BLE Stack events to DFU Service] */ ble_dfu_on_ble_evt(&m_dfus, p_ble_evt); /** @snippet [Propagating BLE Stack events to DFU Service] */ #endif // BLE_DFU_APP_SUPPORT on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); //bsp_btn_ble_on_ble_evt(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the scheduler in the main loop after a BLE stack event has * been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); on_ble_evt(p_ble_evt); }
static void btle_handler(ble_evt_t *p_ble_evt) { /* Library service handlers */ #if SDK_CONN_PARAMS_MODULE_ENABLE ble_conn_params_on_ble_evt(p_ble_evt); #endif dm_ble_evt_handler(p_ble_evt); #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) bleGattcEventHandler(p_ble_evt); #endif nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); nRF5xGap &gap = (nRF5xGap &) ble.getGap(); nRF5xGattServer &gattServer = (nRF5xGattServer &) ble.getGattServer(); nRF5xSecurityManager &securityManager = (nRF5xSecurityManager &) ble.getSecurityManager(); /* Custom event handler */ switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: { Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle; #if defined(TARGET_MCU_NRF51_16K_S110) || defined(TARGET_MCU_NRF51_32K_S110) /* Only peripheral role is supported by S110 */ Gap::Role_t role = Gap::PERIPHERAL; #else Gap::Role_t role = static_cast<Gap::Role_t>(p_ble_evt->evt.gap_evt.params.connected.role); #endif gap.setConnectionHandle(handle); const Gap::ConnectionParams_t *params = reinterpret_cast<Gap::ConnectionParams_t *>(&(p_ble_evt->evt.gap_evt.params.connected.conn_params)); const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr; gap.processConnectionEvent(handle, role, static_cast<BLEProtocol::AddressType_t>(peer->addr_type), peer->addr, static_cast<BLEProtocol::AddressType_t>(own->addr_type), own->addr, params); break; } case BLE_GAP_EVT_DISCONNECTED: { Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle; // Since we are not in a connection and have not started advertising, // store bonds gap.setConnectionHandle (BLE_CONN_HANDLE_INVALID); Gap::DisconnectionReason_t reason; switch (p_ble_evt->evt.gap_evt.params.disconnected.reason) { case BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION: reason = Gap::LOCAL_HOST_TERMINATED_CONNECTION; break; case BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION: reason = Gap::REMOTE_USER_TERMINATED_CONNECTION; break; case BLE_HCI_CONN_INTERVAL_UNACCEPTABLE: reason = Gap::CONN_INTERVAL_UNACCEPTABLE; break; default: /* Please refer to the underlying transport library for an * interpretion of this reason's value. */ reason = static_cast<Gap::DisconnectionReason_t>(p_ble_evt->evt.gap_evt.params.disconnected.reason); break; } #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) // Close all pending discoveries for this connection nRF5xGattClient& gattClient = ble.getGattClient(); gattClient.characteristicDescriptorDiscoverer().terminate(handle, BLE_ERROR_INVALID_STATE); gattClient.discovery().terminate(handle); #endif gap.processDisconnectionEvent(handle, reason); break; } case BLE_GAP_EVT_PASSKEY_DISPLAY: securityManager.processPasskeyDisplayEvent(p_ble_evt->evt.gap_evt.conn_handle, p_ble_evt->evt.gap_evt.params.passkey_display.passkey); break; case BLE_GAP_EVT_TIMEOUT: gap.processTimeoutEvent(static_cast<Gap::TimeoutSource_t>(p_ble_evt->evt.gap_evt.params.timeout.src)); break; case BLE_GATTC_EVT_TIMEOUT: case BLE_GATTS_EVT_TIMEOUT: // Disconnect on GATT Server and Client timeout events. // ASSERT_STATUS_RET_VOID (sd_ble_gap_disconnect(m_conn_handle, // BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION)); break; case BLE_GAP_EVT_ADV_REPORT: { const ble_gap_evt_adv_report_t *advReport = &p_ble_evt->evt.gap_evt.params.adv_report; gap.processAdvertisementReport(advReport->peer_addr.addr, advReport->rssi, advReport->scan_rsp, static_cast<GapAdvertisingParams::AdvertisingType_t>(advReport->type), advReport->dlen, advReport->data); break; } default: break; } gattServer.hwCallback(p_ble_evt); }
/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. * * @details This function is called from the BLE Stack event interrupt handler after a BLE stack * event has been received. * * @param[in] p_ble_evt Bluetooth stack event. */ static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { dm_ble_evt_handler(p_ble_evt); juma_data_on_ble_evt(&m_juma_data_service, p_ble_evt); on_ble_evt(p_ble_evt); }