<?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>Retrieving mfg data from a scanned packet</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106685/retrieving-mfg-data-from-a-scanned-packet</link><description>Hi 
 I using the Ble scan_adv example and my motto is just to advertise from one board with a name and manufacturer data in it. 
 Iam able to advertise using the above mentioned sample, but when i try to use the scanning part of the code in another board</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Dec 2023 09:27:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106685/retrieving-mfg-data-from-a-scanned-packet" /><item><title>RE: Retrieving mfg data from a scanned packet</title><link>https://devzone.nordicsemi.com/thread/460994?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 09:27:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5aa7d2c-f76c-45c2-b27d-a82d4c9f631c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Vignesh,&amp;nbsp;&lt;br /&gt;Sorry that I didn&amp;#39;t see that.&amp;nbsp;&lt;br /&gt;Could you try to printout the whole&amp;nbsp;buf to see if the whole data is received by the&amp;nbsp;scan_cb() or not.&amp;nbsp;&lt;br /&gt;Please note that for the function&amp;nbsp;bt_data_parse() in the documentation it says:&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;* @warning This helper function will consume `ad` when parsing. The user should&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;make a copy if the original data is to be used afterwards&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Helper for parsing advertising (or EIR or OOB) data.
 *
 * A helper for parsing the basic data types used for Extended Inquiry
 * Response (EIR), Advertising Data (AD), and OOB data blocks. The most
 * common scenario is to call this helper on the advertising data
 * received in the callback that was given to bt_le_scan_start().
 *
 * @warning This helper function will consume `ad` when parsing. The user should
 *          make a copy if the original data is to be used afterwards
 *
 * @param ad        Advertising data as given to the bt_le_scan_cb_t callback.
 * @param func      Callback function which will be called for each element
 *                  that&amp;#39;s found in the data. The callback should return
 *                  true to continue parsing, or false to stop parsing.
 * @param user_data User data to be passed to the callback.
 */
void bt_data_parse(struct net_buf_simple *ad,
		   bool (*func)(struct bt_data *data, void *user_data),
		   void *user_data);&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;So maybe it&amp;#39;s the reason why you may only see either the name or the mfg data. You need to do a back up of the buf before the first call.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieving mfg data from a scanned packet</title><link>https://devzone.nordicsemi.com/thread/460945?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 03:57:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f5f8eb8-7979-48c6-92f6-8af74efd31bf</guid><dc:creator>Vignesh R</dc:creator><description>[quote userid="2121" url="~/f/nordic-q-a/106685/retrieving-mfg-data-from-a-scanned-packet/460815"]The advertising packet and the scan packet arrives in the application as separate packets.&amp;nbsp;[/quote]
&lt;p&gt;Do u mean the scan response data??&lt;/p&gt;
&lt;p&gt;i dont send any scan response data , i send only the adv. data, as below&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define DEVICE_NAME &amp;quot;Thingy-1&amp;quot;
static uint8_t mfg_data[] = {0xff, 0xff, 0x00};

static const struct bt_data ad[] = {
	BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, 8),
};
	
/* Start advertising */
	err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
			      NULL, 0);
	if (err) {
		printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);
		return 0;
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the sd is set to NULL.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Retrieving mfg data from a scanned packet</title><link>https://devzone.nordicsemi.com/thread/460815?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 13:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9efeffd-6894-42d6-89f4-bec5f5a48976</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Vignesh,&amp;nbsp;&lt;br /&gt;The advertising packet and the scan packet arrives in the application as separate packets.&amp;nbsp;&lt;br /&gt;There is no connection between them except that they are from the same advertiser. So what you need to do is to match the &lt;strong&gt;advertiser address&lt;/strong&gt; in each&amp;nbsp;packet so you know which manufacturer data is belong to which advertiser name.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>