Merge pull request #11521 from u-blox/clear_after_sim_pin

Bux fix: Context can be cleared using CGDCONT after sim ready state
pull/11534/head
Martin Kojtal 2019-09-19 17:15:55 +02:00 committed by GitHub
commit 11a34ec092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -165,6 +165,12 @@ bool CellularStateMachine::open_sim()
bool sim_ready = state == CellularDevice::SimStateReady; bool sim_ready = state == CellularDevice::SimStateReady;
if (sim_ready) { if (sim_ready) {
#ifdef MBED_CONF_CELLULAR_CLEAR_ON_CONNECT
if (_cellularDevice.clear() != NSAPI_ERROR_OK) {
tr_warning("CellularDevice clear failed");
return false;
}
#endif
_cb_data.error = _network.set_registration(_plmn); _cb_data.error = _network.set_registration(_plmn);
tr_debug("STM: set_registration: %d, plmn: %s", _cb_data.error, _plmn ? _plmn : "NULL"); tr_debug("STM: set_registration: %d, plmn: %s", _cb_data.error, _plmn ? _plmn : "NULL");
if (_cb_data.error) { if (_cb_data.error) {
@ -345,13 +351,6 @@ bool CellularStateMachine::device_ready()
} }
#endif // MBED_CONF_CELLULAR_DEBUG_AT #endif // MBED_CONF_CELLULAR_DEBUG_AT
#ifdef MBED_CONF_CELLULAR_CLEAR_ON_CONNECT
if (_cellularDevice.clear() != NSAPI_ERROR_OK) {
tr_warning("CellularDevice clear failed");
return false;
}
#endif
send_event_cb(CellularDeviceReady); send_event_cb(CellularDeviceReady);
_cellularDevice.set_ready_cb(0); _cellularDevice.set_ready_cb(0);
@ -410,7 +409,6 @@ void CellularStateMachine::state_sim_pin()
retry_state_or_fail(); retry_state_or_fail();
return; return;
} }
if (_network.is_active_context()) { // check if context was already activated if (_network.is_active_context()) { // check if context was already activated
tr_debug("Active context found."); tr_debug("Active context found.");
_status |= ACTIVE_PDP_CONTEXT; _status |= ACTIVE_PDP_CONTEXT;