From 801e8ffacff0d2ed15e82136db2a8a45afbfab7b Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Wed, 25 Nov 2020 00:06:16 +1100 Subject: extmod/modbluetooth: Add gap_pair(conn_handle) func to intiate pairing. Signed-off-by: Jim Mussared --- extmod/nimble/modbluetooth_nimble.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'extmod/nimble') diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c index 852b9eac0..b1f13ee98 100644 --- a/extmod/nimble/modbluetooth_nimble.c +++ b/extmod/nimble/modbluetooth_nimble.c @@ -860,6 +860,13 @@ int mp_bluetooth_set_preferred_mtu(uint16_t mtu) { return 0; } +#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING +int mp_bluetooth_gap_pair(uint16_t conn_handle) { + DEBUG_printf("mp_bluetooth_gap_pair: conn_handle=%d\n", conn_handle); + return ble_hs_err_to_errno(ble_gap_security_initiate(conn_handle)); +} +#endif // MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING + #if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE STATIC void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) { -- cgit v1.2.3