Unified interface a bit more

This commit is contained in:
SRGDamia1
2017-04-09 12:04:01 -04:00
parent 0a5baf7e2a
commit 282d89119b
5 changed files with 69 additions and 27 deletions

View File

@@ -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);
}