Skip to content

Commit 1a60422

Browse files
author
Teppo Järvelin
committed
Cellular: fixed defect where SIM interface was closed too early causing crash with certain configurations.
1 parent e8005f6 commit 1a60422

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

features/cellular/easy_cellular/CellularConnectionFSM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,6 @@ void CellularConnectionFSM::state_sim_pin()
436436
retry_state_or_fail();
437437
return;
438438
}
439-
_cellularDevice->close_sim();
440-
_sim = NULL;
441439
if (_plmn) {
442440
enter_to_state(STATE_MANUAL_REGISTERING_NETWORK);
443441
} else {
@@ -485,6 +483,8 @@ void CellularConnectionFSM::state_attaching()
485483
{
486484
_cellularDevice->set_timeout(TIMEOUT_CONNECT);
487485
if (_network->set_attach() == NSAPI_ERROR_OK) {
486+
_cellularDevice->close_sim();
487+
_sim = NULL;
488488
enter_to_state(STATE_ACTIVATING_PDP_CONTEXT);
489489
} else {
490490
retry_state_or_fail();

features/cellular/easy_cellular/CellularConnectionFSM.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ class CellularConnectionFSM
117117
*/
118118
CellularDevice *get_device();
119119

120-
/** Get cellular sim interface. SIM interface is released after SIM is open and ready for use (moving from STATE_SIM_PIN to next state).
121-
* After SIM interface is closed this method will return NULL. SIM interface can be created again via CellularDevice
122-
* which you can get with the method get_device().
120+
/** Get cellular sim interface. SIM interface is released when moving from STATE_ATTACHING_NETWORK to STATE_ACTIVATING_PDP_CONTEXT.
121+
* After SIM interface is closed this method will return NULL and any instances fetched via this method are invalid.
122+
* SIM interface can be created again via CellularDevice which you can get with the method get_device().
123123
* @return sim interface, NULL on failure
124124
*/
125125
CellularSIM *get_sim();

0 commit comments

Comments
 (0)