mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
@@ -438,7 +438,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
||||
if (waitResponse(2000L, GF(AT_NL ">")) != 1) { return 0; }
|
||||
stream.write(reinterpret_cast<const uint8_t*>(buff), len);
|
||||
stream.flush();
|
||||
if (waitResponse(10000L, GFP(AT_OK), GF(AT_NL "FAIL")) != 1) { return 0; }
|
||||
if (waitResponse(10000L, GFP(GSM_OK), GF(AT_NL "FAIL")) != 1) { return 0; }
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,9 +303,9 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
// attempt first without than with the 'current' flag used in some firmware
|
||||
// versions
|
||||
sendAT(GF("+CWJAP=\""), ssid, GF("\",\""), pwd, GF("\""));
|
||||
if (waitResponse(30000L, GFP(AT_OK), GF(AT_NL "FAIL" AT_NL)) != 1) {
|
||||
if (waitResponse(30000L, GFP(GSM_OK), GF(AT_NL "FAIL" AT_NL)) != 1) {
|
||||
sendAT(GF("+CWJAP_CUR=\""), ssid, GF("\",\""), pwd, GF("\""));
|
||||
if (waitResponse(30000L, GFP(AT_OK), GF(AT_NL "FAIL" AT_NL)) != 1) {
|
||||
if (waitResponse(30000L, GFP(GSM_OK), GF(AT_NL "FAIL" AT_NL)) != 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
GF("\",\""), host, GF("\","), port, GF(","),
|
||||
TINY_GSM_TCP_KEEP_ALIVE);
|
||||
// TODO(?): Check mux
|
||||
int8_t rsp = waitResponse(timeout_ms, GFP(AT_OK), GFP(GSM_ERROR),
|
||||
int8_t rsp = waitResponse(timeout_ms, GFP(GSM_OK), GFP(GSM_ERROR),
|
||||
GF("ALREADY CONNECT"));
|
||||
// if (rsp == 3) waitResponse();
|
||||
// May return "ERROR" after the "ALREADY CONNECT"
|
||||
@@ -357,7 +357,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
// after "STATUS:" it should return the status number (0,1,2,3,4,5),
|
||||
// followed by an OK
|
||||
// Hopefully we'll catch the "3" here, but fall back to the OK or Error
|
||||
int8_t status = waitResponse(GF("3"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int8_t status = waitResponse(GF("3"), GFP(GSM_OK), GFP(GSM_ERROR));
|
||||
// if the status is anything but 3, there are no connections open
|
||||
if (status != 1) {
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
@@ -367,7 +367,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
||||
}
|
||||
bool verified_connections[TINY_GSM_MUX_COUNT] = {0, 0, 0, 0, 0};
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
uint8_t has_status = waitResponse(GF("+CIPSTATUS:"), GFP(AT_OK),
|
||||
uint8_t has_status = waitResponse(GF("+CIPSTATUS:"), GFP(GSM_OK),
|
||||
GFP(GSM_ERROR));
|
||||
if (has_status == 1) {
|
||||
int8_t returned_mux = streamGetIntBefore(',');
|
||||
|
||||
@@ -455,7 +455,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
||||
sendAT(GF("+QIRD=0,1,"), mux, ',', (uint16_t)size);
|
||||
// If it replies only OK for the write command, it means there is no
|
||||
// received data in the buffer of the connection.
|
||||
int8_t res = waitResponse(GF("+QIRD:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int8_t res = waitResponse(GF("+QIRD:"), GFP(GSM_OK), GFP(GSM_ERROR));
|
||||
if (res == 1) {
|
||||
streamSkipUntil(':'); // skip IP address
|
||||
streamSkipUntil(','); // skip port
|
||||
|
||||
@@ -429,7 +429,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
sendAT(GF("+QIRD=0,1,"), mux, ',', (uint16_t)size);
|
||||
// If it replies only OK for the write command, it means there is no
|
||||
// received data in the buffer of the connection.
|
||||
int8_t res = waitResponse(GF("+QIRD:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int8_t res = waitResponse(GF("+QIRD:"), GFP(GSM_OK), GFP(GSM_ERROR));
|
||||
if (res == 1) {
|
||||
streamSkipUntil(':'); // skip IP address
|
||||
streamSkipUntil(','); // skip port
|
||||
|
||||
@@ -496,7 +496,7 @@ class TinyGsmSim7000SSL
|
||||
sendAT(GF("+CARECV?"));
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
// after the last connection, there's an ok, so we catch it right away
|
||||
int res = waitResponse(3000, GF("+CARECV:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int res = waitResponse(3000, GF("+CARECV:"), GFP(GSM_OK), GFP(GSM_ERROR));
|
||||
// if we get the +CARECV: response, read the mux number and the number of
|
||||
// characters available
|
||||
if (res == 1) {
|
||||
@@ -543,7 +543,8 @@ class TinyGsmSim7000SSL
|
||||
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
// after the last connection, there's an ok, so we catch it right away
|
||||
int res = waitResponse(3000, GF("+CASTATE:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int res = waitResponse(3000, GF("+CASTATE:"), GFP(GSM_OK),
|
||||
GFP(GSM_ERROR));
|
||||
// if we get the +CASTATE: response, read the mux number and the status
|
||||
if (res == 1) {
|
||||
int ret_mux = streamGetIntBefore(',');
|
||||
|
||||
@@ -495,7 +495,7 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
sendAT(GF("+CARECV?"));
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
// after the last connection, there's an ok, so we catch it right away
|
||||
int res = waitResponse(3000, GF("+CARECV:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int res = waitResponse(3000, GF("+CARECV:"), GFP(GSM_OK), GFP(GSM_ERROR));
|
||||
// if we get the +CARECV: response, read the mux number and the number of
|
||||
// characters available
|
||||
if (res == 1) {
|
||||
@@ -542,7 +542,8 @@ class TinyGsmSim7080 : public TinyGsmSim70xx<TinyGsmSim7080>,
|
||||
|
||||
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
// after the last connection, there's an ok, so we catch it right away
|
||||
int res = waitResponse(3000, GF("+CASTATE:"), GFP(AT_OK), GFP(GSM_ERROR));
|
||||
int res = waitResponse(3000, GF("+CASTATE:"), GFP(GSM_OK),
|
||||
GFP(GSM_ERROR));
|
||||
// if we get the +CASTATE: response, read the mux number and the status
|
||||
if (res == 1) {
|
||||
int ret_mux = streamGetIntBefore(',');
|
||||
|
||||
@@ -283,7 +283,7 @@ class TinyGsmSequansMonarch
|
||||
if (!testAT()) { return false; }
|
||||
|
||||
sendAT(GF("+CFUN=0"));
|
||||
int8_t res = waitResponse(20000L, GFP(AT_OK), GFP(GSM_ERROR),
|
||||
int8_t res = waitResponse(20000L, GFP(GSM_OK), GFP(GSM_ERROR),
|
||||
GF("+SYSSTART"));
|
||||
if (res != 1 && res != 3) { return false; }
|
||||
|
||||
@@ -481,7 +481,7 @@ class TinyGsmSequansMonarch
|
||||
// <acceptAnyRemote> = Applies to UDP only
|
||||
sendAT(GF("+SQNSD="), mux, ",0,", port, ',', GF("\""), host, GF("\""),
|
||||
",0,0,1");
|
||||
rsp = waitResponse((timeout_ms - (millis() - startMillis)), GFP(AT_OK),
|
||||
rsp = waitResponse((timeout_ms - (millis() - startMillis)), GFP(GSM_OK),
|
||||
GFP(GSM_ERROR), GF("NO CARRIER" AT_NL));
|
||||
|
||||
// creation of socket failed immediately.
|
||||
@@ -582,7 +582,7 @@ class TinyGsmSequansMonarch
|
||||
// six possible sockets.
|
||||
sendAT(GF("+SQNSS"));
|
||||
for (int muxNo = 1; muxNo <= TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
if (waitResponse(GFP(AT_OK), GF(AT_NL "+SQNSS: ")) != 2) { break; }
|
||||
if (waitResponse(GFP(GSM_OK), GF(AT_NL "+SQNSS: ")) != 2) { break; }
|
||||
uint8_t status = 0;
|
||||
// if (streamGetIntBefore(',') != muxNo) { // check the mux no
|
||||
// DBG("### Warning: misaligned mux numbers!");
|
||||
|
||||
Reference in New Issue
Block a user