<?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>Zephyr: How to get active Bluetooth connections</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95796/zephyr-how-to-get-active-bluetooth-connections</link><description>I can see all the options i have in the Bluetooth connection management but what I can&amp;#39;t figure out is how to retrieve the bt_conn objects for the active connections. https://docs.zephyrproject.org/latest/connectivity/bluetooth/api/connection_mgmt.html</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Jan 2023 14:35:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95796/zephyr-how-to-get-active-bluetooth-connections" /><item><title>RE: Zephyr: How to get active Bluetooth connections</title><link>https://devzone.nordicsemi.com/thread/405508?ContentTypeID=1</link><pubDate>Wed, 18 Jan 2023 14:35:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e5d103a-2c34-49c8-9825-4887dc33c506</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could&amp;nbsp;check the &lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/central_uart"&gt;central_uart&lt;/a&gt;&amp;nbsp;example.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr: How to get active Bluetooth connections</title><link>https://devzone.nordicsemi.com/thread/405345?ContentTypeID=1</link><pubDate>Tue, 17 Jan 2023 23:24:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1239d5cb-48f5-4eff-90e3-35222cc2c48a</guid><dc:creator>Anton Maes</dc:creator><description>&lt;p&gt;Would this make the most sense to pass as a callback to foreach? Or is there a more elegant way to accomplish this?&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void connect_active(struct bt_conn *conn, void *data) {

    if (bt_conn_state(conn) == BT_CONN_CONNECTED) {

        //power up sensor 
         //send notificaiton 
         //power down sensor 

    }else{

        printk(&amp;quot;Bluetooth connection is not established\n&amp;quot;);

    }

}


void main(){

    bt_conn_foreach(connect_active, NULL);

    k_sleep(K_SECONDS(5));
}&lt;/pre&gt;&lt;br /&gt;&lt;span class="hljs-type"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>