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

Determining Data Rx in Multilink Central NUS

I'm working in creating BLE NUS network using 3 NRF51822 FAB, one board has a role as central and 2 other as peripheral. Now I'm able to send string (via BLE NUS) from central to peripheral and vice versa. the problem is i don't know how to determine which peripheral that send the data, can anyone suggest how to identify the peripheral?

Thanks in advance

this is my code in receiving the data

static void ble_nus_c_evt_handler(ble_nus_c_t * p_ble_nus_c, const ble_nus_c_evt_t * p_ble_nus_evt){
uint32_t err_code;
switch (p_ble_nus_evt->evt_type)
{
    case BLE_NUS_C_EVT_DISCOVERY_COMPLETE:
        err_code = ble_nus_c_handles_assign(p_ble_nus_c, p_ble_nus_evt->conn_handle, &p_ble_nus_evt->handles);
        APP_ERROR_CHECK(err_code);
        err_code = ble_nus_c_rx_notif_enable(p_ble_nus_c);
        APP_ERROR_CHECK(err_code);
        break;
    case BLE_NUS_C_EVT_NUS_RX_EVT:
        _cek_conn_handle = p_ble_nus_evt->conn_handle;
        for (uint32_t i = 0; i < p_ble_nus_evt->data_len; i++)
        {
          if(p_ble_nus_evt->data_len == 12){
            BLE_handler1.u8BLEBuffer[i] = p_ble_nus_evt->p_data[i];
          }else if(p_ble_nus_evt->data_len == 7){
            BLE_handler2.u8BLEBuffer[i] = p_ble_nus_evt->p_data[i];
          }else{
            // tidak melakukan apa2
          }
            while (app_uart_put( p_ble_nus_evt->p_data[i]) != NRF_SUCCESS);
            static uint8_t j = 0;
            Main_u8bufferBluetooth[j] = p_ble_nus_evt->p_data[i];
            j++;
            if(j > 30){
                j=0;
            }
        }
        break;

    case BLE_NUS_C_EVT_DISCONNECTED:
        printf("Disconnected\r\n");
        scan_start();
        break;
}}
Related