Skip to content

Commit

Permalink
Merge pull request #7275 from jarvte/fix_sim_null_when_used
Browse files Browse the repository at this point in the history
Cellular: fixed defect where SIM interface was closed too early
  • Loading branch information
Cruz Monrreal committed Jun 22, 2018
2 parents 446de69 + da6f2d9 commit 85f66ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions features/cellular/easy_cellular/CellularConnectionFSM.cpp
Expand Up @@ -436,8 +436,6 @@ void CellularConnectionFSM::state_sim_pin()
retry_state_or_fail();
return;
}
_cellularDevice->close_sim();
_sim = NULL;
if (_plmn) {
enter_to_state(STATE_MANUAL_REGISTERING_NETWORK);
} else {
Expand Down Expand Up @@ -485,6 +483,8 @@ void CellularConnectionFSM::state_attaching()
{
_cellularDevice->set_timeout(TIMEOUT_CONNECT);
if (_network->set_attach() == NSAPI_ERROR_OK) {
_cellularDevice->close_sim();
_sim = NULL;
enter_to_state(STATE_ACTIVATING_PDP_CONTEXT);
} else {
retry_state_or_fail();
Expand Down
6 changes: 3 additions & 3 deletions features/cellular/easy_cellular/CellularConnectionFSM.h
Expand Up @@ -117,9 +117,9 @@ class CellularConnectionFSM
*/
CellularDevice *get_device();

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

0 comments on commit 85f66ca

Please sign in to comment.