Hi All,
I modified ble_peripheral UART example to support 4 peripheral links instead of one by referring the bel_app_multiperipheral example, I am able to connect four mobiles(central devices) to it and sending (from central devices ) some strings successfully to peripheral.
now question is how to replay from peripheral to all central devices? actually I tried with below function to send the strings from peripheral to central devices
void vfnSendSensorResponsOnBle(uint8_t *ptr, uint32_t len)
{
uint8_t uIndex = 0;
uint32_t err_code = 0;
for (uint32_t i = 0; i < NRF_SDH_BLE_PERIPHERAL_LINK_COUNT; i++)
{
if (m_qwr[i].conn_handle != BLE_CONN_HANDLE_INVALID)
{
NRF_LOG_DEBUG("Ready to send data over BLE NUS");
do
{
if(len>20)
len=19;
err_code = ble_nus_data_send(&m_nus, ptr, (uint16_t *)&len, m_qwr[i].conn_handle/*m_conn_handle*/);
if ((err_code != NRF_ERROR_INVALID_STATE) &&
(err_code != NRF_ERROR_RESOURCES) &&
(err_code != NRF_ERROR_NOT_FOUND))
{
APP_ERROR_CHECK(err_code);
}
} while (err_code == NRF_ERROR_RESOURCES);
}
}
}
with the above function able to send strings from peripheral to central when one central device is connected. when I tried the same with more than once central connections, peripheral device getting restarted.
Here I am not getting what causing for it, I think need to modify above function.
Please let me know what are the things need to be change or any example for reference other than bel_app_multiperipheral.
Thanks in Advance
Regards,
Sudheer