Skip to content

Accept string parameters for connect() #3

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

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/ArdunioCellular.cpp → src/ArduinoCellular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ void ArduinoCellular::begin() {

}

bool ArduinoCellular::connect(const char * apn, const char * gprsUser, const char * gprsPass, const char * pin){
bool ArduinoCellular::connect(String apn, String gprsUser, String gprsPass, String pin){
SimStatus simStatus = getSimStatus();
if(simStatus == SimStatus::SIM_LOCKED) {
unlockSIM(pin);
unlockSIM(pin.c_str());
}

simStatus = getSimStatus();
if(simStatus == SimStatus::SIM_READY) {
if(awaitNetworkRegistration()){
if(connectToGPRS(apn, gprsUser, gprsPass)){
if(connectToGPRS(apn.c_str(), gprsUser.c_str(), gprsPass.c_str())){
Serial.println("Setting DNS...");
Serial.println(this->sendATCommand("+QIDNSCFG=1,\"8.8.8.8\",\"8.8.4.4\""));
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/ArduinoCellular.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ArduinoCellular {
* @param pin The SIM card PIN.
* @return True if the connection is successful, false otherwise.
*/
bool connect(const char * apn, const char * gprsUser, const char * gprsPass, const char * pin);
bool connect(String apn, String gprsUser, String gprsPass, String pin);

/**
* @brief Checks if the modem is registered on the network.
Expand Down
Loading