<?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 connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100129/why-connection-state-is-bt_conn_state_connecting</link><description>Hi, 
 After connection is disconnected, connection state stays BT_CONN_STATE_CONNECTING and not BT_CONN_STATE_DISCONNECTED. 
 Why is that? 
 
 Ican change to 
 if (conState != BT_CONN_STATE_CONNECTED) and it will work as I expect, but I&amp;#39;d like to understand</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 May 2023 15:02:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100129/why-connection-state-is-bt_conn_state_connecting" /><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427862?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 15:02:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bd127c5-499e-4649-963c-74abb6286b24</guid><dc:creator>Johan.h</dc:creator><description>&lt;p&gt;Noted and understood.&lt;/p&gt;
&lt;p&gt;Thanks for your support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427859?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 14:59:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f52a58f7-2e6b-4f42-801e-dc6fd493769a</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;No problem. Onto the new question, we try to keep one DevZone thread focused on one topic only. Therefore, when the topic changes, please try to start a new question. I will note down some short answer still.&lt;/p&gt;
&lt;p&gt;Yes, it is possible.&lt;/p&gt;
&lt;p&gt;If your device supports more than one connection, then you can&amp;nbsp;also maintain a&amp;nbsp;connectable advertisement as long as you have not reached the maximum number of connections.&lt;/p&gt;
&lt;p&gt;If your device has reached the maximum number of connections, it can still&amp;nbsp;maintain one or more non-connectable advertisement.&lt;/p&gt;
&lt;p&gt;For further details, there should be some&amp;nbsp;existing DevZone questions on this question, that you can look up with the search feature or an internet search engine. &lt;br /&gt;If not, please open a new question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427853?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 14:48:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31aaf4ad-eeb1-4bd3-a768-36af468bd015</guid><dc:creator>Johan.h</dc:creator><description>&lt;p&gt;Thanks. I wonder if it is possible to keep advertising while one connection is active,&amp;nbsp; with nrf52832?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427827?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 13:39:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b95a0a53-1b6f-459b-b02e-2d3f7b390fb5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Yes, that&amp;#39;s what I mean.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think you should comment out bt_conn_unref().&lt;/p&gt;
&lt;p&gt;Keeping your own flag is&amp;nbsp;one approach. It works fine if you only support one connection.&lt;/p&gt;
&lt;p&gt;If you plan to have multiple connection, you can upgrade to using your own struct that has the bt_conn structure as a field and a flag.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427810?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 12:57:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99067930-f627-4527-9aa9-8ae6d784fcd7</guid><dc:creator>Johan.h</dc:creator><description>&lt;p&gt;I&amp;nbsp;think I understand what you mean.&lt;/p&gt;
&lt;p&gt;in on_conncted() Icall&amp;nbsp;&lt;/p&gt;
&lt;p&gt;my_conn = bt_conn_ref(conn);&lt;/p&gt;
&lt;p&gt;but in&amp;nbsp;on_disconnected() I&lt;/p&gt;
&lt;p&gt;call&amp;nbsp;bt_conn_unref(my_conn);&lt;/p&gt;
&lt;p&gt;So I assume this makes my_con invalid?&lt;/p&gt;
&lt;p&gt;Should I keep my own bool flag for connected and set/reset in the callbacks, or might I just comment out&amp;nbsp; bt_conn_unref() ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Johanan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why connection state is BT_CONN_STATE_CONNECTING ?</title><link>https://devzone.nordicsemi.com/thread/427716?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 09:17:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:518c2e15-849d-4b2c-ae77-59388cd7f1db</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Johanan,&lt;/p&gt;
&lt;p&gt;How are you setting up your &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;my_conn&lt;/span&gt; pointer? I wonder if that structure is still valid after a disconnection.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>