<?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>Changing trasmission power with nRF51822 (Bluetooth Smart Beacon Kit)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17969/changing-trasmission-power-with-nrf51822-bluetooth-smart-beacon-kit</link><description>Hello everybody. 
 I&amp;#39;m trying to modify the original firmware that comes with the nRF51822 to make it sweep all of the permitted levels of transmission power.
I was able to change the default transmission power by calling the function sd_ble_gap_tx_power_set</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 26 Nov 2016 23:25:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17969/changing-trasmission-power-with-nrf51822-bluetooth-smart-beacon-kit" /><item><title>RE: Changing trasmission power with nRF51822 (Bluetooth Smart Beacon Kit)</title><link>https://devzone.nordicsemi.com/thread/69295?ContentTypeID=1</link><pubDate>Sat, 26 Nov 2016 23:25:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63fbf655-7731-4893-a844-7e7c40bc8ab8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, for SoftDevice S110 the correct macro is &lt;code&gt;BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT&lt;/code&gt;. For SoftDevice S130/S132/S332 the macro is changed to &lt;code&gt;BLE_GAP_TIMEOUT_SRC_ADVERTISING&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing trasmission power with nRF51822 (Bluetooth Smart Beacon Kit)</title><link>https://devzone.nordicsemi.com/thread/69294?ContentTypeID=1</link><pubDate>Sat, 26 Nov 2016 16:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea7a6569-9b5e-4162-acc2-a7e1e7ff0de6</guid><dc:creator>classicman</dc:creator><description>&lt;p&gt;Hello,
thank you for the in-depth reply.&lt;/p&gt;
&lt;p&gt;I followed your instructions, but instead of creating a new function like &lt;code&gt;void adv_timeout_on_ble_evt()&lt;/code&gt;
as you suggested, I stuffed my code inside the pre-existing &lt;code&gt;on_ble_evt( )&lt;/code&gt;, inside the case &lt;code&gt;BLE_GAP_EVT_TIMEOUT&lt;/code&gt;. I have set the timeout to 10 seconds, after which &lt;code&gt;advertising_start()&lt;/code&gt;is called.&lt;/p&gt;
&lt;p&gt;For the sake of those who might read this in the future, there was a minor mispell in your code, in fact the correct macro is &lt;strong&gt;BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT&lt;/strong&gt; and not &lt;strong&gt;BLE_GAP_TIMEOUT_SRC_ADVERTISING&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Thank you both again for your time and expertise.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing trasmission power with nRF51822 (Bluetooth Smart Beacon Kit)</title><link>https://devzone.nordicsemi.com/thread/69293?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 10:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac265452-b801-42fd-9534-0bcdd2b7ed60</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;First you will need to subscribe for BLE events, so in the function &lt;code&gt;ble_stack_init()&lt;/code&gt;, you will need to add this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All BLE events arrive at the &lt;code&gt;ble_evt_dispatch()&lt;/code&gt; function, so here we can add your advertising timeout function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    adv_timeout_on_ble_evt(p_ble_evt);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the advertising timeout function you will need to check for the BLE event called &lt;code&gt;BLE_GAP_EVT_TIMEOUT&lt;/code&gt; and with source  &lt;code&gt;BLE_GAP_TIMEOUT_SRC_ADVERTISING&lt;/code&gt;. You can then change the TX-power as you like, and then start the advertising again.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void adv_timeout_on_ble_evt(ble_evt_t * p_ble_evt){
    
    if(p_ble_evt-&amp;gt;header.evt_id == BLE_GAP_EVT_TIMEOUT &amp;amp;&amp;amp; 
       p_ble_evt-&amp;gt;evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING){
           //Change TX-power with sd_ble_gap_tx_power_set()
           advertising_start();
    }
        
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing trasmission power with nRF51822 (Bluetooth Smart Beacon Kit)</title><link>https://devzone.nordicsemi.com/thread/69292?ContentTypeID=1</link><pubDate>Fri, 25 Nov 2016 05:48:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d2e1279-4bc2-4724-bd4a-df2f9403cd38</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;Have you tried registering a callback using&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>