From fc9208358e9fa80eff8b077d946642b91e17b1ad Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Tue, 16 Jun 2020 00:28:27 +0200 Subject: [PATCH] change(ble): Do not allow bonding by default --- epicardium/ble/ble_main.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/epicardium/ble/ble_main.c b/epicardium/ble/ble_main.c index ffff52d90..72fd05696 100644 --- a/epicardium/ble/ble_main.c +++ b/epicardium/ble/ble_main.c @@ -352,15 +352,14 @@ static void bleSetup(bleMsg_t *pMsg) AppAdvSetData(APP_ADV_DATA_CONNECTABLE, 0, NULL); AppAdvSetData(APP_SCAN_DATA_CONNECTABLE, 0, NULL); -#if 0 - /* TODO: card10: until we have an BLE dialog, be discoverable and bondable always */ - /* start advertising; automatically set connectable/discoverable mode and bondable mode */ - AppAdvStart(APP_MODE_AUTO_INIT); -#else - /* enter discoverable and bondable mode mode by default */ - AppSetBondable(TRUE); - AppAdvStart(APP_MODE_DISCOVERABLE); -#endif + /* We only want to be bondable when the appropriate dialog is open */ + AppSetBondable(FALSE); + /* TODO: Sadly, not advertising leads to a higher current consumption... */ + if(AppDbCheckBonded() == FALSE) { + AppAdvStop(); + } else { + AppAdvStart(APP_MODE_CONNECTABLE); + } } uint32_t epic_ble_get_compare_value(void) -- GitLab