aboutsummaryrefslogtreecommitdiff
path: root/extmod/modbluetooth.c
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2020-11-04 18:21:59 +1100
committerDamien George <damien@micropython.org>2020-12-02 14:40:15 +1100
commit05fef8c6a4113bc05dd09ddd8d0bf7d136d59f39 (patch)
treeb2bb8f26199614ae31fa30aeccedc77ac023baa1 /extmod/modbluetooth.c
parentac89267fef8b2396cf46c6ba19ccbe3d10acff9a (diff)
extmod/modbluetooth: Add _IRQ_ENCRYPTION_UPDATE event.
This allows the application to be notified if any of encrypted, authenticated and bonded state change, as well as the encryption key size. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'extmod/modbluetooth.c')
-rw-r--r--extmod/modbluetooth.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index b9b7c7124..5d7de7b97 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -1107,6 +1107,13 @@ void mp_bluetooth_gap_on_connection_update(uint16_t conn_handle, uint16_t conn_i
invoke_irq_handler(MP_BLUETOOTH_IRQ_CONNECTION_UPDATE, args, 5, NULL_U8, 0, NULL_ADDR, NULL_I8, 0, NULL_UUID, NULL_DATA, 0);
}
+#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
+void mp_bluetooth_gatts_on_encryption_update(uint16_t conn_handle, bool encrypted, bool authenticated, bool bonded, uint8_t key_size) {
+ uint8_t args[] = {encrypted, authenticated, bonded, key_size};
+ invoke_irq_handler(MP_BLUETOOTH_IRQ_ENCRYPTION_UPDATE, &conn_handle, 1, args, 4, NULL_ADDR, NULL_I8, 0, NULL_UUID, NULL_DATA, 0);
+}
+#endif // MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
+
void mp_bluetooth_gatts_on_write(uint16_t conn_handle, uint16_t value_handle) {
uint16_t args[] = {conn_handle, value_handle};
invoke_irq_handler(MP_BLUETOOTH_IRQ_GATTS_WRITE, args, 2, NULL_U8, 0, NULL_ADDR, NULL_I8, 0, NULL_UUID, NULL_DATA, 0);