microbit: Add explicit service changed notification

BLE central devices (such as mobile phones/tablets) are permitted to cache the
list of services and characteristics provided by a BLE peripheral such as the
micro:bit. This was causing compatibility problems with IOS during FOTA
flashing, as the the list of BLE services may change after flashing.
This commit is contained in:
Joe Finney 2016-01-17 00:23:00 +00:00
parent 1c9ae30d1c
commit 13eb3c07e7

View file

@ -55,6 +55,15 @@ static void bleDisconnectionCallback(const Gap::DisconnectionCallbackParams_t *r
* Callback when a BLE GATT connect occurs.
static void bleConnectionCallback(const Gap::ConnectionCallbackParams_t *reason)
// Ensure that there's no stale, cached information in the client... invalidate all characteristics.
sd_ble_gatts_service_changed(reason->handle, 0x000c, 0xffff);
static void passkeyDisplayCallback(Gap::Handle_t handle, const SecurityManager::Passkey_t passkey)
(void) handle; /* -Wunused-param */
@ -122,6 +131,7 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
// automatically restart advertising after a device disconnects.
// configure the stack to hold on to CPU during critical timing events.
// mbed-classic performs __disabe_irq calls in its timers, which can cause MIC failures