Merge updates from original version

Conflicts:
	library.json
	library.properties
	src/TinyGsmClientA6.h
	src/TinyGsmClientESP8266.h
	src/TinyGsmClientM590.h
	src/TinyGsmClientSIM800.h
	src/TinyGsmClientU201.h
	src/TinyGsmClientXBee.h
This commit is contained in:
SRGDamia1
2018-03-15 16:47:43 -04:00
24 changed files with 737 additions and 258 deletions

View File

@@ -82,6 +82,7 @@ public:
public:
virtual int connect(const char *host, uint16_t port) {
stop();
TINY_GSM_YIELD();
rx.clear();
uint8_t newMux = -1;
@@ -110,6 +111,7 @@ public:
at->sendAT(GF("+CIPCLOSE="), mux);
sock_connected = false;
at->waitResponse();
rx.clear();
}
virtual size_t write(const uint8_t *buf, size_t size) {
@@ -252,9 +254,7 @@ public:
}
void maintain() {
//while (stream.available()) {
waitResponse(10, NULL, NULL);
//}
waitResponse(10, NULL, NULL);
}
bool factoryDefault() {
@@ -276,7 +276,9 @@ public:
return res;
}
bool hasSSL() { return false; }
bool hasSSL() {
return false;
}
/*
* Power functions
@@ -427,7 +429,7 @@ public:
/*
* GPRS functions
*/
bool gprsConnect(const char* apn, const char* user, const char* pwd) {
bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) {
gprsDisconnect();
sendAT(GF("+CGATT=1"));
@@ -458,8 +460,10 @@ public:
}
bool gprsDisconnect() {
// Shut the TCP/IP connection
sendAT(GF("+CIPSHUT"));
waitResponse(5000L);
if (waitResponse(60000L) != 1)
return false;
for (int i = 0; i<3; i++) {
sendAT(GF("+CGATT=0"));
@@ -572,12 +576,12 @@ protected:
int modemSend(const void* buff, size_t len, uint8_t mux) {
sendAT(GF("+CIPSEND="), mux, ',', len);
if (waitResponse(2000L, GF(GSM_NL ">")) != 1) {
return -1;
return 0;
}
stream.write((uint8_t*)buff, len);
stream.flush();
if (waitResponse(10000L, GFP(GSM_OK), GF(GSM_NL "FAIL")) != 1) {
return -1;
return 0;
}
return len;
}
@@ -713,8 +717,10 @@ finish:
return waitResponse(1000, r1, r2, r3, r4, r5);
}
protected:
public:
Stream& stream;
protected:
GsmClient* sockets[TINY_GSM_MUX_COUNT];
};