<?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>NCS: Bluetooth connection context library</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86088/ncs-bluetooth-connection-context-library</link><description>Hello everyone, 
 currently I&amp;#39;m working with NCS V1.9.1 and I was wondering if it is intentionally that the bt_conn_ctx_count() function always returns the CONFIG_BT_MAX_CONN count? 
 In my application the &amp;quot;_max_clients&amp;quot; count is not equal the CONFIG_BT_MAX_CONN</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Mar 2022 08:32:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86088/ncs-bluetooth-connection-context-library" /><item><title>RE: NCS: Bluetooth connection context library</title><link>https://devzone.nordicsemi.com/thread/359523?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 08:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d657bcfb-c7a4-42b5-9eb4-a3ea74ebab0d</guid><dc:creator>db_lw</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;thank you for the reply.&lt;/p&gt;
&lt;p&gt;Ok, good to know.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS: Bluetooth connection context library</title><link>https://devzone.nordicsemi.com/thread/359520?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2022 08:26:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e48fbfd4-6bef-4602-9e76-8ff8ccacb667</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It looks like it is intentional and is supposed to give you the array size to be able search the whole index to get the context by id , like below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	const size_t contexts = bt_conn_ctx_count(hids_obj-&amp;gt;conn_ctx);

	for (size_t i = 0; i &amp;lt; contexts; i++) {
		const struct bt_conn_ctx *ctx =
		    bt_conn_ctx_get_by_id(hids_obj-&amp;gt;conn_ctx, i);

		if (ctx) {&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Yes, it looks inefficient, memory wise to have fewer max clients and more array space but&amp;nbsp; do not think this will cause any functional problems in the search for context by Id as the id match will happen before the search hits the tail of the array elements. But yes, this looks like an item for optimization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>