<?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>Please tell me how to get the &amp;quot;device name&amp;quot; included in the advertisement signal.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102440/please-tell-me-how-to-get-the-device-name-included-in-the-advertisement-signal</link><description>Nice to meet you, I&amp;#39;m an engineer living in Japan. 
 I am creating a simple program that acquires advertised information by scanning the central for information advertised from peripherals. 
 By checking the structure of &amp;quot;ble_gap_evt_adv_report_t&amp;quot;, I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Aug 2023 06:54:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102440/please-tell-me-how-to-get-the-device-name-included-in-the-advertisement-signal" /><item><title>RE: Please tell me how to get the "device name" included in the advertisement signal.</title><link>https://devzone.nordicsemi.com/thread/439817?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2023 06:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b424d275-b8ff-40cb-9d45-58ad4b1fe94f</guid><dc:creator>Terutaka Takeuji</dc:creator><description>&lt;p&gt;Mr.Sigurd, sorry for the late reply.&lt;/p&gt;
&lt;p&gt;Based on the sample program you gave me&lt;br /&gt;I was able to test and get the device name.&lt;/p&gt;
&lt;p&gt;thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Please tell me how to get the "device name" included in the advertisement signal.</title><link>https://devzone.nordicsemi.com/thread/439367?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2023 00:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ede8141-b5e3-4e48-bb85-23c51a210b35</guid><dc:creator>Terutaka Takeuji</dc:creator><description>&lt;p&gt;Mr. Sigurd: Thank you for your reply.&lt;br /&gt;I didn&amp;#39;t notice your reply so quickly.&lt;/p&gt;
&lt;p&gt;I will try the program code you gave me.&lt;/p&gt;
&lt;p&gt;thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Please tell me how to get the "device name" included in the advertisement signal.</title><link>https://devzone.nordicsemi.com/thread/439172?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2023 07:28:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff369ef3-993e-4d63-bd09-cf696bcee259</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Here is some code snippet that can help you find the advertising name in the advertising data.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef struct
{
    uint8_t * p_data;   /**&amp;lt; Pointer to data. */
    uint16_t  data_len; /**&amp;lt; Length of data. */
} data_t;

#define N_AD_TYPES 2
/**@brief Function for handling Scaning events.
 *
 * @param[in]   p_scan_evt   Scanning event.
 */
static void scan_evt_handler(scan_evt_t const * p_scan_evt)
{
    ret_code_t      err_code;
    data_t          adv_data;
    uint16_t        data_offset = 0;
    uint8_t         ad_types[N_AD_TYPES];
    uint8_t       * p_parsed_name;
    uint16_t        parsed_name_len;


    switch(p_scan_evt-&amp;gt;scan_evt_id)
    {
        case NRF_BLE_SCAN_EVT_FILTER_MATCH:
            // Initialize advertisement report for parsing
            adv_data.p_data   = (uint8_t *)p_scan_evt-&amp;gt;params.filter_match.p_adv_report-&amp;gt;data.p_data;
            adv_data.data_len = p_scan_evt-&amp;gt;params.filter_match.p_adv_report-&amp;gt;data.len;

            ad_types[0] = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME;
            ad_types[1] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME;

            for (uint8_t i = 0; (i &amp;lt; N_AD_TYPES) &amp;amp;&amp;amp; (data_offset == 0); i++)
            {
                parsed_name_len = ble_advdata_search(adv_data.p_data, adv_data.data_len, &amp;amp;data_offset, ad_types[i]);
            }

            if(parsed_name_len != 0)
            {
                p_parsed_name = &amp;amp;adv_data.p_data[data_offset]; //The name we found
                NRF_LOG_HEXDUMP_INFO(p_parsed_name,parsed_name_len);
            }

            break;

        case NRF_BLE_SCAN_EVT_CONNECTING_ERROR:
            err_code = p_scan_evt-&amp;gt;params.connecting_err.err_code;
            APP_ERROR_CHECK(err_code);
            break;

        default:
          break;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>