From c7ea0af6fef18b5d433bc628b9b83289eb7f7744 Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Thu, 17 Dec 2015 14:27:57 +0000 Subject: [PATCH] WIP: Analysing correct use of private resolvable addresses --- inc/MicroBitConfig.h | 2 +- source/ble-services/MicroBitBLEManager.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/MicroBitConfig.h b/inc/MicroBitConfig.h index ebc57c4..f41b997 100644 --- a/inc/MicroBitConfig.h +++ b/inc/MicroBitConfig.h @@ -141,7 +141,7 @@ // Enable/Disable the use of private resolvable addresses. // Set '1' to enable. #ifndef MICROBIT_BLE_PRIVATE_ADDRESSES -#define MICROBIT_BLE_PRIVATE_ADDRESSES 0 +#define MICROBIT_BLE_PRIVATE_ADDRESSES 1 #endif // Enable/Disable BLE Service: MicroBitDFU diff --git a/source/ble-services/MicroBitBLEManager.cpp b/source/ble-services/MicroBitBLEManager.cpp index 243894e..a4f80e2 100644 --- a/source/ble-services/MicroBitBLEManager.cpp +++ b/source/ble-services/MicroBitBLEManager.cpp @@ -232,6 +232,10 @@ void MicroBitBLEManager::pairingMode(MicroBitDisplay &display) // Update the advertised name of this micro:bit to include the device name ble->clearAdvertisingPayload(); + + // Always configure for public addresses in pairing mode... + ble->setAddress(Gap::ADDR_TYPE_PUBLIC, NULL); + ble->accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble->accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)BLEName.toCharArray(), BLEName.length()); ble->setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);