Skip to content

Commit 11a34ec

Browse files
authored
Merge pull request #11521 from u-blox/clear_after_sim_pin
Bux fix: Context can be cleared using CGDCONT after sim ready state
2 parents 4c9282f + 828fffb commit 11a34ec

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

features/cellular/framework/device/CellularStateMachine.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ bool CellularStateMachine::open_sim()
165165
bool sim_ready = state == CellularDevice::SimStateReady;
166166

167167
if (sim_ready) {
168+
#ifdef MBED_CONF_CELLULAR_CLEAR_ON_CONNECT
169+
if (_cellularDevice.clear() != NSAPI_ERROR_OK) {
170+
tr_warning("CellularDevice clear failed");
171+
return false;
172+
}
173+
#endif
168174
_cb_data.error = _network.set_registration(_plmn);
169175
tr_debug("STM: set_registration: %d, plmn: %s", _cb_data.error, _plmn ? _plmn : "NULL");
170176
if (_cb_data.error) {
@@ -345,13 +351,6 @@ bool CellularStateMachine::device_ready()
345351
}
346352
#endif // MBED_CONF_CELLULAR_DEBUG_AT
347353

348-
#ifdef MBED_CONF_CELLULAR_CLEAR_ON_CONNECT
349-
if (_cellularDevice.clear() != NSAPI_ERROR_OK) {
350-
tr_warning("CellularDevice clear failed");
351-
return false;
352-
}
353-
#endif
354-
355354
send_event_cb(CellularDeviceReady);
356355
_cellularDevice.set_ready_cb(0);
357356

@@ -410,7 +409,6 @@ void CellularStateMachine::state_sim_pin()
410409
retry_state_or_fail();
411410
return;
412411
}
413-
414412
if (_network.is_active_context()) { // check if context was already activated
415413
tr_debug("Active context found.");
416414
_status |= ACTIVE_PDP_CONTEXT;

0 commit comments

Comments
 (0)