<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to know which peripheral sent data to central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49989/how-to-know-which-peripheral-sent-data-to-central</link><description>We need to connect 2 peripherals with single central device.I have taken ble_app_multilink_central from SDK 15.3 and integrated the ble_app_uart_c in this. I am using the service ble_nus_c instead of ble_lbs_c. 
 My peripherals are sending periodic data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Jul 2019 08:02:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49989/how-to-know-which-peripheral-sent-data-to-central" /><item><title>RE: How to know which peripheral sent data to central</title><link>https://devzone.nordicsemi.com/thread/199439?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 08:02:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c453d6c1-bc2d-4e58-a69b-4cb55a014608</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Have you looked at the Mulit Link example?&lt;/p&gt;
&lt;p&gt;This worked for me:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for handling data received by the Nordic UART Service.
 *
 */
static void ble_nus_on_rx_data(uint16_t conn_handle, uint8_t * p_data, uint16_t data_len)
{
    uint8_t slot = find_slot_from_conn_handle( conn_handle );

    NRF_LOG_DEBUG(&amp;quot;Rx Handle %d; slot %d:&amp;quot;, conn_handle, slot );
    NRF_LOG_HEXDUMP_DEBUG(p_data, data_len);

    // m_ble_nus_c[conn_handle] identifies the connection on which the data arrived&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the &amp;quot;slot&amp;quot; is how I identify particular peripherals.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which peripheral sent data to central</title><link>https://devzone.nordicsemi.com/thread/199410?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 06:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da608a58-c9e7-4fd5-a58a-ad643155dddf</guid><dc:creator>prodey</dc:creator><description>&lt;p&gt;Thanks for the reply. Can you please elaborate?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As I mentioned in the question, in the periodic state BLE_NUS_C_EVT_NUS_TX_EVT, on receiving packets from the peripheral, &lt;strong&gt;the conn_handle is always 0, even if the event is triggered by different peripherals&lt;/strong&gt;. So, every instance we get this periodic event, how do you know which peripheral is the source of this data?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do I need to have separate event handlers for the 2 peripherals? In that case how to initialize and how to handle it in the db_disc_handler()?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to know which peripheral sent data to central</title><link>https://devzone.nordicsemi.com/thread/199331?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2019 14:34:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e92aa2d-8291-4bc8-a1b4-fe7ac4dba3ea</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;The Connection Handle identifies which &lt;em&gt;connection&lt;/em&gt; data came it on.&lt;/p&gt;
&lt;p&gt;So you would have to manage relating that to which particular peripheral in on which connection ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>