Cellular: Fix shutdown to stop statemachine

pull/11154/head
Ari Parkkila 2019-08-02 02:19:58 -07:00
parent 54d7d7e4c3
commit ed3562e764
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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);