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 

  • No, I am using nrf52-ble-app-uart-c-multilink-master

    This example is in Github and not within the SDK.

    I am interested in getting information (via UART), which peripheral has been disconnected

    And prevent any peripheral to connect unless it is within the white list of the central

  • Hi,

    This example already use the logger with the UART as backend and prints out what peripheral(connection handle) that disconnected and what reason. If you want to use the UART peripheral to send this information instead for example to a external MCU etc then you would  have to first disable the logging over UART, and then add the UART peripheral and driver to the project by for example merging the UART example. 

    Avi said:
    And prevent any peripheral to connect unless it is within the white list of the central

     Only a Central can send connection requests, not a peripheral. Which means that the Central decides which peripheral it wants to connect to. See this post regarding whitelist. 

    Note that all examples on the Nordic-playground repository are un-supported and provided as is. 

Reply Children
Related