[ble] Add support to clear all current bondings

This commit is contained in:
Dimitris Zervas
2020-09-15 01:52:33 +03:00
committed by Kyle Brown
parent e5700eeb5f
commit 2cf64d8ce7
4 changed files with 12 additions and 1 deletions

View File

@@ -63,3 +63,8 @@ class BLEHID(AbstractHID):
return self.devices[reporting_device_const].send_report(
evt[1 : report_size + 1]
)
def clear_bonds(self):
import _bleio
_bleio.adapter.erase_bonding()

View File

@@ -254,3 +254,8 @@ def led_mode_breathe(key, state, *args, **kwargs):
state.config.led.effect_init = True
state.config.led.animation_mode = 'breathing'
return state
def bt_clear_bonds(key, state, *args, **kwargs):
state.config._hid_helper_inst.clear_bonds()
return state

View File

@@ -641,6 +641,7 @@ make_key(names=('LED_ANI',), on_press=handlers.led_ani)
make_key(names=('LED_AND',), on_press=handlers.led_and)
make_key(names=('LED_MODE_PLAIN', 'LED_M_P'), on_press=handlers.led_mode_static)
make_key(names=('LED_MODE_BREATHE', 'LED_M_B'), on_press=handlers.led_mode_breathe)
make_key(names=('BT_CLEAR_BONDS', 'BT_CLR'), on_press=handlers.bt_clear_bonds)
make_key(