diff --git a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp index 48df9f9b1c..f8010ef390 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp @@ -171,9 +171,6 @@ ble_error_t BLEInstanceBase::shutdown() return BLE_ERROR_INITIALIZATION_INCOMPLETE; } - initialization_status = NOT_INITIALIZED; - _hci_driver->terminate(); - #if BLE_FEATURE_GATT_SERVER getGattServer().reset(); #endif @@ -185,6 +182,9 @@ ble_error_t BLEInstanceBase::shutdown() getGap().reset(); _event_queue.clear(); + initialization_status = NOT_INITIALIZED; + _hci_driver->terminate(); + return BLE_ERROR_NONE; } diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp index 24c8c35805..8cfd97f64a 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp @@ -907,6 +907,7 @@ ble_error_t GattServer::reset(ble::GattServer* server) serviceCount = 0; characteristicCount = 0; + default_services_added = false; dataSentCallChain.clear(); dataWrittenCallChain.clear();