<?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>to copy advertisement data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18549/to-copy-advertisement-data</link><description>hello, 
 i have one nrf51 dk and it has some advertisement packet, i have another nrf51, i want this another nrf51 to copy first nrf51&amp;#39;s data. can you tell me how to copy this advertisement data??</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Dec 2016 10:05:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18549/to-copy-advertisement-data" /><item><title>RE: to copy advertisement data</title><link>https://devzone.nordicsemi.com/thread/71589?ContentTypeID=1</link><pubDate>Fri, 23 Dec 2016 10:05:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b6e36b5-f7ab-48b1-bac9-892626ffd84a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When the central is scanning, you will get a &lt;code&gt;BLE_GAP_EVT_ADV_REPORT&lt;/code&gt; event each time your device receives an advertisement package. Inside the BLE event handler, &lt;em&gt;on_ble_evt()&lt;/em&gt;, you can parse the received package and initialize advertising using the parsed data. I added an example of how this can be done below, to show you the concept. Note that this is not a complete example, and have not been tested.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t target_address[6] = {0x11,0x22,0x33,0x44,0x55,0x66}

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    const ble_gap_evt_t   * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_ADV_REPORT:
        {
            ble_gap_evt_adv_report_t *p_adv_report = &amp;amp;p_gap_evt-&amp;gt;params.adv_report;

            if(memcmp(target_address, p_adv_report-&amp;gt;peer_addr.addr, sizeof(p_adv_report-&amp;gt;peer_addr.addr)) == 0)
            {
                advertising_init(p_adv_report);
            }
        } break;
    }
}

static void advertising_init(ble_gap_evt_adv_report_t *p_adv_report)
{
    uint32_t               err_code;
    ble_advdata_t          advdata;
    ble_adv_modes_config_t options;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    // Parse received advertising packet and add to advertising data.
	// See central examples for examples of how data is parsed.

    memset(&amp;amp;options, 0, sizeof(options));
    // Set desired options

    err_code = ble_advertising_init(&amp;amp;advdata, NULL, &amp;amp;options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: to copy advertisement data</title><link>https://devzone.nordicsemi.com/thread/71588?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2016 15:09:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11ad7be8-5089-4c28-b0fd-48d7e11c3314</guid><dc:creator>nordicbeginner</dc:creator><description>&lt;p&gt;i think i should follow ble_app_hrs_c and from where i get scanned packet&amp;#39;s data??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: to copy advertisement data</title><link>https://devzone.nordicsemi.com/thread/71587?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2016 10:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5816eed-9556-4a36-b8ba-ed101bd3774c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;read the advertisement data from the first one in the second one, set the data in the second one to that, publish it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>