<?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>Initialising Advertising data and encoding them in SDK 15.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43310/initialising-advertising-data-and-encoding-them-in-sdk-15-2</link><description>Hello everyone! I am a beginner and I need help in understanding advertising data. I am migrationg from SDK 13 to SDK 15.2. In SDK 13, the advertising data with manufacturer data for becon, ble device address, flag: LE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Feb 2019 11:02:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43310/initialising-advertising-data-and-encoding-them-in-sdk-15-2" /><item><title>RE: Initialising Advertising data and encoding them in SDK 15.2</title><link>https://devzone.nordicsemi.com/thread/169694?ContentTypeID=1</link><pubDate>Wed, 06 Feb 2019 11:02:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4cb4d9b-46ac-46d1-97ea-9fcc3543373a</guid><dc:creator>dk_07</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Even after removing the uuid from adv data. I still get the error code 12.&lt;/p&gt;
&lt;p&gt;These are my settings in version 13.2 and 15.&lt;pre class="ui-code" data-mode="text"&gt;static void SDK_13_ble_advertising_init(void)
{
            uint32_t              		err_code;
            ble_advdata_t          		advdata;
            ble_advdata_t          		scanrsp;
            ble_adv_modes_config_t 		options;
            ble_advdata_manuf_data_t 	manuf_specific_data;


            manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER_APPLE;
            manuf_specific_data.data.p_data 	   = (uint8_t *) m_beacon_info;
            manuf_specific_data.data.size   	   = APP_BEACON_INFO_LENGTH;

            // Build advertising data struct to pass into @ref ble_advertising_init.
            ble_uuid_t m_adv_uuids[] = {{SERVICE_P_SERVICE_UUID, m_service.uuid_type}};

            memset(&amp;amp;scanrsp, 0, sizeof(scanrsp));
            scanrsp.uuids_complete.uuid_cnt        = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
            scanrsp.uuids_complete.p_uuids  	   = m_adv_uuids;

            memset(&amp;amp;advdata, 0, sizeof(advdata));
            advdata.name_type               	  = BLE_ADVDATA_NO_NAME;
            advdata.include_appearance      	  = false;
            advdata.include_ble_device_addr 	  = true;
            advdata.flags                   	  = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
            advdata.p_manuf_specific_data 		  = &amp;amp;manuf_specific_data;

            memset(&amp;amp;options, 0, sizeof(options));
            options.ble_adv_fast_enabled  		= true;
            options.ble_adv_fast_interval 		= NON_CONNECTABLE_ADV_INTERVAL;
            options.ble_adv_fast_timeout 		= APP_CFG_NON_CONN_ADV_TIMEOUT;

            err_code = ble_advertising_init(&amp;amp;advdata,&amp;amp;scanrsp,&amp;amp;options, on_adv_evt, NULL);
            APP_ERROR_CHECK(err_code);

}


************************************************************************************************************

static uint8_t m_enc_scan_response_data[BLE_GAP_ADV_SET_DATA_SIZE_MAX];         /**&amp;lt; Buffer for storing an encoded scan data. */
static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX];                    /**&amp;lt; Buffer for storing an encoded advertising set. */

/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = m_enc_scan_response_data,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX

    }
};

static void SDK_15_ble_advertising_init(void)
{
        uint32_t                            err_code;
        ble_advdata_t 						advdata;
        ble_advdata_t 						scanrsp;
//  ble_adv_modes_config_t 		options;
        ble_advdata_manuf_data_t 	        manuf_specific_data;

        /* Initialize structs. */
        memset(&amp;amp;advdata, 0, sizeof(ble_advdata_t));
        memset(&amp;amp;scanrsp, 0, sizeof(ble_advdata_t));

        manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER_APPLE;
        manuf_specific_data.data.p_data 	   	 = (uint8_t *) m_beacon_info;
        manuf_specific_data.data.size   	   	 = APP_BEACON_INFO_LENGTH;

        /// Build advertising data struct to pass into @ref ble_advertising_init.
        ble_uuid_t m_adv_uuids[] = {{SERVICE_P_SERVICE_UUID, m_service.uuid_type}};

        /* Prepare scan response data. */
        scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

        /* Prepare advertising data. */
        advdata.name_type          			= BLE_ADVDATA_NO_NAME;
        advdata.include_appearance 			= false;
        advdata.include_ble_device_addr     = true;
        advdata.flags              			= BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        advdata.p_manuf_specific_data 	    = &amp;amp;manuf_specific_data;


//  memset(&amp;amp;options, 0, sizeof(options));
//  options.ble_adv_fast_enabled  	= true;
//  options.ble_adv_fast_interval 	= NON_CONNECTABLE_ADV_INTERVAL;
//  options.ble_adv_fast_timeout 	= APP_CFG_NON_CONN_ADV_TIMEOUT;

        err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);
        APP_ERROR_CHECK(err_code);
       
        err_code = ble_advdata_encode(&amp;amp;scanrsp, m_adv_data.scan_rsp_data.p_data, &amp;amp;m_adv_data.scan_rsp_data.len);
        APP_ERROR_CHECK(err_code);

}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In version 15 the ble device address, flag and manufacturer data in p_len are 9, 3 and 25 respectively, which sums upto 37bytes.&lt;/p&gt;
&lt;p&gt;Thanks a lot in advance&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initialising Advertising data and encoding them in SDK 15.2</title><link>https://devzone.nordicsemi.com/thread/169478?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2019 11:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e21db278-d190-4237-a76a-2ed358e0a8c4</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am happy to hear that you figured it out!&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initialising Advertising data and encoding them in SDK 15.2</title><link>https://devzone.nordicsemi.com/thread/169361?ContentTypeID=1</link><pubDate>Mon, 04 Feb 2019 16:30:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7abbb2a8-bae6-4dab-ac4d-b94fe57770b5</guid><dc:creator>dk_07</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks a lot for your response. I figured it out. I was advertising uuid both in adv_data and scan_response data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Initialising Advertising data and encoding them in SDK 15.2</title><link>https://devzone.nordicsemi.com/thread/169352?ContentTypeID=1</link><pubDate>Mon, 04 Feb 2019 15:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a59bcc4-0805-4d39-993e-00a97cd4f083</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you set up the same advertising data in SDK 15.2 as you did in SDK 13 then I see no reason why it should work in one but not in the other. Can you share the code excerpts for setting up the particular advertising data? (Preferably for both SDK versions.)&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>