diff --git a/features/cellular/framework/AT/AT_CellularContext.cpp b/features/cellular/framework/AT/AT_CellularContext.cpp index ec3b93d993..d947c1950e 100644 --- a/features/cellular/framework/AT/AT_CellularContext.cpp +++ b/features/cellular/framework/AT/AT_CellularContext.cpp @@ -984,14 +984,14 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr) } else if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) { tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED"); _cb_data.error = NSAPI_ERROR_NO_CONNECTION; + _is_connected = false; } } #else -#if MBED_CONF_MBED_TRACE_ENABLE if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) { tr_info("cb: CellularContext disconnected"); + _is_connected = false; } -#endif // MBED_CONF_MBED_TRACE_ENABLE #endif // NSAPI_PPP_AVAILABLE // forward status change events to application, call_network_cb will make sure that only changed event are forwarded call_network_cb((nsapi_connection_status_t)ptr); diff --git a/features/cellular/framework/AT/AT_CellularDevice.cpp b/features/cellular/framework/AT/AT_CellularDevice.cpp index 52cccfaae4..bd79de0583 100644 --- a/features/cellular/framework/AT/AT_CellularDevice.cpp +++ b/features/cellular/framework/AT/AT_CellularDevice.cpp @@ -437,9 +437,6 @@ nsapi_error_t AT_CellularDevice::init() nsapi_error_t AT_CellularDevice::shutdown() { - if (_state_machine) { - _state_machine->reset(); - } CellularDevice::shutdown(); return _at->at_cmd_discard("+CFUN", "=0"); diff --git a/features/cellular/framework/device/CellularDevice.cpp b/features/cellular/framework/device/CellularDevice.cpp index 8326864cdb..5115245996 100644 --- a/features/cellular/framework/device/CellularDevice.cpp +++ b/features/cellular/framework/device/CellularDevice.cpp @@ -229,6 +229,9 @@ void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularC nsapi_error_t CellularDevice::shutdown() { + if (_state_machine) { + _state_machine->stop(); + } CellularContext *curr = get_context_list(); while (curr) { curr->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);