mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
Make sure that modemRead is properly maintaining sock_available
This commit is contained in:
@@ -71,6 +71,8 @@ public:
|
||||
got_data = false;
|
||||
|
||||
at->sockets[mux] = this;
|
||||
// ^^ TODO: attach the socket here at init? Or later at connect?
|
||||
// Currently done inconsistently between modems
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -81,6 +83,10 @@ public:
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux);
|
||||
// sock_connected = at->modemConnect(host, port, &mux);
|
||||
// at->sockets[mux] = this;
|
||||
// ^^ TODO: attach the socet after attempting connection or above at init?
|
||||
// Currently done inconsistently between modems
|
||||
return sock_connected;
|
||||
}
|
||||
|
||||
@@ -106,7 +112,7 @@ public:
|
||||
rx.clear();
|
||||
at->maintain();
|
||||
while (sock_available > 0) {
|
||||
sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
|
||||
at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
|
||||
rx.clear();
|
||||
at->maintain();
|
||||
}
|
||||
@@ -228,6 +234,9 @@ public:
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux, true);
|
||||
// sock_connected = at->modemConnect(host, port, &mux, true);
|
||||
// at->sockets[mux] = this;
|
||||
// TODO: When is the socket attached?
|
||||
return sock_connected;
|
||||
}
|
||||
};
|
||||
@@ -421,6 +430,7 @@ public:
|
||||
|
||||
RegStatus getRegistrationStatus() {
|
||||
sendAT(GF("+CGREG?"));
|
||||
// TODO: Shouldn't this be CEREG for the EPS status of this 4G module?
|
||||
if (waitResponse(GF(GSM_NL "+CGREG:")) != 1) {
|
||||
return REG_UNKNOWN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user