<?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>Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12928/possibility-to-change-advertising-timeout</link><description>Hello, 
 I want to change the advertising timout during runtime. We have two use cases for our device: 
 
 
 Batterie mode --&amp;gt; advertising timeout = 2min 
 
 
 Power supply --&amp;gt; no advertising timeout (advertising timeout = 0) 
 
 
 Is it possible</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Apr 2016 06:42:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12928/possibility-to-change-advertising-timeout" /><item><title>RE: Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/thread/49245?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2016 06:42:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2e4db0d-c78b-4b18-baf5-6d626d88af25</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hello Ole, sorry for not closing that question. I changed the advertising parameters in function ble_advertising_start() in ble_advertising.c according to my needs. This works for me so far.
So it is possible to set &lt;code&gt;adv_params.timeout = 0;&lt;/code&gt;there and it works with no timeout. But it was not possible for me, to set &lt;code&gt;adv_params.timeout = 0;&lt;/code&gt; in the advertising_init() function.
Anyway for now it works as expected. Thanks for your reply.
Regards, BTprogrammer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/thread/49246?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 15:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:858d2983-f75d-4707-b62f-3590a20a1869</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Hmm that sounds strange. You are sure that your advertisement packet does not go over the size of 31 bytes (for example name too long), see &lt;a href="https://devzone.nordicsemi.com/question/37952/setting-tx_power_level/?answer=37997#post-id-37997"&gt;here&lt;/a&gt;. adv_uuids should be declared outside the function or else the data might be destroyed when exiting the function (this may not be an issue, but to be on the safe side).&lt;/p&gt;
&lt;p&gt;ble_advertising_start(..) will call sd_ble_gap_adv_start(..) and loop through several modes (FAST, SLOW etc) when the advertisement times out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/thread/49244?ContentTypeID=1</link><pubDate>Wed, 13 Apr 2016 08:54:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1962b4f1-f3e3-4950-a6c4-a196728c065e</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Hey, sorry, but I didn`t get it running with the suggested solution.
This is my advertising_init() function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint32_t advertising_init(void){
uint32_t      err_code;
ble_advdata_t advdata;
	ble_advdata_t scanrsp;
	
	ble_uuid_t adv_uuids[] = {{BLE_UUID_DEVICE_SERVICE, GRL_DEV_SERVICE_UUID_TYPE}};

// Build and set advertising data.
memset(&amp;amp;advdata, 0, sizeof(advdata));
advdata.name_type             = BLE_ADVDATA_FULL_NAME;
	advdata.include_appearance      = true;
advdata.flags                 = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
	
	memset(&amp;amp;scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = adv_uuids;
	//scanrsp.
	
	ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&amp;amp;advdata, &amp;amp;scanrsp, &amp;amp;options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);
	return err_code;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is pretty much the same than in the ble_app_uart example. But if I set APP_ADV_TIMEOUT_IN_SECONDS to zero, the device isn`t accessible via BLE anymore...&lt;/p&gt;
&lt;p&gt;To switch between the two modes, I believe I will need the sd_ble_gap_adv_start() function. But in my current implementation, this is handled by the ble_advertising_start() function in ble_advertising.c So where do I get the needed adv_params during runtime?
BR&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/thread/49243?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2016 14:36:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3bedfa1-51c1-4e40-935e-cb2682b09542</guid><dc:creator>Andreas</dc:creator><description>&lt;p&gt;Thank you very much! I was just searching for the wrong key words. So I didn`t find that thread. I will try it that way.
BR&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to change advertising timeout</title><link>https://devzone.nordicsemi.com/thread/49242?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2016 14:31:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4df7944-683e-4825-93a4-e7129f08c693</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;See &lt;a href="https://devzone.nordicsemi.com/question/68071/change-the-advertise-interval-in-runtime/?answer=68172#post-id-68172"&gt;this answer&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>