<?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>getting adv  device name of peripheral in central connection once connected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63656/getting-adv-device-name-of-peripheral-in-central-connection-once-connected</link><description>hai , 
 In my application to connect 5 peripherals with central and here i am connecting with device names 
 static char const m_target_periph_name1[] = &amp;quot;Nordic_Blinky1&amp;quot;; static char const m_target_periph_name2[] = &amp;quot;Nordic_Blinky2&amp;quot;; 
 i am able to print</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Jul 2020 13:20:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63656/getting-adv-device-name-of-peripheral-in-central-connection-once-connected" /><item><title>RE: getting adv  device name of peripheral in central connection once connected</title><link>https://devzone.nordicsemi.com/thread/259698?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 13:20:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8410b7cd-d48f-4489-b216-f508814ba076</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Sowmiya,&lt;/p&gt;
&lt;p&gt;I believe this is already answered in your other ticket:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/63612/connecting-multi-peripherals-in-one-central-with-m_target_periph_name"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/63612/connecting-multi-peripherals-in-one-central-with-m_target_periph_name&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You will not get the advertisement name in the connection events every connection interval.&lt;/p&gt;
&lt;p&gt;First of all, your application will only be notified if the connected device does something, such as writing to one of your characteristics. When this happens, this event will only contain the conn_handle:&lt;/p&gt;
&lt;p&gt;p_ble_evt-&amp;gt;evt.&amp;lt;event type&amp;gt;.conn_handle;&lt;/p&gt;
&lt;p&gt;For example in the connected event, that would be:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected to %02x:%02x:%02x:%02x:%02x:%02x&amp;quot;, p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[0],
                                                                        p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[1],
                                                                        p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[2],
                                                                        p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[3],
                                                                        p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[4],
                                                                        p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[5]);
            NRF_LOG_INFO(&amp;quot;conn_handle: %02x&amp;quot;, p_ble_evt-&amp;gt;evt.gap_evt.conn_handle);
            ...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So you need to somehow keep track of this connection handle to know what device the events are coming from.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want to pair this up with the advertising name, you also need to keep track of what the advertising name that belongs to what BLE address from the advertising report event.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getting adv  device name of peripheral in central connection once connected</title><link>https://devzone.nordicsemi.com/thread/259555?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 16:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d314141-49ca-439c-abe7-0ea68f5582bb</guid><dc:creator>sowmiya</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code;
 uint8_array_t adv_data;
    uint8_array_t dev_name;
    // For readability.
    ble_gap_evt_t const * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;
  const ble_gap_evt_adv_report_t *p_adv_report = &amp;amp;p_gap_evt-&amp;gt;params.adv_report;
 const ble_data_t *data = &amp;amp;p_adv_report-&amp;gt;data;
    switch (p_ble_evt-&amp;gt;header.evt_id)
    {   
        case BLE_GAP_EVT_ADV_REPORT:
        {
     
             ret_code_t err;

        

uint8_t *device_name = ble_advdata_parse(data-&amp;gt;p_data, data-&amp;gt;len, BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
    int8_t report = p_ble_evt-&amp;gt;evt.gap_evt.params.adv_report.rssi;

    if(data-&amp;gt;len == 0)
    {
      printf(&amp;quot;nothing\n&amp;quot;);
    }
    else{
      printf(&amp;quot;%s \r\n&amp;quot;,device_name);  
    }
    }
     case BLE_GAP_EVT_CONNECTED:
        { 
          
          printf(&amp;quot;CONNECTED\n&amp;quot;);
            NRF_LOG_INFO(&amp;quot;Connected.&amp;quot;);
              NRF_LOG_INFO(&amp;quot;connected to %02x,%02x,%02x,%02x,%02x,%02x\n&amp;quot;, p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[0],
                                                                       p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[1],
                                                                       p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[2],
                                                                       p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[3],
                                                                       p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[4],
                                                                       p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.addr[5]) 
                                                                       
                                                                       
                                                                       break;
                                                                       }
                                                                       }
                                                                       }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;static char const m_target_periph_name1[] = &amp;quot;Nordic_Blinky1&amp;quot;;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;static char const m_target_periph_name2[] = &amp;quot;Nordic_Blinky2&amp;quot;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For connection , above is my device name&lt;/p&gt;
&lt;p&gt;here my question is ,&lt;/p&gt;
&lt;p&gt;i should get the connected name and connection id for every connection&amp;nbsp; in central&amp;nbsp;&lt;/p&gt;
&lt;p&gt;how to get the connected device name&amp;nbsp; and&amp;nbsp; connected ID and also once it disconnected should get name the disconnected device&amp;nbsp; name and id ??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: getting adv  device name of peripheral in central connection once connected</title><link>https://devzone.nordicsemi.com/thread/259553?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 14:49:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37c20b5b-872e-4bb7-ba48-8aaa476b4779</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1856._5F00_Insert-Code-_2D00_-Nordic-2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>