<?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>how to add custom data in advertise packet with sdk17.2.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78959/how-to-add-custom-data-in-advertise-packet-with-sdk17-2-0</link><description>Hi, 
 
 I am working on nrf52832 development board. 
 I am using SDK17.2.0. 
 I am running the device in peripheral mode in always advertising mode. 
 And I would like to add custom data to the advertise packet so that the central device on the other</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Sep 2021 13:53:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78959/how-to-add-custom-data-in-advertise-packet-with-sdk17-2-0" /><item><title>RE: how to add custom data in advertise packet with sdk17.2.0</title><link>https://devzone.nordicsemi.com/thread/327996?ContentTypeID=1</link><pubDate>Fri, 03 Sep 2021 13:53:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91bf9541-8e92-441c-9c1a-83ec0d1bcbf8</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;You don&amp;#39;t specify what the problem is. Are you getting any errors?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to add custom data in advertise packet with sdk17.2.0</title><link>https://devzone.nordicsemi.com/thread/326880?ContentTypeID=1</link><pubDate>Fri, 27 Aug 2021 06:30:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:556de9a1-8b67-4946-a1c2-3798e136d4e4</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;And i have already tried this code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;ret_code_t err_code;&lt;br /&gt; ble_advdata_t mydata;&lt;br /&gt; ble_advdata_manuf_data_t manuf_specific_data;&lt;/p&gt;
&lt;p&gt;uint8_t data[] = &amp;quot;New!&amp;quot;; //data to include in the manufacturer field&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; manuf_specific_data.data.p_data = data;&lt;br /&gt; manuf_specific_data.data.size = sizeof(data);&lt;br /&gt; manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER; // company identifier is required&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;mydata, 0, sizeof(mydata));&lt;/p&gt;
&lt;p&gt;mydata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;&lt;br /&gt; mydata.p_manuf_specific_data = &amp;amp;manuf_specific_data;&lt;/p&gt;
&lt;p&gt;/*swap adv data buffer - from API doc: &amp;quot;In order to update advertising&lt;br /&gt; data while advertising,new advertising buffers must be provided&amp;quot;*/&lt;br /&gt; m_adv_data.adv_data.p_data = (m_adv_data.adv_data.p_data == m_encoded_data[0])&lt;br /&gt; ? m_encoded_data[1] : m_encoded_data[0];&lt;/p&gt;
&lt;p&gt;err_code = ble_advdata_encode(&amp;amp;mydata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; err_code = sd_ble_gap_adv_set_configure(&amp;amp;(m_advertising.adv_handle), &amp;amp;m_adv_data, NULL);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But is that &lt;span&gt;ble_advdata_encode(); needed for sure? Can i send data without encoding?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to add custom data in advertise packet with sdk17.2.0</title><link>https://devzone.nordicsemi.com/thread/326878?ContentTypeID=1</link><pubDate>Fri, 27 Aug 2021 06:28:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc731cb6-1c2b-4464-9d3a-68af8b121636</guid><dc:creator>swetha Paladugu</dc:creator><description>&lt;p&gt;I went through the tutorial. This code is for adding data in advertising_init() funciton called before calling advertising_start() function. I want to update data during advertising but a button press or something.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void advertising_init(void)&lt;br /&gt;{&lt;br /&gt; ret_code_t err_code;&lt;br /&gt; ble_advertising_init_t init; // Struct containing advertising parameters&lt;br /&gt; // Build advertising data struct to pass into @ref ble_advertising_init.&lt;br /&gt; memset(&amp;amp;init, 0, sizeof(init));&lt;/p&gt;
&lt;p&gt;ble_advdata_manuf_data_t manuf_data; //Variable to hold manufacturer specific data&lt;br /&gt; uint8_t data[] = &amp;quot;SomeData!&amp;quot;; //Our data to advertise&lt;br /&gt; manuf_data.company_identifier = 0x0059; //Nordics company ID&lt;br /&gt; manuf_data.data.p_data = data;&lt;br /&gt; manuf_data.data.size = sizeof(data);&lt;br /&gt; init.advdata.p_manuf_specific_data = &amp;amp;manuf_data;&lt;/p&gt;
&lt;p&gt;init.advdata.name_type = BLE_ADVDATA_FULL_NAME; // Use a shortened name&lt;br /&gt; init.advdata.short_name_len = 6; // Advertise only first 6 letters of name&lt;br /&gt; init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;br /&gt; init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);&lt;br /&gt; init.advdata.uuids_complete.p_uuids = m_adv_uuids;&lt;/p&gt;
&lt;p&gt;init.config.ble_adv_fast_enabled = true;&lt;br /&gt; init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;&lt;br /&gt; init.config.ble_adv_fast_timeout = APP_ADV_DURATION;&lt;/p&gt;
&lt;p&gt;init.evt_handler = on_adv_evt;&lt;/p&gt;
&lt;p&gt;err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to add custom data in advertise packet with sdk17.2.0</title><link>https://devzone.nordicsemi.com/thread/326771?ContentTypeID=1</link><pubDate>Thu, 26 Aug 2021 12:03:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04043d31-e941-46fa-9e21-80e678b0ec65</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please see our &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-advertising-a-beginners-tutorial"&gt;tutorial on advertising&lt;/a&gt; on how to customize the advertising packet.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>