mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
Unified interface a bit more
This commit is contained in:
@@ -331,6 +331,17 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* WiFi functions
|
||||
*/
|
||||
bool networkConnect(const char* ssid, const char* pwd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool networkDisconnect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* GPRS functions
|
||||
*/
|
||||
@@ -570,21 +581,21 @@ public:
|
||||
index = 5;
|
||||
goto finish;
|
||||
} else if (data.endsWith(GF(GSM_NL "+CIPRXGET:"))) {
|
||||
index = 6;
|
||||
String mode = streamReadUntil(',');
|
||||
if (mode.toInt() == 1) {
|
||||
mux = streamReadUntil('\n').toInt();
|
||||
gotData = true;
|
||||
data = "";
|
||||
} else {
|
||||
data += mode;
|
||||
}
|
||||
} else if (data.endsWith(GF("CLOSED" GSM_NL))) {
|
||||
index = 7;
|
||||
int nl = data.lastIndexOf(GSM_NL, data.length()-8);
|
||||
int coma = data.indexOf(',', nl+2);
|
||||
mux = data.substring(nl+2, coma).toInt();
|
||||
if (mux) {
|
||||
sockets[mux]->sock_connected = false;
|
||||
data = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,7 +606,6 @@ public:
|
||||
if (data.length()) {
|
||||
DBG("### Unhandled:", data);
|
||||
}
|
||||
data = "";
|
||||
}
|
||||
else {
|
||||
data.trim();
|
||||
@@ -604,11 +614,11 @@ public:
|
||||
if (data.length()) {
|
||||
DBG(GSM_NL, "<<< ", data);
|
||||
}
|
||||
data = "";
|
||||
}
|
||||
if (gotData) {
|
||||
sockets[mux]->sock_available = modemGetAvailable(mux);
|
||||
}
|
||||
data = "";
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -674,11 +684,11 @@ private:
|
||||
buf[0] = streamRead();
|
||||
buf[1] = streamRead();
|
||||
char c = strtol(buf, NULL, 16);
|
||||
// DBG(c);
|
||||
DBG(c);
|
||||
#else
|
||||
while (!stream.available()) {}
|
||||
char c = streamRead();
|
||||
// DBG(c);
|
||||
DBG(c);
|
||||
#endif
|
||||
sockets[mux]->rx.put(c);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user