mirror of https://github.com/ARMmbed/mbed-os.git
cellular: trace errors only if tracing enabled
parent
c597d8447c
commit
0caef1b8a4
|
@ -46,8 +46,7 @@ public:
|
|||
SimStateReady = 0,
|
||||
SimStatePinNeeded,
|
||||
SimStatePukNeeded,
|
||||
SimStateUnknown,
|
||||
SimStateNotChecked
|
||||
SimStateUnknown
|
||||
};
|
||||
|
||||
/** Open the SIM card by setting the pin code for SIM.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue