<?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 advertise a &amp;quot;raw payload&amp;quot; of 31 bit in the gap advertiser ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55379/how-to-advertise-a-raw-payload-of-31-bit-in-the-gap-advertiser</link><description>Hi All, 
 Since 2 weeks I try to configure a gap with a &amp;quot;raw payload&amp;quot; but it&amp;#39;s a Chinese puzzle! Between different SDK, with different &amp;quot;Soft Devices&amp;quot; and examples dating back over 6 years for some who are of course not compatible with each other, I do</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Dec 2019 10:04:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55379/how-to-advertise-a-raw-payload-of-31-bit-in-the-gap-advertiser" /><item><title>RE: How to advertise a "raw payload" of 31 bit in the gap advertiser ?</title><link>https://devzone.nordicsemi.com/thread/224654?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 10:04:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7201e52e-a79e-4a9f-a9f2-09a776644def</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Jean-Marie,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the easiest way to do this is to put the data into the manufacturer specific data section of the advertisment packet. This will allow you to transmit&amp;nbsp;28 byte of custom data (the remaining 1 byte is used as a type field and two bytes are used for the company identifier). Modifying the ble_app_template example to do this is pretty simple, see below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;
    uint8_t data[28] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27};
    ble_advdata_manuf_data_t manuf_data;
    manuf_data.company_identifier = 0x0059;
    manuf_data.data.p_data = data;
    manuf_data.data.size = sizeof(data);
   

    memset(&amp;amp;init, 0, sizeof(init));
    
    init.advdata.name_type               = BLE_ADVDATA_NO_NAME;//BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = false;
    //init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    //init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    //init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
    init.advdata.p_manuf_specific_data   = &amp;amp;manuf_data;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the screenshot from nRF Connect on Android displaying the data:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-e21144aefeda4ef9b2d4e54472ec8764/Screenshot_5F00_20191210_2D00_110213_5F00_nRF-Connect.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>