void BLETransceiver::bleEvtDispatch(ble_evt_t * p_ble_evt, BLETransceiver* me)
{
	ASSERT(me != NULL);
	ble_conn_params_on_ble_evt(p_ble_evt);
	ble_nus_on_ble_evt(&nus, p_ble_evt);
	me->onBleEvt(p_ble_evt);
}
/**@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)
{
    dm_ble_evt_handler(p_ble_evt);
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    ble_conn_params_on_ble_evt(p_ble_evt);
    on_ble_evt(p_ble_evt);
}
Ejemplo n.º 3
0
// Function for dispatching a S110 SoftDevice event to all modules 
// with a S110 SoftDevice event handler.
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    ble_conn_params_on_ble_evt(p_ble_evt);
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    on_ble_evt(p_ble_evt);
    ble_advertising_on_ble_evt(p_ble_evt);    
}
Ejemplo n.º 4
0
/**@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)
{
    ble_bondmngr_on_ble_evt(p_ble_evt);
    ble_conn_params_on_ble_evt(p_ble_evt);
    ble_ancs_c_on_ble_evt(&m_ancs_c, p_ble_evt);
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    on_ble_evt(p_ble_evt);
}
void application_on_ble_evt(ble_evt_t * p_ble_evt)
{ 
    NRF_LOG_DEBUG("BLE_EVENT\r\n");
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    /*
    ble_ess_on_ble_evt(&m_ess, p_ble_evt);
    ble_dis_on_ble_evt(&m_dis, p_ble_evt);
    ble_bas_on_ble_evt(&m_bas, p_ble_evt);
    ble_tps_on_ble_evt(&m_tps, p_ble_evt);
    */
}
Ejemplo n.º 6
0
/**@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);
    
}
Ejemplo n.º 7
0
// On a write, need to forward that to NUS library.
void ble_evt_write(ble_evt_t* p_ble_evt) {
  ble_nus_on_ble_evt(&m_nus, p_ble_evt);
}
Ejemplo n.º 8
0
void ble_evt_disconnected(ble_evt_t* p_ble_evt) {
  conn_handle = BLE_CONN_HANDLE_INVALID;

  ble_nus_on_ble_evt(&m_nus, p_ble_evt);
}
Ejemplo n.º 9
0
void ble_evt_connected(ble_evt_t* p_ble_evt) {
  ble_common_evt_t *common = (ble_common_evt_t*) &p_ble_evt->evt;
  conn_handle = common->conn_handle;

  ble_nus_on_ble_evt(&m_nus, p_ble_evt);
}
Ejemplo n.º 10
0
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    on_ble_evt(p_ble_evt);
    
    // Intercept advertising timeout events to implement infinite advertising, and disconnect events to let radio-conflicting 
    //   operations to execute after a connection closes
    if( (p_ble_evt->header.evt_id == BLE_GAP_EVT_TIMEOUT                                        // if timeout event
            && p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING)    //   from advertising
        || p_ble_evt->header.evt_id == BLE_GAP_EVT_DISCONNECTED)                                // OR if disconnect event
    {
        // Count number of pending pause requests
        int pauseReqSrc = PAUSE_REQ_NONE;
        for(int src=0; src<PAUSE_REQ_NONE; src++)  // look through all pause request sources
        {
            if(pauseRequest[src]) 
            {
                pauseReqSrc = src;
                break;  // check for any pending pause requests
            }
        }
        
        // If there are any pending pause requests, don't restart advertising yet.
        if(pauseReqSrc != PAUSE_REQ_NONE)
        {
            isAdvertising = false;
            sleep = false;  // wake so that modules waiting for pause can act.
            debug_log("ADV: advertising paused, src %d.\r\n",pauseReqSrc);
        }
        
        // Otherwise restart advertising, for infinite advertising.
        else
        {
            isAdvertising = true;
            if(needAdvDataUpdate)
            {
                setAdvData();
                /*ble_advdata_t advdata;
                constructAdvData(&advdata);
                uint32_t result = ble_advdata_set(&advdata, NULL);  // set advertising data, don't set scan response data.
                if(result != NRF_SUCCESS)
                {
                    debug_log("ERR: error setting advertising data, #%d.\r\n",(int)result);
                }
                else
                {
                    debug_log("Updated adv. data.\r\n");
                }*/
                needAdvDataUpdate = false;
            }
                
            //debug_log("ADV: advertising REstarted\r\n");
            uint32_t err_code = ble_advertising_start(BLE_ADV_MODE_FAST);  // restart advertising
            BLE_ERROR_CHECK(err_code);
        }
    }
    else
    {
        ble_advertising_on_ble_evt(p_ble_evt);
    }
    
    //ble_bas_on_ble_evt(&m_bas, p_ble_evt);
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
}
Ejemplo n.º 11
0
static void ble_evt_dispatch(ble_evt_t * p_ble_evt){
    ble_bas_on_ble_evt(&m_bas, p_ble_evt);
    ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    ble_conn_params_on_ble_evt(p_ble_evt);
    on_ble_evt(p_ble_evt);
}