Minor realignment with vshymanskyy
This commit is contained in:
@@ -372,6 +372,17 @@ public:
|
||||
return SIM_ERROR;
|
||||
}
|
||||
|
||||
RegStatus getRegistrationStatus() {
|
||||
sendAT(GF("+CREG?"));
|
||||
if (waitResponse(GF(GSM_NL "+CREG:")) != 1) {
|
||||
return REG_UNKNOWN;
|
||||
}
|
||||
streamSkipUntil(','); // Skip format (0)
|
||||
int status = stream.readStringUntil('\n').toInt();
|
||||
waitResponse();
|
||||
return (RegStatus)status;
|
||||
}
|
||||
|
||||
String getOperator() {
|
||||
sendAT(GF("+COPS?"));
|
||||
if (waitResponse(GF(GSM_NL "+COPS:")) != 1) {
|
||||
@@ -387,17 +398,6 @@ public:
|
||||
* Generic network functions
|
||||
*/
|
||||
|
||||
RegStatus getRegistrationStatus() {
|
||||
sendAT(GF("+CREG?"));
|
||||
if (waitResponse(GF(GSM_NL "+CREG:")) != 1) {
|
||||
return REG_UNKNOWN;
|
||||
}
|
||||
streamSkipUntil(','); // Skip format (0)
|
||||
int status = stream.readStringUntil('\n').toInt();
|
||||
waitResponse();
|
||||
return (RegStatus)status;
|
||||
}
|
||||
|
||||
int getSignalQuality() {
|
||||
sendAT(GF("+CSQ"));
|
||||
if (waitResponse(GF(GSM_NL "+CSQ:")) != 1) {
|
||||
@@ -432,23 +432,6 @@ public:
|
||||
waitResponse();
|
||||
}
|
||||
|
||||
String getLocalIP() {
|
||||
sendAT(GF("+CGPADDR=1"));
|
||||
if (waitResponse(10000L, GF(GSM_NL "+CGPADDR:")) != 1) {
|
||||
return "";
|
||||
}
|
||||
streamSkipUntil(',');
|
||||
String res = stream.readStringUntil('\n');
|
||||
if (waitResponse() != 1) {
|
||||
return "";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
IPAddress localIP() {
|
||||
return TinyGsmIpFromString(getLocalIP());
|
||||
}
|
||||
|
||||
/*
|
||||
* WiFi functions
|
||||
*/
|
||||
@@ -498,6 +481,23 @@ public:
|
||||
return localIP() != 0;
|
||||
}
|
||||
|
||||
String getLocalIP() {
|
||||
sendAT(GF("+CGPADDR=1"));
|
||||
if (waitResponse(10000L, GF(GSM_NL "+CGPADDR:")) != 1) {
|
||||
return "";
|
||||
}
|
||||
streamSkipUntil(',');
|
||||
String res = stream.readStringUntil('\n');
|
||||
if (waitResponse() != 1) {
|
||||
return "";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
IPAddress localIP() {
|
||||
return TinyGsmIpFromString(getLocalIP());
|
||||
}
|
||||
|
||||
/*
|
||||
* Messaging functions
|
||||
*/
|
||||
@@ -608,9 +608,9 @@ protected:
|
||||
bool modemConnect(const char* host, uint16_t port, uint8_t mux) {
|
||||
sendAT(GF("+QIOPEN="), GF("\"TCP"), GF("\",\""), host, GF("\","), port);
|
||||
int rsp = waitResponse(75000L,
|
||||
GF("CONNECT OK" GSM_NL),
|
||||
GF("CONNECT FAIL" GSM_NL),
|
||||
GF("ALREADY CONNECT" GSM_NL));
|
||||
GF("CONNECT OK" GSM_NL),
|
||||
GF("CONNECT FAIL" GSM_NL),
|
||||
GF("ALREADY CONNECT" GSM_NL));
|
||||
if ( rsp != 1 ) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user