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,
|
SimStateReady = 0,
|
||||||
SimStatePinNeeded,
|
SimStatePinNeeded,
|
||||||
SimStatePukNeeded,
|
SimStatePukNeeded,
|
||||||
SimStateUnknown,
|
SimStateUnknown
|
||||||
SimStateNotChecked
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Open the SIM card by setting the pin code for SIM.
|
/** Open the SIM card by setting the pin code for SIM.
|
||||||
|
|
|
@ -99,6 +99,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
|
||||||
|
|
||||||
read_reg_params(type, reg_status, lac, cell_id, act);
|
read_reg_params(type, reg_status, lac, cell_id, act);
|
||||||
|
|
||||||
|
#if MBED_CONF_MBED_TRACE_ENABLE
|
||||||
switch (reg_status) {
|
switch (reg_status) {
|
||||||
case NotRegistered:
|
case NotRegistered:
|
||||||
tr_error("not registered");
|
tr_error("not registered");
|
||||||
|
@ -112,6 +113,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_at.get_last_error() == NSAPI_ERROR_OK && _connection_status_cb) {
|
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);
|
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;
|
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
|
state = SimStateUnknown; // SIM may not be ready yet or +CPIN may be unsupported command
|
||||||
}
|
}
|
||||||
_at.resp_stop();
|
_at.resp_stop();
|
||||||
_state = state;
|
|
||||||
nsapi_error_t error = _at.get_last_error();
|
nsapi_error_t error = _at.get_last_error();
|
||||||
_at.unlock();
|
_at.unlock();
|
||||||
trace_sim_errors();
|
#if MBED_CONF_MBED_TRACE_ENABLE
|
||||||
return error;
|
switch (state) {
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void)
|
|
||||||
{
|
|
||||||
switch (_state) {
|
|
||||||
case SimStatePinNeeded:
|
case SimStatePinNeeded:
|
||||||
tr_error("SIM PIN required");
|
tr_error("SIM PIN required");
|
||||||
break;
|
break;
|
||||||
|
@ -76,19 +69,15 @@ CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void)
|
||||||
case SimStateUnknown:
|
case SimStateUnknown:
|
||||||
tr_error("SIM state unknown");
|
tr_error("SIM state unknown");
|
||||||
break;
|
break;
|
||||||
case SimStateNotChecked:
|
|
||||||
tr_error("SIM status has not been checked");
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
tr_info("SIM is ready");
|
tr_info("SIM is ready");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return _state;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nsapi_error_t AT_CellularSIM::set_pin(const char *sim_pin)
|
nsapi_error_t AT_CellularSIM::set_pin(const char *sim_pin)
|
||||||
{
|
{
|
||||||
// if SIM is already in ready state then settings the 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_sim_state(SimState &state);
|
||||||
|
|
||||||
virtual nsapi_error_t get_imsi(char* imsi);
|
virtual nsapi_error_t get_imsi(char* imsi);
|
||||||
|
|
||||||
virtual SimState trace_sim_errors(void);
|
|
||||||
|
|
||||||
private:
|
|
||||||
SimState _state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
Loading…
Reference in New Issue