Skip to content

Commit f69e330

Browse files
Ari Parkkila0xc0170
authored andcommitted
Cellular: Fix shutdown to stop statemachine
1 parent 254ff60 commit f69e330

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
@@ -1007,14 +1007,14 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
10071007
} else if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
10081008
tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED");
10091009
_cb_data.error = NSAPI_ERROR_NO_CONNECTION;
1010+
_is_connected = false;
10101011
}
10111012
}
10121013
#else
1013-
#if MBED_CONF_MBED_TRACE_ENABLE
10141014
if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_DISCONNECTED) {
10151015
tr_info("cb: CellularContext disconnected");
1016+
_is_connected = false;
10161017
}
1017-
#endif // MBED_CONF_MBED_TRACE_ENABLE
10181018
#endif // NSAPI_PPP_AVAILABLE
10191019
// forward status change events to application, call_network_cb will make sure that only changed event are forwarded
10201020
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
@@ -446,9 +446,6 @@ nsapi_error_t AT_CellularDevice::init()
446446
nsapi_error_t AT_CellularDevice::shutdown()
447447
{
448448
_at->lock();
449-
if (_state_machine) {
450-
_state_machine->reset();
451-
}
452449
CellularDevice::shutdown();
453450
_at->cmd_start("AT+CFUN=0");// set to minimum functionality
454451
_at->cmd_stop_read_resp();

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)