<?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>BLE Peripheral UART Example Modified to Transparent UART With No Pin Required to Connect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108245/ble-peripheral-uart-example-modified-to-transparent-uart-with-no-pin-required-to-connect</link><description>I am trying to test BLE at 2MBPS data throughput starting with the BLE Peripheral UART example. The first problem I am running into is that I need to confirm a pin when I try and connect with the device through BLE. How can I configure the FW to be able</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Feb 2024 10:42:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108245/ble-peripheral-uart-example-modified-to-transparent-uart-with-no-pin-required-to-connect" /><item><title>RE: BLE Peripheral UART Example Modified to Transparent UART With No Pin Required to Connect</title><link>https://devzone.nordicsemi.com/thread/468559?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 10:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4aca49ca-cbfd-4b96-aa05-92a531e515b0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can disable support for passkey and numeric comparison pairing by removing not registering any of the authentication callbacks:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/src/main.c b/src/main.c
index d42e890..09ff88f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -47,9 +47,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
 
 #define CON_STATUS_LED DK_LED2
 
-#define KEY_PASSKEY_ACCEPT DK_BTN1_MSK
-#define KEY_PASSKEY_REJECT DK_BTN2_MSK
-
 #define UART_BUF_SIZE CONFIG_BT_NUS_UART_BUFFER_SIZE
 #define UART_WAIT_FOR_BUF_DELAY K_MSEC(50)
 #define UART_WAIT_FOR_RX CONFIG_BT_NUS_UART_RX_WAIT_TIME
@@ -395,37 +392,6 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
 };
 
 #if defined(CONFIG_BT_NUS_SECURITY_ENABLED)
-static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
-{
-	char addr[BT_ADDR_LE_STR_LEN];
-
-	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
-
-	LOG_INF(&amp;quot;Passkey for %s: %06u&amp;quot;, addr, passkey);
-}
-
-static void auth_passkey_confirm(struct bt_conn *conn, unsigned int passkey)
-{
-	char addr[BT_ADDR_LE_STR_LEN];
-
-	auth_conn = bt_conn_ref(conn);
-
-	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
-
-	LOG_INF(&amp;quot;Passkey for %s: %06u&amp;quot;, addr, passkey);
-	LOG_INF(&amp;quot;Press Button 1 to confirm, Button 2 to reject.&amp;quot;);
-}
-
-
-static void auth_cancel(struct bt_conn *conn)
-{
-	char addr[BT_ADDR_LE_STR_LEN];
-
-	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
-
-	LOG_INF(&amp;quot;Pairing cancelled: %s&amp;quot;, addr);
-}
-
 
 static void pairing_complete(struct bt_conn *conn, bool bonded)
 {
@@ -447,12 +413,6 @@ static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
 }
 
 
-static struct bt_conn_auth_cb conn_auth_callbacks = {
-	.passkey_display = auth_passkey_display,
-	.passkey_confirm = auth_passkey_confirm,
-	.cancel = auth_cancel,
-};
-
 static struct bt_conn_auth_info_cb conn_auth_info_callbacks = {
 	.pairing_complete = pairing_complete,
 	.pairing_failed = pairing_failed
@@ -522,48 +482,10 @@ void error(void)
 	}
 }
 
-#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
-static void num_comp_reply(bool accept)
-{
-	if (accept) {
-		bt_conn_auth_passkey_confirm(auth_conn);
-		LOG_INF(&amp;quot;Numeric Match, conn %p&amp;quot;, (void *)auth_conn);
-	} else {
-		bt_conn_auth_cancel(auth_conn);
-		LOG_INF(&amp;quot;Numeric Reject, conn %p&amp;quot;, (void *)auth_conn);
-	}
-
-	bt_conn_unref(auth_conn);
-	auth_conn = NULL;
-}
-
-void button_changed(uint32_t button_state, uint32_t has_changed)
-{
-	uint32_t buttons = button_state &amp;amp; has_changed;
-
-	if (auth_conn) {
-		if (buttons &amp;amp; KEY_PASSKEY_ACCEPT) {
-			num_comp_reply(true);
-		}
-
-		if (buttons &amp;amp; KEY_PASSKEY_REJECT) {
-			num_comp_reply(false);
-		}
-	}
-}
-#endif /* CONFIG_BT_NUS_SECURITY_ENABLED */
-
 static void configure_gpio(void)
 {
 	int err;
 
-#ifdef CONFIG_BT_NUS_SECURITY_ENABLED
-	err = dk_buttons_init(button_changed);
-	if (err) {
-		LOG_ERR(&amp;quot;Cannot init buttons (err: %d)&amp;quot;, err);
-	}
-#endif /* CONFIG_BT_NUS_SECURITY_ENABLED */
-
 	err = dk_leds_init();
 	if (err) {
 		LOG_ERR(&amp;quot;Cannot init LEDs (err: %d)&amp;quot;, err);
@@ -583,11 +505,6 @@ int main(void)
 	}
 
 	if (IS_ENABLED(CONFIG_BT_NUS_SECURITY_ENABLED)) {
-		err = bt_conn_auth_cb_register(&amp;amp;conn_auth_callbacks);
-		if (err) {
-			printk(&amp;quot;Failed to register authorization callbacks.\n&amp;quot;);
-			return 0;
-		}
 
 		err = bt_conn_auth_info_cb_register(&amp;amp;conn_auth_info_callbacks);
 		if (err) {
&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>