extmod/modbluetooth: Add compile-config flag to enable pairing/bonding.

Enable it on STM32/Unix NimBLE only (pairing/bonding requires synchronous
events and full bindings).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/6662/head
Jim Mussared 2020-11-25 19:26:56 +11:00 zatwierdzone przez Damien George
rodzic 5e20f689ad
commit ac89267fef
3 zmienionych plików z 15 dodań i 0 usunięć

Wyświetl plik

@ -47,6 +47,10 @@
#error l2cap channels require synchronous modbluetooth events
#endif
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING && !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
#error pairing and bonding require synchronous modbluetooth events
#endif
#define MP_BLUETOOTH_CONNECT_DEFAULT_SCAN_DURATION_MS 2000
#define MICROPY_PY_BLUETOOTH_MAX_EVENT_DATA_TUPLE_LEN 5

Wyświetl plik

@ -54,6 +54,12 @@
#define MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS (0)
#endif
// A port can optionally enable support for pairing and bonding.
// Requires MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS.
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
#define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (0)
#endif
// This is used to protect the ringbuffer.
// A port may no-op this if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS is enabled.
#ifndef MICROPY_PY_BLUETOOTH_ENTER

Wyświetl plik

@ -24,6 +24,11 @@ ifeq ($(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY),0)
# UART is also polled by the RX IRQ.
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
# Without the ringbuffer, and with the full implementation, we can also
# enable pairing and bonding. This requires both synchronous events and
# some customisation of the key store.
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
NIMBLE_LIB_DIR = lib/mynewt-nimble
LIB_SRC_C += $(addprefix $(NIMBLE_LIB_DIR)/, \