Cleanup
This commit is contained in:
@@ -66,6 +66,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
uint8_t newMux = -1;
|
||||
@@ -94,6 +95,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) {
|
||||
@@ -216,9 +218,7 @@ public:
|
||||
}
|
||||
|
||||
void maintain() {
|
||||
//while (stream.available()) {
|
||||
waitResponse(10, NULL, NULL);
|
||||
//}
|
||||
waitResponse(10, NULL, NULL);
|
||||
}
|
||||
|
||||
bool factoryDefault() {
|
||||
@@ -240,6 +240,10 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
bool hasSSL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Power functions
|
||||
*/
|
||||
@@ -400,8 +404,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"));
|
||||
@@ -612,12 +618,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;
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux);
|
||||
@@ -76,6 +77,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) {
|
||||
@@ -159,6 +161,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux, true);
|
||||
@@ -209,7 +212,7 @@ public:
|
||||
}
|
||||
|
||||
void maintain() {
|
||||
waitResponse(10, NULL, NULL);
|
||||
waitResponse(10, NULL, NULL);
|
||||
}
|
||||
|
||||
bool factoryDefault() {
|
||||
@@ -370,12 +373,12 @@ protected:
|
||||
int modemSend(const void* buff, size_t len, uint8_t mux) {
|
||||
sendAT(GF("+CIPSEND="), mux, ',', len);
|
||||
if (waitResponse(GF(">")) != 1) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
stream.write((uint8_t*)buff, len);
|
||||
stream.flush();
|
||||
if (waitResponse(10000L, GF(GSM_NL "SEND OK" GSM_NL)) != 1) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux);
|
||||
@@ -91,6 +92,7 @@ public:
|
||||
at->sendAT(GF("+TCPCLOSE="), mux);
|
||||
sock_connected = false;
|
||||
at->waitResponse();
|
||||
rx.clear();
|
||||
}
|
||||
|
||||
virtual size_t write(const uint8_t *buf, size_t size) {
|
||||
@@ -242,6 +244,10 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
bool hasSSL() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Power functions
|
||||
*/
|
||||
|
@@ -535,7 +535,8 @@ public:
|
||||
}
|
||||
|
||||
bool gprsDisconnect() {
|
||||
sendAT(GF("+CIPSHUT")); // Shut the TCP/IP connection
|
||||
// Shut the TCP/IP connection
|
||||
sendAT(GF("+CIPSHUT"));
|
||||
if (waitResponse(60000L) != 1)
|
||||
return false;
|
||||
|
||||
@@ -770,12 +771,12 @@ protected:
|
||||
int modemSend(const void* buff, size_t len, uint8_t mux) {
|
||||
sendAT(GF("+CIPSEND="), mux, ',', len);
|
||||
if (waitResponse(GF(">")) != 1) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
stream.write((uint8_t*)buff, len);
|
||||
stream.flush();
|
||||
if (waitResponse(GF(GSM_NL "DATA ACCEPT:")) != 1) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
streamSkipUntil(','); // Skip mux
|
||||
return stream.readStringUntil('\n').toInt();
|
||||
|
@@ -68,6 +68,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, &mux);
|
||||
@@ -92,6 +93,7 @@ public:
|
||||
at->sendAT(GF("+USOCL="), mux);
|
||||
sock_connected = false;
|
||||
at->waitResponse();
|
||||
rx.clear();
|
||||
}
|
||||
|
||||
virtual size_t write(const uint8_t *buf, size_t size) {
|
||||
@@ -106,7 +108,7 @@ public:
|
||||
|
||||
virtual int available() {
|
||||
TINY_GSM_YIELD();
|
||||
if (!rx.size() && sock_connected) { // TODO
|
||||
if (!rx.size() && sock_connected) {
|
||||
at->maintain();
|
||||
}
|
||||
return rx.size() + sock_available;
|
||||
@@ -180,6 +182,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual int connect(const char *host, uint16_t port) {
|
||||
stop();
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, &mux, true);
|
||||
@@ -258,6 +261,12 @@ public:
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
String getModemInfo() TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
|
||||
bool hasSSL() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Power functions
|
||||
*/
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef TinyGsmClientXBee_h
|
||||
#define TinyGsmClientXBee_h
|
||||
|
||||
// #define TINY_GSM_DEBUG Serial
|
||||
//#define TINY_GSM_DEBUG Serial
|
||||
|
||||
#if !defined(TINY_GSM_RX_BUFFER)
|
||||
#define TINY_GSM_RX_BUFFER 256
|
||||
@@ -459,11 +459,7 @@ fail:
|
||||
* Messaging functions
|
||||
*/
|
||||
|
||||
void sendUSSD() {
|
||||
}
|
||||
|
||||
void sendSMS() {
|
||||
}
|
||||
String sendUSSD(const String& code) TINY_GSM_ATTR_NOT_IMPLEMENTED;
|
||||
|
||||
bool sendSMS(const String& number, const String& text) {
|
||||
commandMode();
|
||||
|
Reference in New Issue
Block a user