<?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>Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36981/find-short-name-in-advertising-packet-using-ble_advdata_short_name_find-getting-always-false</link><description>Hello to all, 
 I am using nRF52832 sdk15.0 version with SES IDE. I want to find adverting with short for e.g.---&amp;gt; 
 we have BLE app_uart peripherals and one multilink central. 
 ble peripheral adverting with name of &amp;quot;Nordic-XXXXXX&amp;quot; where x is BLE 48</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Aug 2018 12:06:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36981/find-short-name-in-advertising-packet-using-ble_advdata_short_name_find-getting-always-false" /><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142805?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 12:06:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:250d9bf6-f024-4661-8fb8-ea031ecdc4bc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I tested this with ble_app_blinky peripheral and central, by changing the name to &amp;quot;Nordic-01&amp;quot; in peripheral, and added my code to ble_advdata.c/.h plus changed&amp;nbsp;m_target_periph_name to &amp;quot;Nordic-&amp;quot; in central application. This works as expected, and the central connects to the peripheral. If it does not work in you application, you must have made some other changes that cause it to not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142791?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 11:30:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20d61398-11a3-421e-ad78-afa2eb269b5d</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;Thanks for fast response..!!!&lt;/p&gt;
&lt;p&gt;Yes, sorry i forget to told you modified like this:&lt;/p&gt;
&lt;p&gt;if (ble_advdata_name_find_test(p_adv_report-&amp;gt;data.p_data,&lt;br /&gt; p_adv_report-&amp;gt;data.len,&lt;br /&gt; m_target_periph_name[0])&lt;/p&gt;
&lt;p&gt;Defined whole function in main exact above of the call function.&lt;/p&gt;
&lt;p&gt;we have also other problem as per the bellow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;In sdk15.0 How i can change adverting timeout duration?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;#define APP_ADV_DURATION&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18000&amp;nbsp; &amp;nbsp; //180 second&lt;/p&gt;
&lt;p&gt;i want to change this for 5min(300 second) but when i changed it to 30000 got following error.&lt;/p&gt;
&lt;p&gt;ERROR 7 [NRF_ERROR_INVALID_PARAM] line no 895 means&lt;/p&gt;
&lt;p&gt;uint32_t err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);&lt;br /&gt; &lt;strong&gt;APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In this sdk how i can increase advertising time?&lt;/p&gt;
&lt;p&gt;Thanks..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142783?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 11:14:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f355b35-0764-4bf9-887c-8988ef962011</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Did you modify&amp;nbsp;ble_advdata_name_find function to be like the code I posted? You should add it to the application and rename it, to avoid confusion with the predefined function in ble_advertising library.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142769?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 10:07:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e1a9729-344b-4318-985d-80c96bf9ef08</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have tested this above program not working&amp;nbsp;set name like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (ble_advdata_name_find(p_adv_report-&amp;gt;data.p_data,
                              p_adv_report-&amp;gt;data.len,
                              m_target_periph_name[0])&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;where&amp;nbsp;static char const *m_target_periph_name[] = {sensor};&lt;/p&gt;
&lt;p&gt;And my sensor device advertising with name of sensor-XXXXXXX(ID)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;central not connect with sensor because not getting true from above program.&lt;/p&gt;
&lt;p&gt;Will you have other option..&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142426?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 13:26:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25730240-7244-4d87-955f-3017481357d6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You are correct,&amp;nbsp;ble_advdata_short_name_find will not work as the advertising name is of the&amp;nbsp;type&amp;nbsp;&amp;quot;Complete Local Name&amp;quot;.&amp;nbsp;ble_advdata_short_name_find will look for names of the type&amp;nbsp;&amp;quot;Shortened Local Name&amp;quot; in the advertising packet. You need to use a function very similar to&amp;nbsp;ble_advdata_name_find, but instead of checking the found name towards the complete length of the found name, you should check it towards the length of your &amp;quot;search string&amp;quot;. Note that this will only work if your &amp;quot;search string&amp;quot; is located in the beginning of the name.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;bool ble_advdata_name_find(uint8_t const * p_encoded_data,
                           uint16_t        data_len,
                           char    const * p_target_name)
{
    uint16_t        parsed_name_len;
    uint8_t const * p_parsed_name;
    uint16_t        data_offset          = 0;

    if (p_target_name == NULL)
    {
        return false;
    }


    parsed_name_len = ble_advdata_search(p_encoded_data,
                                         data_len,
                                         &amp;amp;data_offset,
                                         BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);

    p_parsed_name = &amp;amp;p_encoded_data[data_offset];

    if (   (data_offset != 0)
        &amp;amp;&amp;amp; (parsed_name_len != 0)
        &amp;amp;&amp;amp; (memcmp(p_target_name, p_parsed_name, strlen(p_target_name)) == 0))
    {
        return true;
    }

    return false;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(Note that I have not tested this solution)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142400?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 12:36:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d979da17-7dec-41cd-8c5f-ee3b646b654c</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;Thanks for your reply,&lt;/p&gt;
&lt;p&gt;As per your suggestion this function&amp;nbsp;ble_advdata_short_name_find(....); will nor work for me is right?&lt;/p&gt;
&lt;p&gt;If yes what is the use for this function i am little confused regrading how use&amp;nbsp;ble_advdata_short_name_find();&lt;/p&gt;
&lt;p&gt;Can you please provide me program snippet for&amp;nbsp;&lt;span&gt;&amp;nbsp;look for a specific string within the advertising name.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks..!!!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?</title><link>https://devzone.nordicsemi.com/thread/142095?ContentTypeID=1</link><pubDate>Tue, 31 Jul 2018 08:44:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b65ef5f-e93c-4f6d-90de-7881a54d5f00</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is not how&amp;nbsp;ble_advdata_short_name_find works. This function will parse the advertising data, looking for the &lt;a href="https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile"&gt;Bluetooth SIG specified&lt;/a&gt; advertising data type &amp;quot;Shortened Local Name&amp;quot;. In your case, the advertising name is of type &amp;quot;Complete Local Name&amp;quot;, which is why the function&amp;nbsp;ble_advdata_short_name_find always return false.&lt;/p&gt;
&lt;p&gt;If you want to look for a specific string within the advertising name, you need to write your own advertising data parsing function.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>