microbit: Added compile time option to enabe support for BLE private resolvable addresses.

Introduced MICROBIT_BLE_PRIVATE_ADDRESSES configuration option.
Disabled by default, as it did not resolve binds correctly on Android 4.4.2
master
Joe Finney 2015-12-11 01:38:22 +00:00
parent 6f5ad99aa2
commit e042a55522
2 changed files with 11 additions and 0 deletions

View File

@ -138,6 +138,12 @@
#define MICROBIT_BLE_BLUEZONE 1
#endif
// Enable/Disable the use of private resolvable addresses.
// Set '1' to enable.
#ifndef MICROBIT_BLE_PRIVATE_ADDRESSES
#define MICROBIT_BLE_PRIVATE_ADDRESSES 0
#endif
// Enable/Disable BLE Service: MicroBitDFU
// This allows over the air programming during normal operation.
// Set '1' to enable.

View File

@ -126,6 +126,11 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
opt.enable = 1;
sd_ble_opt_set(BLE_COMMON_OPT_RADIO_CPU_MUTEX, (const ble_opt_t *)&opt);
#if CONFIG_ENABLED(MICROBIT_BLE_PRIVATE_ADDRESSES)
// Configure for private addresses, so kids' behaviour can't be easily tracked.
ble->setAddress(Gap::ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE, NULL);
#endif
// Setup our security requirements.
ble->securityManager().onPasskeyDisplay(passkeyDisplayCallback);
ble->securityManager().onSecuritySetupCompleted(securitySetupCompletedCallback);