Skip to content

Commit 85f66ca

Browse files
author
Cruz Monrreal
authored
Merge pull request #7275 from jarvte/fix_sim_null_when_used
Cellular: fixed defect where SIM interface was closed too early
2 parents 446de69 + da6f2d9 commit 85f66ca

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 returns NULL, and any instances fetched using this method are invalid.
122+
* SIM interface can be created again using 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)