]> granicus.if.org Git - esp-idf/blobdiff - components/bt/bluedroid/bta/dm/bta_dm_api.c
Merge branch 'feature/btdm_add_connect_event_and_disconnect_event_for_gattc' into...
[esp-idf] / components / bt / bluedroid / bta / dm / bta_dm_api.c
index f0e4ac7e34eed68ee8bf59dc538c506e63fa2ad9..29a20ced7187bd922a922e6bf70ef4e99e4cccbf 100644 (file)
@@ -2008,7 +2008,30 @@ void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max
         bta_sys_sendmsg(p_msg);
     }
 }
+/*******************************************************************************
+**
+** Function         BTA_DmBleDisconnect
+**
+** Description      Disconnect the ble connection, can only be used when connection is up.
+**
+** Parameters:      bd_addr   - BD address of the peer
+**
+** Returns          void
+**
+*******************************************************************************/
+void BTA_DmBleDisconnect(BD_ADDR bd_addr)
+{
+    tBTA_DM_API_BLE_DISCONNECT *p_msg;
+
+    if ((p_msg = (tBTA_DM_API_BLE_DISCONNECT *) GKI_getbuf(sizeof(tBTA_DM_API_BLE_DISCONNECT))) != NULL) {
+        memset (p_msg, 0, sizeof(tBTA_DM_API_BLE_DISCONNECT));
+
+        p_msg->hdr.event = BTA_DM_API_BLE_DISCONNECT_EVT;
+        bdcpy(p_msg->remote_bda, bd_addr);
 
+        bta_sys_sendmsg(p_msg);
+    }
+}
 /*******************************************************************************
 **
 ** Function         BTA_DmBleSetDataLength