From 035ecb85c3513be2b6ab5c515db082cb7fee8f97 Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期四, 22 五月 2025 18:11:06 +0800
Subject: [PATCH] 修改bug,io改为不拉

---
 01_SDK/nimble/host/smp_bt/app_smp/smp_ble.c |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/01_SDK/nimble/host/smp_bt/app_smp/smp_ble.c b/01_SDK/nimble/host/smp_bt/app_smp/smp_ble.c
index 46b7847..2538120 100644
--- a/01_SDK/nimble/host/smp_bt/app_smp/smp_ble.c
+++ b/01_SDK/nimble/host/smp_bt/app_smp/smp_ble.c
@@ -64,22 +64,26 @@
 gatt_svr_chr_access_smp(uint16_t conn_handle, uint16_t attr_handle,
                             struct ble_gatt_access_ctxt *ctxt, void *arg);
 
-static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
+static const struct ble_gatt_svc_def gatt_svr_svcs[] = 
+{
     {
         /* Service: smp */
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid = &gatt_svr_svc_smp.u,
-        .characteristics = (struct ble_gatt_chr_def[]) { {
-            /* Characteristic: Write No Rsp */
-            .uuid = &gatt_svr_chr_smp.u,
-            .access_cb = gatt_svr_chr_access_smp,
-            .flags = BLE_GATT_CHR_F_WRITE_NO_RSP | BLE_GATT_CHR_F_NOTIFY,
-            .val_handle = &g_ble_smp_attr_handle,
-        }, {
-            0, /* No more characteristics in this service */
-        } },
+        .characteristics = (struct ble_gatt_chr_def[]) 
+		{ 
+			{
+				/* Characteristic: Write No Rsp */
+				.uuid = &gatt_svr_chr_smp.u,
+				.access_cb = gatt_svr_chr_access_smp,
+				.flags = BLE_GATT_CHR_F_WRITE_NO_RSP | BLE_GATT_CHR_F_NOTIFY,
+				.val_handle = &g_ble_smp_attr_handle,
+			}, 
+			{
+				0, /* No more characteristics in this service */
+			} 
+		},
     },
-
     {
         0, /* No more services */
     },
@@ -104,9 +108,7 @@
                 /* Sufficient usrhdr space already present. */
                 m_req = ctxt->om;
                 ctxt->om = NULL;
-            } else if (OS_MBUF_LEADINGSPACE(ctxt->om) >=
-                       sizeof (conn_handle)) {
-
+            } else if (OS_MBUF_LEADINGSPACE(ctxt->om) >= sizeof (conn_handle)) {
                 /* Usrhdr isn't present, but there is enough leading space to
                  * add one.
                  */
@@ -119,13 +121,11 @@
                  * copy.  Don't set ctxt->om to NULL; let the NimBLE host free
                  * it.
                  */
-                m_req = os_msys_get_pkthdr(OS_MBUF_PKTLEN(ctxt->om),
-                                           sizeof (conn_handle));
+                m_req = os_msys_get_pkthdr(OS_MBUF_PKTLEN(ctxt->om), sizeof (conn_handle));
                 if (!m_req) {
                     return BLE_ATT_ERR_INSUFFICIENT_RES;
                 }
-                rc = os_mbuf_appendfrom(m_req, ctxt->om, 0,
-                                        OS_MBUF_PKTLEN(ctxt->om));
+                rc = os_mbuf_appendfrom(m_req, ctxt->om, 0, OS_MBUF_PKTLEN(ctxt->om));
                 if (rc) {
                     return BLE_ATT_ERR_INSUFFICIENT_RES;
                 }
@@ -185,9 +185,10 @@
 
     while ((m_resp = os_mqueue_get(&g_smp_ble_mq)) != NULL) {
         assert(OS_MBUF_USRHDR_LEN(m_resp) >= sizeof (conn_handle));
+		
         memcpy(&conn_handle, OS_MBUF_USRHDR(m_resp), sizeof (conn_handle));
-        ble_gattc_notify_custom(conn_handle, g_ble_smp_attr_handle,
-                                m_resp);
+		
+        ble_gattc_notify_custom(conn_handle, g_ble_smp_attr_handle, m_resp);
     }
 }
 

--
Gitblit v1.9.3