Minor fixes
This commit is contained in:
@@ -29,8 +29,8 @@ enum SimStatus {
|
|||||||
|
|
||||||
enum RegStatus {
|
enum RegStatus {
|
||||||
REG_UNREGISTERED = 0,
|
REG_UNREGISTERED = 0,
|
||||||
REG_SEARCHING = 3,
|
REG_SEARCHING = 2,
|
||||||
REG_DENIED = 2,
|
REG_DENIED = 3,
|
||||||
REG_OK_HOME = 1,
|
REG_OK_HOME = 1,
|
||||||
REG_OK_ROAMING = 5,
|
REG_OK_ROAMING = 5,
|
||||||
REG_UNKNOWN = 4,
|
REG_UNKNOWN = 4,
|
||||||
@@ -60,8 +60,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool init(TinyGsm* modem) {
|
bool init(TinyGsm* modem) {
|
||||||
at = modem;
|
this->at = modem;
|
||||||
mux = -1;
|
this->mux = -1;
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -360,11 +360,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*sendAT(GF("+CIICR"));
|
|
||||||
if (waitResponse(60000L) != 1) {
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
sendAT(GF("+CGACT=1,1"));
|
sendAT(GF("+CGACT=1,1"));
|
||||||
waitResponse(60000L);
|
waitResponse(60000L);
|
||||||
|
|
||||||
@@ -439,20 +434,8 @@ private:
|
|||||||
return (1 == rsp);
|
return (1 == rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int modemSend2(const void* buff, size_t len, uint8_t mux) {
|
|
||||||
streamWrite(GF("AT+CIPSEND="), mux, ",", len, ",");
|
|
||||||
stream.write((uint8_t*)buff, len);
|
|
||||||
stream.print(GSM_NL);
|
|
||||||
stream.flush();
|
|
||||||
|
|
||||||
if (waitResponse(10000L, GF(GSM_NL "OK"), GF(GSM_NL "FAIL")) != 1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int modemSend(const void* buff, size_t len, uint8_t mux) {
|
int modemSend(const void* buff, size_t len, uint8_t mux) {
|
||||||
sendAT(GF("+CIPSEND="), mux, ",", len);
|
sendAT(GF("+CIPSEND="), mux, ',', len);
|
||||||
if (waitResponse(10000L, GF(GSM_NL ">")) != 1) {
|
if (waitResponse(10000L, GF(GSM_NL ">")) != 1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -464,8 +447,7 @@ private:
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool modemGetConnected(uint8_t mux) { //TODO mux?
|
||||||
bool modemGetConnected(uint8_t mux) {
|
|
||||||
sendAT(GF("+CIPSTATUS"));
|
sendAT(GF("+CIPSTATUS"));
|
||||||
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
|
int res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), GF(",\"CLOSING\""), GF(",\"INITIAL\""));
|
||||||
waitResponse();
|
waitResponse();
|
||||||
@@ -587,7 +569,7 @@ finish:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Stream& stream;
|
Stream& stream;
|
||||||
GsmClient* sockets[2];
|
GsmClient* sockets[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TinyGsm::GsmClient TinyGsmClient;
|
typedef TinyGsm::GsmClient TinyGsmClient;
|
||||||
|
@@ -565,6 +565,7 @@ private:
|
|||||||
} while (millis() - startMillis < timeout);
|
} while (millis() - startMillis < timeout);
|
||||||
finish:
|
finish:
|
||||||
if (!index) {
|
if (!index) {
|
||||||
|
data.trim();
|
||||||
if (data.length()) {
|
if (data.length()) {
|
||||||
DBG("### Unhandled:", data);
|
DBG("### Unhandled:", data);
|
||||||
}
|
}
|
||||||
|
@@ -682,6 +682,7 @@ private:
|
|||||||
} while (millis() - startMillis < timeout);
|
} while (millis() - startMillis < timeout);
|
||||||
finish:
|
finish:
|
||||||
if (!index) {
|
if (!index) {
|
||||||
|
data.trim();
|
||||||
if (data.length()) {
|
if (data.length()) {
|
||||||
DBG("### Unhandled:", data);
|
DBG("### Unhandled:", data);
|
||||||
}
|
}
|
||||||
|
@@ -341,6 +341,7 @@ private:
|
|||||||
} while (millis() - startMillis < timeout);
|
} while (millis() - startMillis < timeout);
|
||||||
finish:
|
finish:
|
||||||
if (!index) {
|
if (!index) {
|
||||||
|
data.trim();
|
||||||
if (data.length()) {
|
if (data.length()) {
|
||||||
DBG("### Unhandled:", data);
|
DBG("### Unhandled:", data);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user