Move down provider

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2024-05-23 12:09:07 -04:00
parent 14f0975e03
commit 93d0adbfd8
9 changed files with 66 additions and 10 deletions

View File

@@ -378,6 +378,15 @@ class TinyGsmA7672X : public TinyGsmModem<TinyGsmA7672X>,
return true;
}
String getProviderImpl() {
sendAT(GF("+CSPN?"));
if (waitResponse(GF("+CSPN:")) != 1) { return ""; }
streamSkipUntil('"'); /* Skip mode and format */
String res = stream.readStringUntil('"');
waitResponse();
return res;
}
/*
* SIM card functions
*/

View File

@@ -316,6 +316,15 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
return true;
}
String getProviderImpl() {
sendAT(GF("+QSPN?"));
if (waitResponse(GF("+QSPN:")) != 1) { return ""; }
streamSkipUntil('"'); // Skip mode and format
String res = stream.readStringUntil('"'); // read the provider
waitResponse(); // skip anything else
return res;
}
/*
* SIM card functions
*/

View File

@@ -334,6 +334,15 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
return waitResponse(60000L, GF("DEACT OK"), GF("ERROR")) == 1;
}
String getProviderImpl() {
sendAT(GF("+QSPN?"));
if (waitResponse(GF("+QSPN:")) != 1) { return ""; }
streamSkipUntil('"'); // Skip mode and format
String res = stream.readStringUntil('"'); // read the provider
waitResponse(); // skip anything else
return res;
}
/*
* SIM card functions
*/

View File

@@ -307,6 +307,15 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
return waitResponse(60000L, GF("DEACT OK"), GF("ERROR")) == 1;
}
String getProviderImpl() {
sendAT(GF("+QSPN?"));
if (waitResponse(GF("+QSPN:")) != 1) { return ""; }
streamSkipUntil('"'); // Skip mode and format
String res = stream.readStringUntil('"'); // read the provider
waitResponse(); // skip anything else
return res;
}
/*
* SIM card functions
*/

View File

@@ -400,6 +400,15 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
return true;
}
String getProviderImpl() {
sendAT(GF("+CSPN?"));
if (waitResponse(GF("+CSPN:")) != 1) { return ""; }
streamSkipUntil('"'); /* Skip mode and format */
String res = stream.readStringUntil('"');
waitResponse();
return res;
}
/*
* SIM card functions
*/

View File

@@ -389,6 +389,15 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
return true;
}
String getProviderImpl() {
sendAT(GF("+CSPN?"));
if (waitResponse(GF("+CSPN:")) != 1) { return ""; }
streamSkipUntil('"'); /* Skip mode and format */
String res = stream.readStringUntil('"');
waitResponse();
return res;
}
/*
* SIM card functions
*/

View File

@@ -397,6 +397,15 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
return true;
}
String getProviderImpl() {
sendAT(GF("+CSPN?"));
if (waitResponse(GF("+CSPN:")) != 1) { return ""; }
streamSkipUntil('"'); /* Skip mode and format */
String res = stream.readStringUntil('"');
waitResponse();
return res;
}
/*
* SIM card functions
*/

View File

@@ -184,14 +184,7 @@ class TinyGsmGPRS {
return res;
}
String getProviderImpl() {
thisModem().sendAT(GF("+CSPN?"));
if (thisModem().waitResponse(GF("+CSPN:")) != 1) { return ""; }
thisModem().streamSkipUntil('"'); /* Skip mode and format */
String res = thisModem().stream.readStringUntil('"');
thisModem().waitResponse();
return res;
}
String getProviderImpl() TINY_GSM_ATTR_NOT_IMPLEMENTED;
};
#endif // SRC_TINYGSMGPRS_H_