Reorder some functions
This commit is contained in:
@@ -189,19 +189,6 @@ class TinyGsmA6
|
|||||||
|
|
||||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+CCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+SCID: SIM Card ID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -216,6 +203,22 @@ class TinyGsmA6
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+CIFSR"));
|
||||||
|
String res;
|
||||||
|
if (waitResponse(10000L, res) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
res.replace(GSM_NL "OK" GSM_NL, "");
|
||||||
|
res.replace(GSM_NL, "");
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -272,15 +275,16 @@ class TinyGsmA6
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
String getSimCCIDImpl() {
|
||||||
sendAT(GF("+CIFSR"));
|
sendAT(GF("+CCID"));
|
||||||
String res;
|
if (waitResponse(GF(GSM_NL "+SCID: SIM Card ID:")) != 1) {
|
||||||
if (waitResponse(10000L, res) != 1) { return ""; }
|
return "";
|
||||||
res.replace(GSM_NL "OK" GSM_NL, "");
|
}
|
||||||
res.replace(GSM_NL, "");
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
res.trim();
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -208,19 +208,6 @@ class TinyGsmBG96
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+QCCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+QCCID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -235,6 +222,12 @@ class TinyGsmBG96
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
// Can follow all of the IP functions from the template
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -267,10 +260,19 @@ class TinyGsmBG96
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
// Can follow all of the IP functions from the template
|
String getSimCCIDImpl() {
|
||||||
|
sendAT(GF("+QCCID"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+QCCID:")) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
|
@@ -257,6 +257,21 @@ class TinyGsmESP8266
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+CIPSTA_CUR?"));
|
||||||
|
int res1 = waitResponse(GF("ERROR"), GF("+CWJAP_CUR:"));
|
||||||
|
if (res1 != 2) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String res2 = stream.readStringUntil('"');
|
||||||
|
waitResponse();
|
||||||
|
return res2;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WiFi functions
|
* WiFi functions
|
||||||
*/
|
*/
|
||||||
@@ -277,19 +292,6 @@ class TinyGsmESP8266
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* IP Address functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getLocalIPImpl() {
|
|
||||||
sendAT(GF("+CIPSTA_CUR?"));
|
|
||||||
int res1 = waitResponse(GF("ERROR"), GF("+CWJAP_CUR:"));
|
|
||||||
if (res1 != 2) { return ""; }
|
|
||||||
String res2 = stream.readStringUntil('"');
|
|
||||||
waitResponse();
|
|
||||||
return res2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
*/
|
*/
|
||||||
|
@@ -190,12 +190,6 @@ class TinyGsmM590
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// Able to follow all SIM card functions as inherited from the template
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -210,6 +204,22 @@ class TinyGsmM590
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+XIIC?"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+XIIC:")) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
streamSkipUntil(',');
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -267,18 +277,10 @@ class TinyGsmM590
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
// Able to follow all SIM card functions as inherited from the template
|
||||||
sendAT(GF("+XIIC?"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+XIIC:")) != 1) { return ""; }
|
|
||||||
streamSkipUntil(',');
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
|
@@ -217,19 +217,6 @@ class TinyGsmM95
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+QCCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+QCCID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -254,6 +241,18 @@ class TinyGsmM95
|
|||||||
waitResponse();
|
waitResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+QILOCIP"));
|
||||||
|
streamSkipUntil('\n');
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -334,13 +333,16 @@ class TinyGsmM95
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
String getSimCCIDImpl() {
|
||||||
sendAT(GF("+QILOCIP"));
|
sendAT(GF("+QCCID"));
|
||||||
streamSkipUntil('\n');
|
if (waitResponse(GF(GSM_NL "+QCCID:")) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
String res = stream.readStringUntil('\n');
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
res.trim();
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -226,33 +226,6 @@ class TinyGsmMC60
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
SimStatus getSimStatusImpl(uint32_t timeout_ms = 10000L) {
|
|
||||||
for (uint32_t start = millis(); millis() - start < timeout_ms;) {
|
|
||||||
sendAT(GF("+CPIN?"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
|
|
||||||
delay(1000);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int status = waitResponse(GF("READY"), GF("SIM PIN"), GF("SIM PUK"),
|
|
||||||
GF("NOT INSERTED"), GF("PH_SIM PIN"),
|
|
||||||
GF("PH_SIM PUK"));
|
|
||||||
waitResponse();
|
|
||||||
switch (status) {
|
|
||||||
case 2:
|
|
||||||
case 3: return SIM_LOCKED;
|
|
||||||
case 5:
|
|
||||||
case 6: return SIM_ANTITHEFT_LOCKED;
|
|
||||||
case 1: return SIM_READY;
|
|
||||||
default: return SIM_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return SIM_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -267,6 +240,18 @@ class TinyGsmMC60
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+QILOCIP"));
|
||||||
|
streamSkipUntil('\n');
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -326,15 +311,34 @@ class TinyGsmMC60
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
SimStatus getSimStatusImpl(uint32_t timeout_ms = 10000L) {
|
||||||
sendAT(GF("+QILOCIP"));
|
for (uint32_t start = millis(); millis() - start < timeout_ms;) {
|
||||||
streamSkipUntil('\n');
|
sendAT(GF("+CPIN?"));
|
||||||
String res = stream.readStringUntil('\n');
|
if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
|
||||||
res.trim();
|
delay(1000);
|
||||||
return res;
|
continue;
|
||||||
|
}
|
||||||
|
int status =
|
||||||
|
waitResponse(GF("READY"), GF("SIM PIN"), GF("SIM PUK"),
|
||||||
|
GF("NOT INSERTED"), GF("PH_SIM PIN"), GF("PH_SIM PUK"));
|
||||||
|
waitResponse();
|
||||||
|
switch (status) {
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
return SIM_LOCKED;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
return SIM_ANTITHEFT_LOCKED;
|
||||||
|
case 1:
|
||||||
|
return SIM_READY;
|
||||||
|
default:
|
||||||
|
return SIM_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SIM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -227,20 +227,6 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// Gets the CCID of a sim card via AT+CCID
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+CICCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -272,6 +258,23 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+IPADDR")); // Inquire Socket PDP address
|
||||||
|
// sendAT(GF("+CGPADDR=1")); // Show PDP address
|
||||||
|
String res;
|
||||||
|
if (waitResponse(10000L, res) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
res.replace(GSM_NL "OK" GSM_NL, "");
|
||||||
|
res.replace(GSM_NL, "");
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -386,16 +389,17 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
// Gets the CCID of a sim card via AT+CCID
|
||||||
sendAT(GF("+IPADDR")); // Inquire Socket PDP address
|
String getSimCCIDImpl() {
|
||||||
// sendAT(GF("+CGPADDR=1")); // Show PDP address
|
sendAT(GF("+CICCID"));
|
||||||
String res;
|
if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) {
|
||||||
if (waitResponse(10000L, res) != 1) { return ""; }
|
return "";
|
||||||
res.replace(GSM_NL "OK" GSM_NL, "");
|
}
|
||||||
res.replace(GSM_NL, "");
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
res.trim();
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -226,12 +226,6 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000, READ_AND_CHECK_SIZE,
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// Able to follow all SIM card functions as inherited from the template
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -279,6 +273,22 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000, READ_AND_CHECK_SIZE,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+CIFSR;E0"));
|
||||||
|
String res;
|
||||||
|
if (waitResponse(10000L, res) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
res.replace(GSM_NL "OK" GSM_NL, "");
|
||||||
|
res.replace(GSM_NL, "");
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -365,18 +375,10 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000, READ_AND_CHECK_SIZE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
// Able to follow all SIM card functions as inherited from the template
|
||||||
sendAT(GF("+CIFSR;E0"));
|
|
||||||
String res;
|
|
||||||
if (waitResponse(10000L, res) != 1) { return ""; }
|
|
||||||
res.replace(GSM_NL "OK" GSM_NL, "");
|
|
||||||
res.replace(GSM_NL, "");
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
|
@@ -203,20 +203,6 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE,
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// Gets the CCID of a sim card via AT+CCID
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+CICCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -248,6 +234,23 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+IPADDR")); // Inquire Socket PDP address
|
||||||
|
// sendAT(GF("+CGPADDR=1")); // Show PDP address
|
||||||
|
String res;
|
||||||
|
if (waitResponse(10000L, res) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
res.replace(GSM_NL "OK" GSM_NL, "");
|
||||||
|
res.replace(GSM_NL, "");
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -339,16 +342,17 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
// Gets the CCID of a sim card via AT+CCID
|
||||||
sendAT(GF("+IPADDR")); // Inquire Socket PDP address
|
String getSimCCIDImpl() {
|
||||||
// sendAT(GF("+CGPADDR=1")); // Show PDP address
|
sendAT(GF("+CICCID"));
|
||||||
String res;
|
if (waitResponse(GF(GSM_NL "+ICCID:")) != 1) {
|
||||||
if (waitResponse(10000L, res) != 1) { return ""; }
|
return "";
|
||||||
res.replace(GSM_NL "OK" GSM_NL, "");
|
}
|
||||||
res.replace(GSM_NL, "");
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
res.trim();
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -254,12 +254,6 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800, READ_AND_CHECK_SIZE,
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// Able to follow all SIM card functions as inherited from the template
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -274,6 +268,22 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800, READ_AND_CHECK_SIZE,
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+CIFSR;E0"));
|
||||||
|
String res;
|
||||||
|
if (waitResponse(10000L, res) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
res.replace(GSM_NL "OK" GSM_NL, "");
|
||||||
|
res.replace(GSM_NL, "");
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -364,18 +374,10 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800, READ_AND_CHECK_SIZE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
// Able to follow all SIM card functions as inherited from the template
|
||||||
sendAT(GF("+CIFSR;E0"));
|
|
||||||
String res;
|
|
||||||
if (waitResponse(10000L, res) != 1) { return ""; }
|
|
||||||
res.replace(GSM_NL "OK" GSM_NL, "");
|
|
||||||
res.replace(GSM_NL, "");
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
|
@@ -281,20 +281,6 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4, READ_AND_CHECK_SIZE,
|
|||||||
|
|
||||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
// This uses "CGSN" instead of "GSN"
|
|
||||||
String getIMEIImpl() {
|
|
||||||
sendAT(GF("+CGSN"));
|
|
||||||
if (waitResponse(GF(GSM_NL)) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -341,6 +327,12 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4, READ_AND_CHECK_SIZE,
|
|||||||
return restart();
|
return restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
// Can follow the template in all function
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -393,10 +385,20 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4, READ_AND_CHECK_SIZE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
// Can follow the template in all function
|
// This uses "CGSN" instead of "GSN"
|
||||||
|
String getIMEIImpl() {
|
||||||
|
sendAT(GF("+CGSN"));
|
||||||
|
if (waitResponse(GF(GSM_NL)) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
|
res.trim();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
|
@@ -274,19 +274,6 @@ class TinyGsmSequansMonarch
|
|||||||
return waitResponse() == 1;
|
return waitResponse() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
sendAT(GF("+SQNCCID"));
|
|
||||||
if (waitResponse(GF(GSM_NL "+SQNCCID:")) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -301,6 +288,20 @@ class TinyGsmSequansMonarch
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+CGPADDR=3"));
|
||||||
|
if (waitResponse(10000L, GF("+CGPADDR: 3,\"")) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String res = stream.readStringUntil('\"');
|
||||||
|
waitResponse();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -338,14 +339,17 @@ class TinyGsmSequansMonarch
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
String getSimCCIDImpl() {
|
||||||
sendAT(GF("+CGPADDR=3"));
|
sendAT(GF("+SQNCCID"));
|
||||||
if (waitResponse(10000L, GF("+CGPADDR: 3,\"")) != 1) { return ""; }
|
if (waitResponse(GF(GSM_NL "+SQNCCID:")) != 1) {
|
||||||
String res = stream.readStringUntil('\"');
|
return "";
|
||||||
|
}
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
waitResponse();
|
waitResponse();
|
||||||
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -243,19 +243,6 @@ class TinyGsmUBLOX
|
|||||||
|
|
||||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
String getIMEIImpl() {
|
|
||||||
sendAT(GF("+CGSN"));
|
|
||||||
if (waitResponse(GF(GSM_NL)) != 1) { return ""; }
|
|
||||||
String res = stream.readStringUntil('\n');
|
|
||||||
waitResponse();
|
|
||||||
res.trim();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -275,6 +262,24 @@ class TinyGsmUBLOX
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
sendAT(GF("+UPSND=0,0"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+UPSND:")) != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
streamSkipUntil(','); // Skip PSD profile
|
||||||
|
streamSkipUntil('\"'); // Skip request type
|
||||||
|
String res = stream.readStringUntil('\"');
|
||||||
|
if (waitResponse() != 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -360,16 +365,17 @@ class TinyGsmUBLOX
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
String getIMEIImpl() {
|
||||||
sendAT(GF("+UPSND=0,0"));
|
sendAT(GF("+CGSN"));
|
||||||
if (waitResponse(GF(GSM_NL "+UPSND:")) != 1) { return ""; }
|
if (waitResponse(GF(GSM_NL)) != 1) {
|
||||||
streamSkipUntil(','); // Skip PSD profile
|
return "";
|
||||||
streamSkipUntil('\"'); // Skip request type
|
}
|
||||||
String res = stream.readStringUntil('\"');
|
String res = stream.readStringUntil('\n');
|
||||||
if (waitResponse() != 1) { return ""; }
|
waitResponse();
|
||||||
|
res.trim();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -542,29 +542,6 @@ class TinyGsmXBee
|
|||||||
|
|
||||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
/*
|
|
||||||
* SIM card functions
|
|
||||||
*/
|
|
||||||
protected:
|
|
||||||
bool simUnlockImpl(const char* pin) { // Not supported
|
|
||||||
if (pin && strlen(pin) > 0) {
|
|
||||||
DBG("XBee's do not support SIMs that require an unlock pin!");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getSimCCIDImpl() {
|
|
||||||
return sendATGetString(GF("S#"));
|
|
||||||
}
|
|
||||||
|
|
||||||
String getIMEIImpl() {
|
|
||||||
return sendATGetString(GF("IM"));
|
|
||||||
}
|
|
||||||
|
|
||||||
SimStatus getSimStatusImpl(uint32_t) {
|
|
||||||
return SIM_READY; // unsupported
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic network functions
|
* Generic network functions
|
||||||
*/
|
*/
|
||||||
@@ -715,6 +692,22 @@ class TinyGsmXBee
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
protected:
|
||||||
|
String getLocalIPImpl() {
|
||||||
|
XBEE_COMMAND_START_DECORATOR(5, "")
|
||||||
|
sendAT(GF("MY"));
|
||||||
|
String IPaddr;
|
||||||
|
IPaddr.reserve(16);
|
||||||
|
// wait for the response - this response can be very slow
|
||||||
|
IPaddr = readResponseString(30000);
|
||||||
|
XBEE_COMMAND_END_DECORATOR
|
||||||
|
IPaddr.trim();
|
||||||
|
return IPaddr;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WiFi functions
|
* WiFi functions
|
||||||
*/
|
*/
|
||||||
@@ -795,24 +788,25 @@ class TinyGsmXBee
|
|||||||
return isNetworkConnected();
|
return isNetworkConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
String getOperatorImpl() {
|
String getOperatorImpl() { return sendATGetString(GF("MN")); }
|
||||||
return sendATGetString(GF("MN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IP Address functions
|
* SIM card functions
|
||||||
*/
|
*/
|
||||||
protected:
|
protected:
|
||||||
String getLocalIPImpl() {
|
bool simUnlockImpl(const char* pin) { // Not supported
|
||||||
XBEE_COMMAND_START_DECORATOR(5, "")
|
if (pin && strlen(pin) > 0) {
|
||||||
sendAT(GF("MY"));
|
DBG("XBee's do not support SIMs that require an unlock pin!");
|
||||||
String IPaddr;
|
}
|
||||||
IPaddr.reserve(16);
|
return false;
|
||||||
// wait for the response - this response can be very slow
|
}
|
||||||
IPaddr = readResponseString(30000);
|
|
||||||
XBEE_COMMAND_END_DECORATOR
|
String getSimCCIDImpl() { return sendATGetString(GF("S#")); }
|
||||||
IPaddr.trim();
|
|
||||||
return IPaddr;
|
String getIMEIImpl() { return sendATGetString(GF("IM")); }
|
||||||
|
|
||||||
|
SimStatus getSimStatusImpl(uint32_t) {
|
||||||
|
return SIM_READY; // unsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user