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

multi link central uart with multiple peripheral

hi...

I have modified the multi link central to multi link central uart , i can able to connect with 8 peripherals . One central getting connected with multiple peripheral, data are getting transfer between them. Now i want to differentiate the multiple peripherals to central , by using different uuid or name , product address . so that i can able to send the data to particular peripheral device from central .

how can i input the different uuid or name for multiple peripheral ?  i need some sample 

for example i am having central1 , peripherals (A,B,C,D) suppose A want to send message to D how can it send ? is it possible to transfer the data between the peripheral

suggest me a good one 

Thanks in advance 

Parents
  • Hi 

    Every link on the central side will be identified by a unique connection handle, which is a 16-bit value that starts at 0 and is incremented for each additional link. 

    If you want you can map the connection handle to something else, such as the BLE address or a device name, but whenever you want to send something to a specific device you need to use the connection handle of that device to address it. 

    It is important to know that each device could get a different connection handle each time it connects to the central, so the central will have to update the connection handle/BLE address map continuously as devices are disconnected and connected. 

    It is also important to know that the connection handle for a link is not necessarily the same on the peripheral and central side (a peripheral with only one link to a master will only use connection handle 0). 

    Best regards
    Torbjørn

  • Thank your explanation , how to send the data via uart using connection handle of specific device 

    Best regards ,

    pavi

  • can we able  send the message to  particular device (peripheral to peripheral )by manually , similar like this central has been connected 4 peripherals ( A--B---C--D)by using name of the peripheral .In this case peripheral A wants to send the message to the peripheral D, similarly peripheral D wants to send the message to peripheral B , C . so communication has to be done randomly .,whoever in connection in central  from end to end , (A B C D ) peripherals  have to send the data to each other .is it possible ? 

    can we resolve by using connection handle . 

    A--- HAS 0X01 connection handle 

    B----HAS 0X02 connection handle 

    C----HAS 0X03 connection handle so on

    example if A want to send the data to C 

    can i able to enter manually like ------ A (0X01) , hello to B(0x02) 

    or else is there any other way to communicate the peripheral to peripheral

    Best regards

    pavi

  • connection handle are created by the softdevice right , so how to put the connection handle in an array ,by that way i can able  to get the particular peripheral to send the data , is it possible ?

    Best regards,

    pavi

  • Hi 

    When a device establishes a connection you will receive the BLE_GAP_EVT_CONNECTED event on the peripheral and central side. 

    Inside this event you can read the connection handle from the p_ble_evt->evt.gap_evt->conn_handle variable. 

    Then you can update your local variable associating connection handle with the device from there. 

    Best regards
    Torbjørn

Reply Children
  • i am not familiar that much in programming . can you explain me with sample code , i want to send to data by using connection handle . i want to put all connected devices in an array so i can able to transmit the data to particular device 

    Thank you 

  • Hi

    If you are using the multi link central example there is actually an array provided for you already, to keep track of the services of each of the connected devices:

    BLE_LBS_C_ARRAY_DEF(m_lbs_c, NRF_SDH_BLE_CENTRAL_LINK_COUNT);  

    Essentially you will get an array called m_lbs_c, of type ble_lbs_c_s (defined on line 146 of ble_lbs_c.h). 

    Since the connection handle starts at 0 and increments by 1 for each connected device, the connection handle is used as an index into the array. The first connected device will update m_lbs_c[0], the second device m_lbs_c[1] and so forth. 

    By default the conn_handle field in the m_lbs_c elements will be initialized to BLE_CONN_HANDLE_INVALID (0xFFFF), but once they are connected the conn_handle will be updated to represent the conn_handle of the connection. 

    If you want you could extend this struct to contain more information on the device, such as a device name or similar that you want to use to address individual devices. 

    When sending data over a link you will send a pointer to the m_lbs_c element, such as you can see in the led status send function: 

    uint32_t ble_lbs_led_status_send(ble_lbs_c_t * p_ble_lbs_c, uint8_t status);

    Best regards
    Torbjørn

  • Hi, Torbjorn 

    actually i am trying to do a task ,

    1.peripherals want to talk to each other (like chating) ,using termite . 

    2. peripheral can't send the data to other peripheral , in case of that i want to use the central as intermediate in between the peripherals . 

    3. here  many peripherals are present , if one want to send the data to particular peripheral  device .

    i have some suggestion 

    can i send the data using mac address or connection handle ?

    EXAMPLE  if peripheral A wants to send the data to peripheral C , then peripheral A pass the data to central using mac address or connection handle and it should tell to central to convey this data to peripheral C and peripheral C will receive and so on .can we do this ? these things to be achieved without changing the code often . 

    once the peripherals got connected to central , whoever in connection they should communicate with all of peripherals(using mac address or connection handle )  in termite .

    Thanks in advance

  • Hi

    Yes, this is possible. 

    On the central side you have to identify the different peripherals by the different items in the m_lbs_c array, where the connection handle of the device corresponds to the index in the array (as I explained in my previous reply). 

    If you want to use the BLE address to identify the device on the terminal side this is also possible, but then the central will have to do the translation between BLE address and connection handle when receiving messages. 

    In other words you will need to store a map in memory that maps between BLE address and connection handle. 

    Best regards
    Torbjørn

  • Thankyou Torbjorn , but how to do that , how the messages will passed from one to another .

Related