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

multilink uart peripheral - how to choose which to connect

I am using an example from Nordic that enables a central to connect to several peripherals via UART. The connection is automatic (the key is if they all share the same NRF_UART UUID). There is an indication of which peripheral was connected, but there is no indication which was disconnected. Only a general indication that some peripheral did (one or more)

I want to change the automatic selection to less strict way:

The central will scan the area and list all the peripherals 

The central will have a white list (MACID) and connect to each peripheral that is within that list

A flag of connection or disconnection will be set

Is it possible to modify the current multilink uart example? 

Parents
  • Hi,

    If you're referring to the ble_app_multilink_central example then it does write what links that is disconnected. It does this at during the DISCONNECTED event here:

    case BLE_GAP_EVT_DISCONNECTED:
            {
                NRF_LOG_INFO("LBS central link 0x%x disconnected (reason: 0x%x)",
                             p_gap_evt->conn_handle,
                             p_gap_evt->params.disconnected.reason);
    
                if (ble_conn_state_central_conn_count() == 0)
                {
                    err_code = app_button_disable();
                    APP_ERROR_CHECK(err_code);
    
                    // Turn off the LED that indicates the connection.
                    bsp_board_led_off(CENTRAL_CONNECTED_LED);
                }

    For example:

     

    The central will scan the area and list all the peripherals 

    The central will have a white list (MACID) and connect to each peripheral that is within that list

     There is many threads on these topics on the forum, I suggest that you use the search function and see similar threads. 

    regards

    Jared 

Reply
  • Hi,

    If you're referring to the ble_app_multilink_central example then it does write what links that is disconnected. It does this at during the DISCONNECTED event here:

    case BLE_GAP_EVT_DISCONNECTED:
            {
                NRF_LOG_INFO("LBS central link 0x%x disconnected (reason: 0x%x)",
                             p_gap_evt->conn_handle,
                             p_gap_evt->params.disconnected.reason);
    
                if (ble_conn_state_central_conn_count() == 0)
                {
                    err_code = app_button_disable();
                    APP_ERROR_CHECK(err_code);
    
                    // Turn off the LED that indicates the connection.
                    bsp_board_led_off(CENTRAL_CONNECTED_LED);
                }

    For example:

     

    The central will scan the area and list all the peripherals 

    The central will have a white list (MACID) and connect to each peripheral that is within that list

     There is many threads on these topics on the forum, I suggest that you use the search function and see similar threads. 

    regards

    Jared 

Children
Related