Merge pull request #11154 from AriParkkila/cell-shutdown-stm

Cellular API shutdown to stop state machine
pull/11104/head
Seppo Takalo 2019-08-06 11:34:44 +03:00 committed by GitHub
commit 46a56fb47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -977,14 +977,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);