From 4f9182919f372d3dd44375850a01305234383884 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Wed, 14 Mar 2018 01:15:43 +0200 Subject: [PATCH] Make modem.stream public. Make user and pass optional in gprsConnect() --- src/TinyGsmClientA6.h | 6 ++++-- src/TinyGsmClientESP8266.h | 5 ++++- src/TinyGsmClientM590.h | 6 ++++-- src/TinyGsmClientSIM800.h | 6 ++++-- src/TinyGsmClientU201.h | 6 ++++-- src/TinyGsmClientXBee.h | 8 +++++--- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index 6dd9634..414b8d8 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -369,7 +369,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")); @@ -748,8 +748,10 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -protected: +public: Stream& stream; + +protected: GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index d1a6920..1ded3ca 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -381,6 +381,7 @@ protected: } bool modemGetConnected(uint8_t mux) { + // TODO: re-check this sendAT(GF("+CIPSTATUS="), mux); int res1 = waitResponse(3000, GF("STATUS:")); int res2; @@ -518,8 +519,10 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -protected: +public: Stream& stream; + +protected: GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index a5ae273..57a6195 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -375,7 +375,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("+XISP=0")); @@ -694,8 +694,10 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -protected: +public: Stream& stream; + +protected: GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index ac175f4..dea3597 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -447,7 +447,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(); // Set the Bearer for the IP @@ -949,8 +949,10 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -protected: +public: Stream& stream; + +protected: GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; diff --git a/src/TinyGsmClientU201.h b/src/TinyGsmClientU201.h index ddd2f99..051598c 100644 --- a/src/TinyGsmClientU201.h +++ b/src/TinyGsmClientU201.h @@ -380,7 +380,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")); @@ -699,8 +699,10 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -protected: +public: Stream& stream; + +protected: GsmClient* sockets[TINY_GSM_MUX_COUNT]; }; diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index fa4637e..f5d296c 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -442,7 +442,7 @@ fail: /* * GPRS functions */ - bool gprsConnect(const char* apn, const char* user = "", const char* pw = "") { + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { commandMode(); sendAT(GF("AN"), apn); // Set the APN waitResponse(); @@ -660,10 +660,12 @@ finish: return waitResponse(1000, r1, r2, r3, r4, r5); } -private: +public: + Stream& stream; + +protected: int guardTime; XBeeType beeType; - Stream& stream; GsmClient* sockets[TINY_GSM_MUX_COUNT]; };