Skip to content

Commit 0caef1b

Browse files
author
Teemu Kultala
committed
cellular: trace errors only if tracing enabled
1 parent c597d84 commit 0caef1b

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

features/cellular/framework/API/CellularSIM.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ class CellularSIM
4646
SimStateReady = 0,
4747
SimStatePinNeeded,
4848
SimStatePukNeeded,
49-
SimStateUnknown,
50-
SimStateNotChecked
49+
SimStateUnknown
5150
};
5251

5352
/** Open the SIM card by setting the pin code for SIM.

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
9898
int lac = -1, cell_id = -1, act = -1;
9999

100100
read_reg_params(type, reg_status, lac, cell_id, act);
101-
101+
102+
#if MBED_CONF_MBED_TRACE_ENABLE
102103
switch (reg_status) {
103104
case NotRegistered:
104105
tr_error("not registered");
@@ -112,6 +113,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
112113
default:
113114
break;
114115
}
116+
#endif
115117

116118
if (_at.get_last_error() == NSAPI_ERROR_OK && _connection_status_cb) {
117119
tr_debug("stat: %d, lac: %d, cellID: %d, act: %d", reg_status, lac, cell_id, act);

features/cellular/framework/AT/AT_CellularSIM.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace mbed;
2222

2323
const int MAX_SIM_RESPONSE_LENGTH = 16;
2424

25-
AT_CellularSIM::AT_CellularSIM(ATHandler &at) : AT_CellularBase(at), _state(SimStateNotChecked)
25+
AT_CellularSIM::AT_CellularSIM(ATHandler &at) : AT_CellularBase(at)
2626
{
2727
}
2828

@@ -56,17 +56,10 @@ nsapi_error_t AT_CellularSIM::get_sim_state(SimState &state)
5656
state = SimStateUnknown; // SIM may not be ready yet or +CPIN may be unsupported command
5757
}
5858
_at.resp_stop();
59-
_state = state;
6059
nsapi_error_t error = _at.get_last_error();
6160
_at.unlock();
62-
trace_sim_errors();
63-
return error;
64-
}
65-
66-
67-
CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void)
68-
{
69-
switch (_state) {
61+
#if MBED_CONF_MBED_TRACE_ENABLE
62+
switch (state) {
7063
case SimStatePinNeeded:
7164
tr_error("SIM PIN required");
7265
break;
@@ -76,19 +69,15 @@ CellularSIM::SimState AT_CellularSIM::trace_sim_errors(void)
7669
case SimStateUnknown:
7770
tr_error("SIM state unknown");
7871
break;
79-
case SimStateNotChecked:
80-
tr_error("SIM status has not been checked");
81-
break;
8272
default:
8373
tr_info("SIM is ready");
8474
break;
8575
}
86-
87-
return _state;
76+
#endif
77+
return error;
8878
}
8979

9080

91-
9281
nsapi_error_t AT_CellularSIM::set_pin(const char *sim_pin)
9382
{
9483
// if SIM is already in ready state then settings the PIN

features/cellular/framework/AT/AT_CellularSIM.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class AT_CellularSIM : public CellularSIM, public AT_CellularBase
4545
virtual nsapi_error_t get_sim_state(SimState &state);
4646

4747
virtual nsapi_error_t get_imsi(char* imsi);
48-
49-
virtual SimState trace_sim_errors(void);
50-
51-
private:
52-
SimState _state;
5348
};
5449

5550
} // namespace mbed

0 commit comments

Comments
 (0)