<?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>Why are there no SoftDevice APIs that expose dynamic state?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52695/why-are-there-no-softdevice-apis-that-expose-dynamic-state</link><description>I am using s132 v5.1.0 and am in the process of implementing an error-handling architecture. 
 I&amp;#39;m noticing that much of my error handling could be avoided if there were APIs to query the dynamic internals of the SoftDevice, especially one to get the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Oct 2019 12:55:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52695/why-are-there-no-softdevice-apis-that-expose-dynamic-state" /><item><title>RE: Why are there no SoftDevice APIs that expose dynamic state?</title><link>https://devzone.nordicsemi.com/thread/212821?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2019 12:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dd9c5f9-c60e-4aeb-8da6-a1e4d8efc5eb</guid><dc:creator>haakonsh</dc:creator><description>[quote user="Elias Simon"]This appears to be subject to the same limitation as any Application code.[/quote]
&lt;p&gt;&amp;nbsp;Yes, that&amp;#39;s true.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="Elias Simon"]Can the code immediately check that this is due to pending disconnection, or does it have to wait for BLE_GAP_EVT_DISCONNECTED to confirm this?[/quote]
&lt;p&gt;It has to wait for a&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_DISCONNECTED. Though that event is sent from the SoftDevice immediately after it has itself become aware of the disconnected state of the link. Though I guess you can get a race condition where the connection state library believes a connection is valid when it, in fact, is not. Ultimately you need to handle the invalid connection handle return code from the SoftDevice calls in a non-destructive way as any connection can drop at any moment.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why are there no SoftDevice APIs that expose dynamic state?</title><link>https://devzone.nordicsemi.com/thread/212677?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2019 18:15:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d0cf158-baa7-4f46-9618-a8d8871be06c</guid><dc:creator>Elias</dc:creator><description>&lt;p&gt;&lt;span&gt;&amp;quot;To keep the predefined states updated, the module uses BLE events.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This appears to be subject to the same limitation as any Application code. There&amp;#39;s always a short period of time where the&amp;nbsp;connection state is&amp;nbsp;changed, but observers for the relevant BLE event&amp;nbsp;have not been called.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For example, in that period of time,&amp;nbsp;sd_ble_gatts_hvx() will return INVALID_STATE. Can the code immediately check that this is due to pending disconnection, or does it have to wait for BLE_GAP_EVT_DISCONNECTED to confirm this?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why are there no SoftDevice APIs that expose dynamic state?</title><link>https://devzone.nordicsemi.com/thread/212504?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2019 09:33:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0efae873-ce56-48f5-b2c6-bd8126559e8e</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;See the&amp;nbsp;&lt;a title="Connection state" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_ble_conn_state.html?cp=5_1_3_2_5"&gt;Connection state&amp;nbsp;library&lt;/a&gt;&amp;nbsp;docs and&amp;nbsp;&lt;a title="Connection state" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__ble__conn__state.html?cp=5_1_6_2_9"&gt;Connection state API&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>