microbit: Updates to enable anonymous advertising during normal operation

Changes to default BLE name. During normal operation, all micro:bits now have the same name: BBC micro:bit
When pairing mode (AKA BLUEZONE) is entered, device name details re appended as before, to give BBC micro:bit [<name>]

This is to provide a degree of anonymity to users, to make tracking of kids more difficult.
This commit is contained in:
Joe Finney 2015-12-11 02:09:31 +00:00
parent e042a55522
commit 5a9f5d42bd
2 changed files with 14 additions and 3 deletions

View file

@ -93,6 +93,7 @@ void MicroBit::init()
// Start the BLE stack.
bleManager.init(this->getName(), this->getSerial());
ble = bleManager.ble;

View file

@ -106,9 +106,7 @@ void MicroBitBLEManager::onDisconnectionCallback()
void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumber)
ManagedString prefix("BBC micro:bit [");
ManagedString postfix("]");
ManagedString BLEName = prefix + deviceName + postfix;
ManagedString BLEName("BBC micro:bit");
this->deviceName = deviceName;
@ -218,9 +216,21 @@ void MicroBitBLEManager::pairingComplete(bool success)
void MicroBitBLEManager::bluezone(MicroBitDisplay &display)
ManagedString namePrefix("BBC micro:bit [");
ManagedString namePostfix("]");
ManagedString BLEName = namePrefix + deviceName + namePostfix;
ManagedString prefix("BLUEZONE:");
ManagedString msg = prefix + deviceName;
// Update the advertised name of this micro:bit to include the device name
ble->accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble->accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)BLEName.toCharArray(), BLEName.length());
// Stop any running animations on the display