diff --git a/include/btstack/hci_cmds.h b/include/btstack/hci_cmds.h index 44325f369..2b6bafc9c 100644 --- a/include/btstack/hci_cmds.h +++ b/include/btstack/hci_cmds.h @@ -673,6 +673,7 @@ extern const hci_cmd_t gap_disconnect_cmd; extern const hci_cmd_t gap_le_scan_start; extern const hci_cmd_t gap_le_scan_stop; extern const hci_cmd_t gap_le_connect_cmd; +extern const hci_cmd_t gap_le_connect_cancel_cmd; extern const hci_cmd_t gatt_discover_primary_services_cmd; #if defined __cplusplus diff --git a/src/daemon.c b/src/daemon.c index e0800e931..b25a606cb 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -533,6 +533,9 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui addr_type = packet[3]; le_central_connect(&addr, addr_type); break; + case GAP_LE_CONNECT_CANCEL: + le_central_connect_cancel(); + break; case GAP_DISCONNECT: handle = READ_BT_16(packet, 3); gap_disconnect(handle); diff --git a/src/hci.c b/src/hci.c index b7e94bcb6..ab77634aa 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2206,6 +2206,10 @@ le_command_status_t le_central_connect(bd_addr_t * addr, bd_addr_type_t addr_typ return BLE_PERIPHERAL_OK; } +le_command_status_t le_central_connect_cancel(){ + // TODO implement + return BLE_PERIPHERAL_OK; +} le_command_status_t gap_disconnect(hci_con_handle_t handle){ hci_connection_t * conn = hci_connection_for_handle(handle); diff --git a/src/hci.h b/src/hci.h index 601efe5d1..dab48f764 100644 --- a/src/hci.h +++ b/src/hci.h @@ -192,6 +192,7 @@ extern "C" { #define GAP_LE_SCAN_START 0x60 #define GAP_LE_SCAN_STOP 0x61 #define GAP_LE_CONNECT 0x62 +#define GAP_LE_CONNECT_CANCEL 0x63 // GATT (Client) 0x70 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES 0x70 @@ -413,6 +414,7 @@ typedef struct { le_command_status_t le_central_start_scan(); le_command_status_t le_central_stop_scan(); le_command_status_t le_central_connect(bd_addr_t * addr, bd_addr_type_t addr_type); +le_command_status_t le_central_connect_cancel(); le_command_status_t gap_disconnect(hci_con_handle_t handle); //*************** le client end diff --git a/src/hci_cmds.c b/src/hci_cmds.c index 5762a957a..bf4c56330 100644 --- a/src/hci_cmds.c +++ b/src/hci_cmds.c @@ -776,6 +776,14 @@ const hci_cmd_t gap_le_connect_cmd = { OPCODE(OGF_BTSTACK, GAP_LE_CONNECT), "1B" }; +/** + * @param peer_address_type + * @param peer_address + */ +const hci_cmd_t gap_le_connect_cancel_cmd = { +OPCODE(OGF_BTSTACK, GAP_LE_CONNECT_CANCEL), "" +}; + /** * @param handle */