extmod/modbluetooth: Support gap_connect(None) to cancel a connection.

Allow cancellation of in-progress peripheral connections.
This commit is contained in:
Jonathan Hogg
2021-07-12 08:46:29 +01:00
committed by Damien George
parent de7e3cd792
commit 851ecb2da1
5 changed files with 32 additions and 2 deletions

View File

@@ -365,7 +365,12 @@ A central device can connect to peripherals that it has discovered using the obs
See :meth:`gap_scan <BLE.gap_scan>` for details about address types.
On success, the ``_IRQ_PERIPHERAL_CONNECT`` event will be raised.
To cancel an outstanding connection attempt early, call
``gap_connect(None)``.
On success, the ``_IRQ_PERIPHERAL_CONNECT`` event will be raised. If
cancelling a connection attempt, the ``_IRQ_PERIPHERAL_DISCONNECT`` event
will be raised.
The device will wait up to *scan_duration_ms* to receive an advertising
payload from the device.