|
@ -203,6 +203,20 @@ public: |
|
|
return autoBaud(); |
|
|
return autoBaud(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* SIM card & Network Operator functions |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
int getSignalQuality() { |
|
|
|
|
|
sendAT(GF("+CWLAP=\""), _ssid, GF("\"")); |
|
|
|
|
|
String res1 = stream.readStringUntil(':'); |
|
|
|
|
|
DBG(GSM_NL, res1, ':'); |
|
|
|
|
|
String res2 = stream.readStringUntil(','); |
|
|
|
|
|
DBG(res2); |
|
|
|
|
|
waitResponse(); |
|
|
|
|
|
return res2.toInt(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool waitForNetwork(unsigned long timeout = 60000L) { |
|
|
bool waitForNetwork(unsigned long timeout = 60000L) { |
|
|
for (unsigned long start = millis(); millis() - start < timeout; ) { |
|
|
for (unsigned long start = millis(); millis() - start < timeout; ) { |
|
|
sendAT(GF("+CIPSTATUS")); |
|
|
sendAT(GF("+CIPSTATUS")); |
|
@ -224,6 +238,8 @@ public: |
|
|
*/ |
|
|
*/ |
|
|
bool networkConnect(const char* ssid, const char* pwd) { |
|
|
bool networkConnect(const char* ssid, const char* pwd) { |
|
|
|
|
|
|
|
|
|
|
|
_ssid = ssid; |
|
|
|
|
|
|
|
|
sendAT(GF("+CIPMUX=1")); |
|
|
sendAT(GF("+CIPMUX=1")); |
|
|
if (waitResponse() != 1) { |
|
|
if (waitResponse() != 1) { |
|
|
return false; |
|
|
return false; |
|
@ -418,6 +434,7 @@ private: |
|
|
private: |
|
|
private: |
|
|
Stream& stream; |
|
|
Stream& stream; |
|
|
GsmClient* sockets[5]; |
|
|
GsmClient* sockets[5]; |
|
|
|
|
|
const char* _ssid; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
typedef TinyGsm::GsmClient TinyGsmClient; |
|
|
typedef TinyGsm::GsmClient TinyGsmClient; |
|
|