Skip to content

Commit 46a56fb

Browse files
author
Seppo Takalo
authored
Merge pull request #11154 from AriParkkila/cell-shutdown-stm
Cellular API shutdown to stop state machine
2 parents 6436f11 + ed3562e commit 46a56fb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,14 +977,14 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
977977
} else if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
978978
tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED");
979979
_cb_data.error = NSAPI_ERROR_NO_CONNECTION;
980+
_is_connected = false;
980981
}
981982
}
982983
#else
983-
#if MBED_CONF_MBED_TRACE_ENABLE
984984
if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
985985
tr_info("cb: CellularContext disconnected");
986+
_is_connected = false;
986987
}
987-
#endif // MBED_CONF_MBED_TRACE_ENABLE
988988
#endif // NSAPI_PPP_AVAILABLE
989989
// forward status change events to application, call_network_cb will make sure that only changed event are forwarded
990990
call_network_cb((nsapi_connection_status_t)ptr);

features/cellular/framework/AT/AT_CellularDevice.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,6 @@ nsapi_error_t AT_CellularDevice::init()
437437

438438
nsapi_error_t AT_CellularDevice::shutdown()
439439
{
440-
if (_state_machine) {
441-
_state_machine->reset();
442-
}
443440
CellularDevice::shutdown();
444441

445442
return _at->at_cmd_discard("+CFUN", "=0");

features/cellular/framework/device/CellularDevice.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ void CellularDevice::cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularC
229229

230230
nsapi_error_t CellularDevice::shutdown()
231231
{
232+
if (_state_machine) {
233+
_state_machine->stop();
234+
}
232235
CellularContext *curr = get_context_list();
233236
while (curr) {
234237
curr->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);

0 commit comments

Comments
 (0)