diff --git a/features/cellular/framework/API/CellularSIM.h b/features/cellular/framework/API/CellularSIM.h index 16d96e0239..8a15218802 100644 --- a/features/cellular/framework/API/CellularSIM.h +++ b/features/cellular/framework/API/CellularSIM.h @@ -46,8 +46,7 @@ public: SimStateReady = 0, SimStatePinNeeded, SimStatePukNeeded, - SimStateUnknown, - SimStateNotChecked + SimStateUnknown }; /** Open the SIM card by setting the pin code for SIM. diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index d00610c5e5..a4e9553a86 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -98,7 +98,8 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type) int lac = -1, cell_id = -1, act = -1; read_reg_params(type, reg_status, lac, cell_id, act); - + +#if MBED_CONF_MBED_TRACE_ENABLE switch (reg_status) { case NotRegistered: tr_error("not registered"); @@ -112,6 +113,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type) default: break; } +#endif if (_at.get_last_error() == NSAPI_ERROR_OK && _connection_status_cb) { tr_debug("stat: %d, lac: %d, cellID: %d, act: %d", reg_status, lac, cell_id, act); diff --git a/features/cellular/framework/AT/AT_CellularSIM.cpp b/features/cellular/framework/AT/AT_CellularSIM.cpp index 0ce2334366..315816bec0 100644 --- a/features/cellular/framework/AT/AT_CellularSIM.cpp +++ b/features/cellular/framework/AT/AT_CellularSIM.cpp @@ -22,7 +22,7 @@ using namespace mbed; const int MAX_SIM_RESPONSE_LENGTH = 16; -AT_CellularSIM::AT_CellularSIM(ATHandler &at) : AT_CellularBase(at), _state(SimStateNotChecked) +AT_CellularSIM::AT_CellularSIM(ATHandler &at) : AT_CellularBase(at) { } @@ -56,17 +56,10 @@ nsapi_error_t AT_CellularSIM::get_sim_state(SimState &state) state = SimStateUnknown; // SIM may not be ready yet or +CPIN may be unsupported command } _at.resp_stop(); - _state = state; nsapi_error_t error = _at.get_last_error(); _at.unlock(); - trace_sim_errors(); - return error; -} - - -CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void) -{ - switch (_state) { +#if MBED_CONF_MBED_TRACE_ENABLE + switch (state) { case SimStatePinNeeded: tr_error("SIM PIN required"); break; @@ -76,19 +69,15 @@ CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void) case SimStateUnknown: tr_error("SIM state unknown"); break; - case SimStateNotChecked: - tr_error("SIM status has not been checked"); - break; default: tr_info("SIM is ready"); break; } - - return _state; +#endif + return error; } - nsapi_error_t AT_CellularSIM::set_pin(const char *sim_pin) { // if SIM is already in ready state then settings the PIN diff --git a/features/cellular/framework/AT/AT_CellularSIM.h b/features/cellular/framework/AT/AT_CellularSIM.h index 944768be1c..be53416820 100644 --- a/features/cellular/framework/AT/AT_CellularSIM.h +++ b/features/cellular/framework/AT/AT_CellularSIM.h @@ -45,11 +45,6 @@ public: virtual nsapi_error_t get_sim_state(SimState &state); virtual nsapi_error_t get_imsi(char* imsi); - - virtual SimState trace_sim_errors(void); - -private: - SimState _state; }; } // namespace mbed