<?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>Way to check if device is Bluetooth paired (even if not currently connected)?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116378/way-to-check-if-device-is-bluetooth-paired-even-if-not-currently-connected</link><description>We want to know if device is already Bluetooth paired. We can check for this manually in the shell by using `settings list` command and seeing bt/keys as one of the stored properties. However, is there an API to do this? We don&amp;#39;t see anything int he settings</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Nov 2024 12:05:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116378/way-to-check-if-device-is-bluetooth-paired-even-if-not-currently-connected" /><item><title>RE: Way to check if device is Bluetooth paired (even if not currently connected)?</title><link>https://devzone.nordicsemi.com/thread/510462?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2024 12:05:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49688a94-9865-4344-a6af-4bbfa0988b64</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can use &lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-latest/page/group_bt_gap.html#gaad380b7f8984f8522c1b79f9bdc04905"&gt;bt_foreach_bond&lt;/a&gt;() to find the addresses of the peer(s) that are bonded with your device.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void bond_cb(const struct bt_bond_info *info, void *user_data)
{
	ARG_UNUSED(info);

	*(int *) user_data += 1;
	LOG_INF(&amp;quot;Existing bond found&amp;quot;);

	return;
}
    ...
    int bond_num = 0;
    bt_foreach_bond(BT_ID_DEFAULT, bond_cb, &amp;amp;bond_num);
    ...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>