Hi.
I have a project with usb_cdc merged with multilink_central and NUS service. It is working quite well, multiple peripherals can connect and send data to the central.
I am now sending data over ble from central to the peripherals using the following, but have no idea how to select the correct conn_handle i.e. which connected peripheral to send the data to?
Anyone know how I get a list of current connections, and use ble_nus_c_string_send() to send data to the correct peripheral?
Thanks
ret_code_t ret_val;
uint16_t data_len = 0;
uint8_t testData[5];
data_len = sprintf(testData, "hello");
// Send data back to peripheral.
do
{
ret_val = ble_nus_c_string_send(&m_nus_c, testData, data_len);
if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
{
NRF_LOG_ERROR("Failed sending NUS message. Error 0x%x. ", ret_val);
APP_ERROR_CHECK(ret_val);
}
} while (ret_val == NRF_ERROR_BUSY);