|
|
@ -39,6 +39,11 @@ enum RegStatus { |
|
|
|
REG_UNKNOWN = 4, |
|
|
|
}; |
|
|
|
|
|
|
|
enum DateTime { |
|
|
|
DATE_FULL = 0, |
|
|
|
DATE_TIME = 1, |
|
|
|
DATE_DATE = 2 |
|
|
|
}; |
|
|
|
|
|
|
|
class TinyGsmSim800 |
|
|
|
{ |
|
|
@ -307,6 +312,13 @@ public: |
|
|
|
if (!testAT()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
//Enable Local Time Stamp for getting network time |
|
|
|
sendAT(GF("+CLTS=1")); |
|
|
|
if (waitResponse(10000L) != 1) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
sendAT(GF("&W")); |
|
|
|
waitResponse(); |
|
|
|
sendAT(GF("+CFUN=0")); |
|
|
|
if (waitResponse(10000L) != 1) { |
|
|
|
return false; |
|
|
@ -719,6 +731,32 @@ public: |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Time functions |
|
|
|
*/ |
|
|
|
String getGSMDateTime(DateTime format) { |
|
|
|
sendAT(GF("+CCLK?")); |
|
|
|
if (waitResponse(2000L, GF(GSM_NL "+CCLK: \"")) != 1) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
|
String res; |
|
|
|
|
|
|
|
switch(format) { |
|
|
|
case DATE_FULL: |
|
|
|
res = stream.readStringUntil('"'); |
|
|
|
break; |
|
|
|
case DATE_TIME: |
|
|
|
streamSkipUntil(','); |
|
|
|
res = stream.readStringUntil('"'); |
|
|
|
break; |
|
|
|
case DATE_DATE: |
|
|
|
res = stream.readStringUntil(','); |
|
|
|
break; |
|
|
|
} |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Battery functions |
|
|
|
*/ |
|
|
|