<?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>Parsing Adv data - manufacturer data parsing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58478/parsing-adv-data---manufacturer-data-parsing</link><description>Hi , 
 I am trying to parse the manufacturer specific data that a beacon is advertising. 
 I can read successfully the company_id but unable to read the &amp;quot;specific data &amp;quot; ( ble_advdata_manuf_data_t. data ). 
 
 Is there any example of parsing and displaying</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Mar 2020 14:58:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58478/parsing-adv-data---manufacturer-data-parsing" /><item><title>RE: Parsing Adv data - manufacturer data parsing</title><link>https://devzone.nordicsemi.com/thread/237505?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 14:58:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f676c61-db29-4fdd-a5ee-da47a35911a3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;No problem at all, I am happy to help.&lt;/p&gt;
[quote user="rani"]( which I am now able to see in my scanner )&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;Great! Does this resolve your initial question of not being able to see the specific advertisement data?&lt;/p&gt;
[quote user="rani"]I probably confused you :) sorry for that.&amp;nbsp;[/quote]
&lt;p&gt;It is no problem at all, I will do my best to understand what issues you are facing.&lt;/p&gt;
[quote user="rani"]ble_advdata_manuf_data_t.data.size actually not exist .[/quote][quote user="rani"]This is why I was looking for examples for parsing manuf data.&amp;nbsp;[/quote]
&lt;p&gt;Do I understand you correctly that you are wanting, but still unable, to extract the received advertisement data into a variable in your program?&lt;br /&gt;If this is the case, could you please post the code where you are able to extract the company identifier into a variable, but not the manufacturer specific data?&lt;br /&gt;To make it easier for me to understand your intentions in your application, please post the complete source file for your scanner.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parsing Adv data - manufacturer data parsing</title><link>https://devzone.nordicsemi.com/thread/237217?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 16:30:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc7ad705-a9ca-4387-a6e5-4905d0843d38</guid><dc:creator>ran</dc:creator><description>&lt;p&gt;Karl - Thanks.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This nested array within the manuf_data can be a bit confusing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am advertising 4 bytes ( 0x02,003,0x04,0x05 ) with company id 0x0064.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is a wire shark capture&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img height="273" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1582906862721v2.png" width="486" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;As you can see :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;length is 7 ( tag + company_id 2 bytes + my 4 bytes )&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then we can see 0x0064 , then we can see my data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;( which I am now able to see in my scanner )&amp;nbsp;&lt;/p&gt;
&lt;p&gt;so data is actually following the id field , however - the structures confuses me&amp;nbsp; :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
/**@brief Manufacturer specific data structure. */
typedef struct
{
    uint16_t                     company_identifier;                  /**&amp;lt; Company identifier code. */
    uint8_array_t                data;                                /**&amp;lt; Additional manufacturer specific data. */
} ble_advdata_manuf_data_t;

typedef struct
{
    uint16_t  size;                 /**&amp;lt; Number of array entries. */
    uint8_t * p_data;               /**&amp;lt; Pointer to array entries. */
} uint8_array_t;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;ble_advdata_manuf_data_t.data.size actually not exist .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The specific data follows the company id.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I probably confused you :) sorry for that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is why I was looking for examples for parsing manuf data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parsing Adv data - manufacturer data parsing</title><link>https://devzone.nordicsemi.com/thread/237122?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 12:38:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eae11b4-b308-4c81-ad0b-cc6dc5a51298</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hi Ran,&lt;br /&gt;&lt;br /&gt;Are you using using the provided beacon example from the SDK?&lt;br /&gt;If so, please have a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/ble_sdk_app_beacon.html"&gt;documentation for the beacon example&lt;/a&gt; provided in the SDK.&lt;br /&gt;Particularly, I think the &amp;quot;Testing&amp;quot; section of the documentation might be of interest to you?&lt;/p&gt;
[quote userid="75383" url="~/f/nordic-q-a/58478/parsing-adv-data---manufacturer-data-parsing"]I can read successfully the company_id but unable to read the &amp;quot;specific data &amp;quot; (&lt;strong&gt;ble_advdata_manuf_data_t.&lt;/strong&gt;data&amp;nbsp; )[/quote]
&lt;p&gt;I am not sure I understand exactly what you mean here. Did you successfully receive the advertised packet, and read the company_identifier from it, but you do not see the remaining bit fields of the packet received packet?&lt;br /&gt;&lt;br /&gt;If you are using the beacon example from the SDK, you can see the data structure of the data in the packets being broadcast, in the advertising_init function. You can use this to create a parser for the incoming data. &lt;br /&gt;&lt;br /&gt;Pay special attention to the structure of the data inside the ble_advdata_manuf_data_t structure, as the data field you are trying to access in it self is a structure containing a pointer to the beginning of the data, and a length variable indicating the length of the data.&lt;br /&gt;Therefore, trying to access just ble_advdata_manuf_data_t.data&amp;nbsp;might&amp;nbsp;not yield the expected result.&lt;br /&gt;&lt;br /&gt;Here is an exempt from the above mentioned function, in the beacon example, in case you have not already seen it:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    
    ...
    
    ble_advdata_manuf_data_t manuf_specific_data;

    manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    
    ...
    
    manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
    manuf_specific_data.data.size   = APP_BEACON_INFO_LENGTH;
    
    ...&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If this does not answer your question, please provide the function in which you are attempting to extract the data, and the contents of the packet where you were able to extract company_id, but not the rest.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>