Jelajahi Sumber

feat(bt): Add BQB enabling and rfcomm msc command sending support

1: add the CONFIG_BT_BQB_ENABLED for some functions of bqb test.
2: add bqb_rfc_send_msc_cmd function to send rfcomm msc command with
   only address arg input.
wanglai@espressif.com 2 tahun lalu
induk
melakukan
d1443a91fa

+ 8 - 0
components/bt/host/bluedroid/Kconfig.in

@@ -47,6 +47,14 @@ config BT_CLASSIC_ENABLED
     help
         For now this option needs "SMP_ENABLE" to be set to yes
 
+config BT_BQB_ENABLED
+    bool "BT HOST BQB"
+    depends on BT_CLASSIC_ENABLED
+    default n
+    help
+        This enables the BQB support.
+        Only for bt BQB test.
+
 config BT_A2DP_ENABLE
     bool "A2DP"
     depends on BT_CLASSIC_ENABLED

+ 7 - 0
components/bt/host/bluedroid/common/include/common/bluedroid_user_config.h

@@ -95,6 +95,13 @@
 #define UC_BT_SSP_ENABLED                   FALSE
 #endif
 
+//BQB(BT)
+#ifdef CONFIG_BT_BQB_ENABLED
+#define UC_BT_BQB_ENABLED                   CONFIG_BT_BQB_ENABLED
+#else
+#define UC_BT_BQB_ENABLED                   FALSE
+#endif
+
 //BLE
 #ifdef CONFIG_BT_BLE_ENABLED
 #define UC_BT_BLE_ENABLED                   CONFIG_BT_BLE_ENABLED

+ 6 - 0
components/bt/host/bluedroid/common/include/common/bt_target.h

@@ -525,6 +525,12 @@
 #define BTM_BLE_PRIVATE_ADDR_INT UC_BT_BLE_RPA_TIMEOUT
 #endif
 
+#if (UC_BT_BQB_ENABLED == TRUE)
+#define BT_BQB_INCLUDED TRUE
+#else
+#define BT_BQB_INCLUDED FALSE
+#endif
+
 /* This feature is used to eanble interleaved scan*/
 #ifndef BTA_HOST_INTERLEAVE_SEARCH
 #define BTA_HOST_INTERLEAVE_SEARCH FALSE

+ 44 - 0
components/bt/host/bluedroid/stack/rfcomm/rfc_ts_frames.c

@@ -500,6 +500,50 @@ void rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
     rfc_send_buf_uih (p_mcb, RFCOMM_MX_DLCI, p_buf);
 }
 
+#if BT_BQB_INCLUDED
+/*******************************************************************************
+**
+** Function         bqb_rfc_send_msc_cmd
+**
+** Description      This function sends msc command for BQB test.
+**
+*******************************************************************************/
+void bqb_rfc_send_msc_cmd(BD_ADDR cert_pts_addr)
+{
+    UINT8       i;
+    UINT8       dlci;
+    BOOLEAN     get_dlci = FALSE;
+    tPORT       *p_port;
+    tPORT_CTRL  *p_pars;
+    tRFC_MCB    *p_mcb;
+
+    if ((p_pars = (tPORT_CTRL *)osi_malloc(sizeof(tPORT_CTRL))) == NULL) {
+        return;
+    }
+
+    p_pars->modem_signal = 0;
+    p_pars->break_signal = 0;
+    p_pars->fc = TRUE;
+
+    p_mcb = port_find_mcb (cert_pts_addr);
+
+    for (i = 0; i < MAX_RFC_PORTS; i++) {
+        p_port = &rfc_cb.port.port[i];
+        if (p_port->in_use && !memcmp (p_port->bd_addr, cert_pts_addr, BD_ADDR_LEN)) {
+            dlci = p_port->dlci;
+            get_dlci = TRUE;
+            break;
+        }
+    }
+
+    if (get_dlci) {
+        rfc_send_msc(p_mcb, dlci, TRUE, p_pars);
+    } else {
+        RFCOMM_TRACE_ERROR ("Get dlci fail");
+    }
+    osi_free(p_pars);
+}
+#endif /* BT_BQB_INCLUDED */
 
 /*******************************************************************************
 **