Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SIM lock #632

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/TinyGsmGPRS.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class TinyGsmGPRS {
// Unlocks the SIM
bool simUnlock(const char* pin) {
return thisModem().simUnlockImpl(pin);
}
bool simLock(const char* pin) {
return thisModem().simLockImpl(pin);
}
// Gets the CCID of a sim card via AT+CCID
String getSimCCID() {
Expand Down Expand Up @@ -88,7 +91,16 @@ class TinyGsmGPRS {
}
return true;
}


// Locks a sim via AT+CLCK
bool simLockImpl(const char* pin) {
if (pin && strlen(pin) > 0) {
thisModem().sendAT(GF("+CLCK=\"SC\",1,\""), pin, GF("\""));
return thisModem().waitResponse() == 1;
}
return true;
}

// Gets the CCID of a sim card via AT+CCID
String getSimCCIDImpl() {
thisModem().sendAT(GF("+CCID"));
Expand Down