<?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>Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106275/bluetooth-le-device-name-not-being-found-when-using-find-name-function</link><description>I am currently developing a BLE central device to find devices based on their name to extract data from their advertising packet without connecting. I was able to do this using the UUID, but since all of these devices will be transmitting the same UUID</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Dec 2023 08:11:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106275/bluetooth-le-device-name-not-being-found-when-using-find-name-function" /><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/459286?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2023 08:11:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46cfe880-81da-400d-b339-75d1abdf4eed</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;There are no examples of this in the SDK nor anywhere else I can find now, unfortunately. But in practice I guess you can make buffers that can hold a certain amount of advertising packets and scan response packets, and when you receive one check if you have the other type of packet from the same device already buffered, and if you do, parse them (using functions provided in ble_advdata.h).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/459212?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 14:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12a61e8a-af70-4960-be15-fbc6600298ce</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;Okay thanks. Are there any examples out there that nay expediate this?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/459188?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 13:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70ebde6e-de83-4537-8538-ea5f44c7b81f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The SoftDevice and SDK scanning module both operate separately on each advertising packet and a scan response packet is just an advertising packet in this context. So if you need to see these together, you need to parse received packets separately.&lt;/p&gt;
&lt;p&gt;In practice that would probably involve&amp;nbsp;temporarily storing relevant advertising packets &lt;em&gt;and&lt;/em&gt; scan&amp;nbsp;response&amp;nbsp;packets, and when you have received both packet types from the same address, you can parse them and get all the data that way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/459060?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 17:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa0bcb31-ed7f-4f86-8455-19e2b0f68099</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;This is the scan response data with the name. How do I go about using both of these packets to filter daat&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701796180694v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/459057?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 16:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afc9ec62-7038-4daa-97f5-cabec0269b90</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701794734048v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is the advertising packet with the data I want.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/458879?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 08:23:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3a9883b-39b1-4d4e-8437-01c305ff0d0b</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="inspiringdev123"]I am able to now find the device name, but when I use the find uuid function, the data does not match the advertising packet as seen with the BLE sniffer app I have. [/quote]
&lt;p&gt;That is why I am wondering if this data is really int he same packet, or if part of it is in the advertising packet and other parts in the scan response packets? You will not see that from Android, as the API&amp;#39;s merge the data. So if you are for instance looking for both a service UUID and a name in the same packet, it may not work. This is why it would be useful to see what is actually going on on air (for instance using the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;nRF Sniffer for Bluetooth LE&lt;/a&gt;.&lt;/p&gt;
[quote user="inspiringdev123"]Or would a Name Scan filter work better? On a name match, parse the advertising data packet?&amp;nbsp;[/quote]
&lt;p&gt;The order does not matter much in practice. You could also consider using the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_ble_scan.html"&gt;Scanning module&lt;/a&gt; filtering as is done in most central examples in the SDK, but it just a layer on top of the SoftDevice APIs that makes things a bit simpler.&lt;/p&gt;
&lt;p&gt;In any case, in order for me to give you better answers I would need two things. Firstly, a sniffer trace of the advertising (and scan response) packets so that I know what you are parsing, and all the relevant code doing the parsing. With that, we should be able to see&amp;nbsp;why the filtering does not work as intended.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/458811?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2023 17:11:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0af7abf2-669c-4bb5-8a40-8492471a4954</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;Or would a Name Scan filter work better? On a name match, parse the advertising data packet?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/458795?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2023 16:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e72d2761-f6b0-4f77-a332-0d06316f65ac</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;The device I am finding is the one advertised above with the 8 character name (I do not know what type of device it is, just a local BLE device within range). I have attached the adv. packet data I am finding as well with the Local Name. I am able to now find the device name, but when I use the find uuid function, the data does not match the advertising packet as seen with the BLE sniffer app I have. The&amp;nbsp;first set of code finds the device, but it cannot find the data using the uuid. The second set of code can find the data using the uuid but no device filter. I may have many of these devices nearby at times, so I need to differentiate by using the name first to make sure I am getting the correct device&amp;#39;s data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BLE_GAP_EVT_ADV_REPORT:
/* NOTE This doesnt work.
            bleData = p_ble_evt-&amp;gt;evt.gap_evt.params.adv_report.data;
            bool found = false;

            uint8_t * p_adv_data = bleData.p_data;
            uint16_t data_len = bleData.len;

            uint16_t   dev_name_offset = 0;
            uint16_t   field_len;

            // Search for advertising names.
            field_len = ble_advdata_search(p_adv_data,
                                   data_len,
                                   &amp;amp;dev_name_offset,
                                   BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
            if (field_len == 0)
            {
                // If data cannot be parsed, then exit.
                return;
            }
            

            memcpy(dev_name, &amp;amp;p_adv_data[dev_name_offset], field_len);
            dev_name[field_len] = 0;

            if(strcmp(target_device_name, dev_name) == 0)
            {
                // Look for 0x18FF UUID
                found = ble_advdata_uuid_find(p_adv_data,
                                      data_len,
                                      &amp;amp;ble_uuid);
                if(found)
                { 
                    // Copy the entire advertising data
                    memcpy(pressure_data, m_scan.scan_buffer_data, BLE_PRESSURE_ADV_DATA_BUFFER_SIZE);
                    process_ble_data();
                }
            }

            /* NOTE This works good.

            found = ble_advdata_uuid_find(p_encoded_data,
                                  data_len,
                                  &amp;amp;ble_uuid);
            if(found)
            { 
                // Copy the entire advertising data
                memcpy(pressure_data, m_scan.scan_buffer_data, BLE_PRESSURE_ADV_DATA_BUFFER_SIZE);
                process_ble_data();
            }
            }break; */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/thumbnail_5F00_Screenshot_5F00_20231204_5F00_080336_5F00_LightBlue.jpg" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE Device Name not being found when using find name function</title><link>https://devzone.nordicsemi.com/thread/458785?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2023 15:36:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57d1db2c-c96a-483a-b37b-dd4782e0708a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you share the details about the advertising data of the device you find and the device you do not find?&lt;/p&gt;
&lt;p&gt;Also, how do you determine weather it is a hit or miss?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Lastly, a quite common issue is if some of the data is in the advertising packets while other is in the scan response packet, and your filtering is based on them being in the same. That may not be the problem here, but&amp;nbsp;I do not see all of your code (for instance not your&amp;nbsp;process_ble_data()), so it might be&amp;nbsp;something there (note that you will see this data merged in nRF Connect for Android, so it can look like everything is in the same packet, while in reality it may not be) - so a sniffer trace showing the actual advertising data could be useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>