This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to advertising while connection?

[Dev Env]

nRF51 DK

IoT SDK 0.8

IoT SoftDevice

CoAP_Server_example (base code)

[Question]

why stop advertising while connection? (BLE_GAP_EVT_CONNECTED)

and start advertising (BLE_GAP_EVT_DISCONNECTED) that is ble spec?

how to advertising while connection?

when BLE_GAP_EVT_CONNECTED case , call function advertising_start()?

please help me

Parents
  • my code

     switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
    			m_display_state = LEDS_IPV6_IF_DOWN;
    			m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; 
    
    			
    			err_code = sd_ble_gap_adv_stop();
    			APPL_LOG ("[APPL]:[sd_ble_gap_adv_stop][err_code:%d]\n" , err_code);
    		
    		    // Initialize advertising parameters (used when starting advertising).
        
    
        m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
        err_code = sd_ble_gap_adv_start(&m_adv_params); // error code - NRF_ERROR_INVALID_STATE
    
Reply
  • my code

     switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
    			m_display_state = LEDS_IPV6_IF_DOWN;
    			m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; 
    
    			
    			err_code = sd_ble_gap_adv_stop();
    			APPL_LOG ("[APPL]:[sd_ble_gap_adv_stop][err_code:%d]\n" , err_code);
    		
    		    // Initialize advertising parameters (used when starting advertising).
        
    
        m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
        err_code = sd_ble_gap_adv_start(&m_adv_params); // error code - NRF_ERROR_INVALID_STATE
    
Children
No Data
Related