<?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>Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49499/fully-customize-advertising-data-on-sdkv15</link><description>Hello everyone, 
 I want to fully customize the advertising and scan response data of my application because the current SDKv15 does not support all of the Advertising Data Types defined by SIG (https://www.bluetooth.com/specifications/assigned-numbers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Jul 2019 08:45:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49499/fully-customize-advertising-data-on-sdkv15" /><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197541?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 08:45:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5a91456-f96e-43ac-860e-d4d65ecde232</guid><dc:creator>Yeicatl</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;answering your questions:&lt;/p&gt;
&lt;p&gt;1. I was getting error 0x07 (NRF_ERROR_INVALID_PARAM)&lt;/p&gt;
&lt;p&gt;2. I&amp;#39;m migrating an old project to a nordic chip. And I need to replicate exactly the behaviour of the old product. Unfortunately the struct&amp;nbsp;ble_advdata_t doesn&amp;#39;t include the AD Types that I need.&lt;/p&gt;
&lt;p&gt;3. I&amp;#39;m using fast advertising&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But I have good news &lt;strong&gt;I got the advertising working&lt;/strong&gt; as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//create the handle with macro
BLE_ADVERTISING_DEF(m_advertising);

//initialize advertising
ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);

//Update advertising data &amp;amp; start advertiser
sd_ble_gap_adv_set_configure(&amp;amp;m_advertising.adv_handle, &amp;amp;m_adv_data, &amp;amp;m_advertising.adv_params);
sd_ble_gap_adv_stop(m_advertising.adv_handle);
sd_ble_gap_adv_start(m_advertising.adv_handle, APP_BLE_CONN_CFG_TAG);

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For me it looks like the function &amp;quot;&lt;strong&gt;ble_advertising_start&lt;/strong&gt;&amp;quot; from &amp;quot;ble_advertising.c&amp;quot;&lt;strong&gt; cannot be used&lt;/strong&gt; to start the advertiser if the function &lt;strong&gt;sd_ble_gap_adv_set_configure&lt;/strong&gt;()&lt;strong&gt; is also used&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks a lot for the great support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197442?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 15:07:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d46dc37e-607e-4669-9154-e6b2604ea0fd</guid><dc:creator>Jimmy Wong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you get any error code after calling set_configure?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;May I know why you need to do full control ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;why type of advertising do you plan to use?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197359?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 11:45:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f9b36ae-edba-4434-bc78-4417c5c61556</guid><dc:creator>Yeicatl</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;I think that my data follows the standard rules. Here is my advertising data update function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void advertising_update_data(void)
{
    ret_code_t             err_code;

    /* This needs to be static because of SoftDevice API requirements. */
    static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX];

    ble_gap_adv_data_t m_adv_data =
    {
        .adv_data =
        {
            .p_data = m_enc_advdata,
            .len    = 3,
        }
    };

    /* Encode flags. */
    m_enc_advdata[0] = 0x2;
    m_enc_advdata[1] = BLE_GAP_AD_TYPE_FLAGS;
    m_enc_advdata[2] = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_advertising.adv_handle, &amp;amp;m_adv_data, &amp;amp;m_advertising.adv_params);
	APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197352?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 11:26:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32da9d44-1fea-41a9-8922-cbeaa7da1f4d</guid><dc:creator>Jimmy Wong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to follow the standard rule of the advertising payload.&amp;nbsp; for example, the header of the UUID, flag, device name header.&lt;/p&gt;
&lt;p&gt;You can find all the header of advertising from the bluetooth spec.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197347?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 11:18:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:275cb166-d214-44ba-828c-558de7d80dfb</guid><dc:creator>Yeicatl</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;
&lt;p&gt;first of all thanks for the rapid response.&lt;/p&gt;
&lt;p&gt;Unfortunately this code snipet is not working for me.&lt;/p&gt;
&lt;p&gt;I have an advanced project&amp;nbsp;based on the HRMS (with FreeRTOS)&amp;nbsp; in which the functions to initialize and start the advertisment are different than the ones used in the project of the Bootloader with BLE.&lt;/p&gt;
&lt;p&gt;I tried to just call the function&amp;nbsp;sd_ble_gap_adv_set_configure() with the corresponding handle, but it has no effect&amp;nbsp;(the data remains unchanged).&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//create the handle with macro
BLE_ADVERTISING_DEF(m_advertising);

//initialize advertising
sd_ble_gap_adv_set_configure(&amp;amp;m_advertising.adv_handle, &amp;amp;m_adv_data, &amp;amp;m_advertising.adv_params);

//start advertiser
ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also tried to initialize my advertiser normally and then just update its data using the&amp;nbsp;&lt;span&gt;sd_ble_gap_adv_set_configure()&lt;/span&gt; function but it also has no effect:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//create the handle with macro
BLE_ADVERTISING_DEF(m_advertising);

//initialize advertising
ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);

//start advertiser
ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);

//Update advertising data
sd_ble_gap_adv_set_configure(&amp;amp;m_advertising.adv_handle, &amp;amp;m_adv_data, &amp;amp;m_advertising.adv_params);
&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Aren&amp;#39;t the handles for the advertiser the same? or maybe I&amp;#39;m just missing something?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fully customize advertising data on SDKv15</title><link>https://devzone.nordicsemi.com/thread/197179?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 14:41:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e319cf2a-bb58-4e83-a891-47e0d979f8c0</guid><dc:creator>Jimmy Wong</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can just refer to the bootloader with BLE advertising as the reference code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief     Function for the Advertising functionality initialization.
 *
 * @details   Encodes the required advertising data and passes it to the stack.
 *            The advertising data encoded here is specific for DFU.
 */
static uint32_t advertising_init(uint8_t adv_flags, ble_gap_adv_params_t const * const p_adv_params)
{
    uint32_t err_code;
    uint16_t actual_device_name_length = BLE_GAP_ADV_SET_DATA_SIZE_MAX - APP_ADV_DATA_HEADER_SIZE;

    /* This needs to be static because of SoftDevice API requirements. */
    static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX];

    ble_gap_adv_data_t m_adv_data =
    {
        .adv_data =
        {
            .p_data = m_enc_advdata,
            .len    = APP_ADV_DATA_HEADER_SIZE,
        }
    };

    /* Encode flags. */
    m_enc_advdata[0] = 0x2;
    m_enc_advdata[1] = BLE_GAP_AD_TYPE_FLAGS;
    m_enc_advdata[2] = adv_flags;

    /* Encode &amp;#39;more available&amp;#39; UUID list. */
    m_enc_advdata[3] = 0x3;
    m_enc_advdata[4] = BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE;
    m_enc_advdata[5] = LSB_16(BLE_DFU_SERVICE_UUID);
    m_enc_advdata[6] = MSB_16(BLE_DFU_SERVICE_UUID);

    /* Get GAP device name and length. */
    err_code = sd_ble_gap_device_name_get(&amp;amp;m_enc_advdata[9], &amp;amp;actual_device_name_length);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

    // Set GAP device in advertising data.
    m_enc_advdata[7] = actual_device_name_length + 1; // (actual_length + ADV_AD_TYPE_FIELD_SIZE(1))
    m_enc_advdata[8] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME;

    m_adv_data.adv_data.len += actual_device_name_length;

    return sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, p_adv_params);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>