-
Notifications
You must be signed in to change notification settings - Fork 4
Avoid to unlock the Sim if already unlocked #26
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
Avoid to unlock the Sim if already unlocked #26
Conversation
Memory usage change @ 4d615ac
Click for full report table
Click for full report CSV
|
return SimStatus::SIM_ANTITHEFT_LOCKED; | ||
} else { | ||
return SimStatus::SIM_ERROR; | ||
} | ||
} | ||
|
||
bool ArduinoCellular::unlockSIM(String pin){ | ||
if(this->debugStream != nullptr){ | ||
this->debugStream->println("Unlocking SIM..."); | ||
int simStatus = modem.getSimStatus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this shadowing the global simStatus
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I had an issue with visualization, everything is ok 🙂
return SimStatus::SIM_ANTITHEFT_LOCKED; | ||
} else { | ||
return SimStatus::SIM_ERROR; | ||
} | ||
} | ||
|
||
bool ArduinoCellular::unlockSIM(String pin){ | ||
if(this->debugStream != nullptr){ | ||
this->debugStream->println("Unlocking SIM..."); | ||
int simStatus = modem.getSimStatus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I had an issue with visualization, everything is ok 🙂
This PR avoid to try to unlock the SIM if the SIM is already unlocked.
If the SIM is unlocked and there is an attempt to unlock it (this happens in Arduino_ConnectionHandler in
update_handleInit()
function) the modem return an error (at least in Opta Cellular device) and this prevent the connection to the network.So it seems sensible to avoid to unlock the SIM if the SIM is READY.
Also this PR introduces a change in the function
getSimStatus()
in order to avoid to call multiple timemodem.getSimStatus()
that involves useless communication with modem.