<?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>Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35284/analog-data-on-scan-rsp</link><description>Hi, Nordic. 
 
 I&amp;#39;m developing multiple peripheral and a central. Central is only scanning and Peripherals are only advertising. 
 I got Adv data and Scan rsp data successfully. 
 
 But, I have to get some analog data like sensor. So, I have used rand</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jun 2018 06:47:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35284/analog-data-on-scan-rsp" /><item><title>RE: Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/thread/136263?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2018 06:47:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70a0acca-ef6f-4ca8-8036-051f56afc618</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;You are very welcome, good luck with your project :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/thread/136248?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2018 01:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:559467d6-14e5-4c1c-a329-a69a5edfad63</guid><dc:creator>leejh</dc:creator><description>&lt;p&gt;Thank you very much.&lt;/p&gt;
&lt;p&gt;It is very helpful for me. Thanks again&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/thread/135686?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 08:07:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2c24706-28af-42a0-976b-b1313834a421</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:10pt;"&gt;yes if you want to get analog data every 1 second, the timeout must be 1 sec and re-advertising and encode every second.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:10pt;"&gt;It must be performed on the peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:10pt;"&gt;You must act upon the events coming from the softdevice (&lt;span style="text-align:left;color:#11171a;text-transform:none;line-height:21px;text-indent:0px;letter-spacing:normal;font-style:normal;font-weight:400;text-decoration:none;white-space:normal;float:none;background-color:transparent;"&gt;BLE_GAP_EVT_TIMEOUT&lt;/span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:10pt;"&gt;To do this you must add a softdevice handler observer in the ble_stack_init (beacon does not do this but you can look at other peripheral examples and notice how they add it).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:10pt;"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing the BLE stack.
 *
 * @details Initializes the SoftDevice and the BLE event interrupt.
 */
static void ble_stack_init(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now you can add ble_evt_handler()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_TIMEOUT:
            //start advertising.
        break;
        default:
            break;
    }
}
    &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/thread/135644?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 00:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f955d0b8-d8bc-470a-98b1-64010bb06c86</guid><dc:creator>leejh</dc:creator><description>&lt;p&gt;Thanks for your answer Havard.&lt;br /&gt;My peripheral is advertising and there is no timeout. m_adv_params.timeout = 0;&lt;br /&gt;what you said, If i want to get analog data every 1 second, the timeout must be 1 sec and re advertising and encode every second???&lt;/p&gt;
&lt;p&gt;How can i do that? It should be performed peripheral? or does it have to command the peripheral from the central??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Analog data on Scan Rsp</title><link>https://devzone.nordicsemi.com/thread/135608?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 13:52:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c50dadde-724a-47b5-863c-08e7efd5fb0e</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;To change the data in the advertising data or scan respone, it must be re-encoded. Are you calling these functions multiple times? I suspect you are just calling them the first time you start advertising.&lt;/p&gt;
&lt;p&gt;let&amp;#39;s say you can call&amp;nbsp;&lt;span style="float:none;background-color:transparent;color:#000000;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;sd_ble_gap_adv_start(...)&lt;/span&gt; with a short advertising timeout. When you get the&amp;nbsp;BLE_GAP_EVT_TIMEOUT from the softdevice (remember to check if the source is advertising timeout BLE_GAP_TIMEOUT_SRC_ADVERTISING) you can do&amp;nbsp;ble_advdata_set(..) and&amp;nbsp;&lt;span style="float:none;background-color:transparent;color:#000000;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;sd_ble_gap_adv_start&lt;/span&gt;(...) again with a new random value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>