microbit-dal: BUGFIX maintain cccd state when service changed fails

Previously, we would rely on service changed to complete successfully
to signify a successful cccd state restore.

However, android doesn’t register for service_changed notifications,
and as a result sd_ble_gatts_service_changed always returns an error.

This meant that cccds would be erased when the complete flag was not
one, which would have been all the time.
This commit is contained in:
James Devine 2016-02-26 15:45:15 +00:00
parent 5505fc6687
commit e115e5af8d

View file

@ -105,13 +105,10 @@ static void bleSysAttrMissingCallback(const GattSysAttrMissingCallbackParams *pa
{
ret = sd_ble_gatts_sys_attr_set(params->connHandle, b->sysAttrs[deviceID].sys_attr, sizeof(b->sysAttrs[deviceID].sys_attr), BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
if(ret == 0)
{
ret = sd_ble_gatts_service_changed(params->connHandle, 0x000c, 0xffff);
complete = 1;
if (ret == 0)
complete = 1;
}
if(ret == 0)
ret = sd_ble_gatts_service_changed(params->connHandle, 0x000c, 0xffff);
}
delete b;