Skip to content

Commit c597d84

Browse files
author
Teemu Kultala
committed
cellular: sim pin setting
1 parent 7b6208c commit c597d84

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

features/cellular/easy_cellular/CellularConnectionFSM.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ bool CellularConnectionFSM::open_sim()
152152
return false;
153153
}
154154

155+
if (state == CellularSIM::SimStatePinNeeded) {
156+
if (strlen(_sim_pin)) {
157+
tr_info("SIM pin required, entering pin: %s", _sim_pin);
158+
nsapi_error_t err = _sim->set_pin(_sim_pin);
159+
if (err) {
160+
tr_error("SIM pin set failed with: %d, bailing out...", err);
161+
}
162+
} else {
163+
tr_warn("PIN required but No SIM pin provided.");
164+
}
165+
}
166+
155167
if (_event_status_cb) {
156168
_event_status_cb((nsapi_event_t)CellularSIMStatusChanged, state);
157169
}

0 commit comments

Comments
 (0)