mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Fix shutdown to stop statemachine
parent
54d7d7e4c3
commit
ed3562e764
|
@ -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) {
|
} else if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
|
||||||
tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED");
|
tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED");
|
||||||
_cb_data.error = NSAPI_ERROR_NO_CONNECTION;
|
_cb_data.error = NSAPI_ERROR_NO_CONNECTION;
|
||||||
|
_is_connected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if MBED_CONF_MBED_TRACE_ENABLE
|
|
||||||
if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
|
if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
|
||||||
tr_info("cb: CellularContext disconnected");
|
tr_info("cb: CellularContext disconnected");
|
||||||
|
_is_connected = false;
|
||||||
}
|
}
|
||||||
#endif // MBED_CONF_MBED_TRACE_ENABLE
|
|
||||||
#endif // NSAPI_PPP_AVAILABLE
|
#endif // NSAPI_PPP_AVAILABLE
|
||||||
// forward status change events to application, call_network_cb will make sure that only changed event are forwarded
|
// 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);
|
call_network_cb((nsapi_connection_status_t)ptr);
|
||||||
|
|
|
@ -437,9 +437,6 @@ nsapi_error_t AT_CellularDevice::init()
|
||||||
|
|
||||||
nsapi_error_t AT_CellularDevice::shutdown()
|
nsapi_error_t AT_CellularDevice::shutdown()
|
||||||
{
|
{
|
||||||
if (_state_machine) {
|
|
||||||
_state_machine->reset();
|
|
||||||
}
|
|
||||||
CellularDevice::shutdown();
|
CellularDevice::shutdown();
|
||||||
|
|
||||||
return _at->at_cmd_discard("+CFUN", "=0");
|
return _at->at_cmd_discard("+CFUN", "=0");
|
||||||
|
|
|
@ -229,6 +229,9 @@ void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularC
|
||||||
|
|
||||||
nsapi_error_t CellularDevice::shutdown()
|
nsapi_error_t CellularDevice::shutdown()
|
||||||
{
|
{
|
||||||
|
if (_state_machine) {
|
||||||
|
_state_machine->stop();
|
||||||
|
}
|
||||||
CellularContext *curr = get_context_list();
|
CellularContext *curr = get_context_list();
|
||||||
while (curr) {
|
while (curr) {
|
||||||
curr->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);
|
curr->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);
|
||||||
|
|
Loading…
Reference in New Issue