From 70ca06dc9dabd85058643ec8d63e2ee34fbd4886 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 17 May 2019 16:40:01 -0400 Subject: [PATCH] Moved begin above init, reset historic buffer sizes --- examples/HttpClient/HttpClient.ino | 62 +++++++++++++++++++--------- examples/HttpsClient/HttpsClient.ino | 62 +++++++++++++++++++--------- examples/WebClient/WebClient.ino | 8 ++-- src/TinyGsmClientA6.h | 13 ++++-- src/TinyGsmClientBG96.h | 13 ++++-- src/TinyGsmClientESP8266.h | 17 ++++---- src/TinyGsmClientM590.h | 13 ++++-- src/TinyGsmClientM95.h | 13 ++++-- src/TinyGsmClientMC60.h | 13 ++++-- src/TinyGsmClientSIM7000.h | 11 +++-- src/TinyGsmClientSIM800.h | 14 +++++-- src/TinyGsmClientSaraR4.h | 12 ++++-- src/TinyGsmClientSequansMonarch.h | 9 ++-- src/TinyGsmClientUBLOX.h | 12 ++++-- src/TinyGsmClientXBee.h | 10 +++-- src/TinyGsmCommon.h | 4 -- 16 files changed, 189 insertions(+), 97 deletions(-) diff --git a/examples/HttpClient/HttpClient.ino b/examples/HttpClient/HttpClient.ino index 25a622d..9f8d107 100644 --- a/examples/HttpClient/HttpClient.ino +++ b/examples/HttpClient/HttpClient.ino @@ -42,6 +42,9 @@ // else data will be lost (and the http library will fail). #define TINY_GSM_RX_BUFFER 650 +// See all AT commands, if wanted +//#define DUMP_AT_COMMANDS + // See the debugging, if wanted //#define TINY_GSM_DEBUG Serial //#define LOGGING @@ -52,12 +55,10 @@ #include #include -// Uncomment this if you want to see all AT commands -//#define DUMP_AT_COMMANDS - // Set serial for debug console (to the Serial Monitor, default speed 115200) #define SerialMon Serial +// Set serial for AT commands (to the module) // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial1 @@ -65,6 +66,11 @@ //#include //SoftwareSerial SerialAT(2, 3); // RX, TX +#define TINY_GSM_USE_GPRS true +#define TINY_GSM_USE_WIFI false + +// set GSM PIN, if any +#define GSM_PIN "" // Your GPRS credentials // Leave empty, if missing user or pass @@ -94,7 +100,15 @@ void setup() { // Set console baud rate SerialMon.begin(115200); delay(10); - SerialMon.println(F("Wait...")); + + // Set your reset, enable, power pins here + pinMode(20, OUTPUT); + digitalWrite(20, HIGH); + + pinMode(23, OUTPUT); + digitalWrite(23, HIGH); + + SerialMon.println("Wait..."); // Set GSM module baud rate SerialAT.begin(115200); @@ -102,11 +116,11 @@ void setup() { // Restart takes quite some time // To skip it, call init() instead of restart() - SerialMon.println(F("Initializing modem...")); + SerialMon.println("Initializing modem..."); modem.restart(); String modemInfo = modem.getModemInfo(); - SerialMon.print(F("Modem: ")); + SerialMon.print("Modem: "); SerialMon.println(modemInfo); // Unlock your SIM card with a PIN @@ -115,17 +129,17 @@ void setup() { void loop() { - if (modem.hasWifi()) { - SerialMon.print(F("Setting SSID/password...")); - if (!modem.networkConnect(wifiSSID, wifiPass)) { - SerialMon.println(" fail"); - delay(10000); - return; - } - SerialMon.println(" OK"); +#if TINY_GSM_USE_WIFI + SerialMon.print(F("Setting SSID/password...")); + if (!modem.networkConnect(wifiSSID, wifiPass)) { + SerialMon.println(" fail"); + delay(10000); + return; } + SerialMon.println(" OK"); +#endif - SerialMon.print(F("Waiting for network...")); + SerialMon.print("Waiting for network..."); if (!modem.waitForNetwork()) { SerialMon.println(" fail"); delay(10000); @@ -133,7 +147,11 @@ void loop() { } SerialMon.println(" OK"); - if (modem.hasGPRS()) { + if (modem.isNetworkConnected()) { + SerialMon.print("Network connected"); + } + +#if TINY_GSM_USE_GPRS SerialMon.print(F("Connecting to ")); SerialMon.print(apn); if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { @@ -142,7 +160,7 @@ void loop() { return; } SerialMon.println(" OK"); - } +#endif SerialMon.print(F("Performing HTTP GET request... ")); int err = http.get(resource); @@ -188,8 +206,14 @@ void loop() { http.stop(); SerialMon.println(F("Server disconnected")); - modem.gprsDisconnect(); - SerialMon.println(F("GPRS disconnected")); +#if TINY_GSM_USE_WIFI + modem.networkDisconnect(); + SerialMon.println(F("WiFi disconnected")); +#endif +#if TINY_GSM_USE_GPRS + modem.gprsDisconnect(); + SerialMon.println(F("GPRS disconnected")); +#endif // Do nothing forevermore while (true) { diff --git a/examples/HttpsClient/HttpsClient.ino b/examples/HttpsClient/HttpsClient.ino index 0299805..324e5c2 100644 --- a/examples/HttpsClient/HttpsClient.ino +++ b/examples/HttpsClient/HttpsClient.ino @@ -30,6 +30,9 @@ // else data will be lost (and the http library will fail). #define TINY_GSM_RX_BUFFER 650 +// See all AT commands, if wanted +//#define DUMP_AT_COMMANDS + // See the debugging, if wanted //#define TINY_GSM_DEBUG Serial //#define LOGGING @@ -40,12 +43,10 @@ #include #include -// Uncomment this if you want to see all AT commands -//#define DUMP_AT_COMMANDS - // Set serial for debug console (to the Serial Monitor, default speed 115200) #define SerialMon Serial +// Set serial for AT commands (to the module) // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial1 @@ -53,6 +54,11 @@ //#include //SoftwareSerial SerialAT(2, 3); // RX, TX +#define TINY_GSM_USE_GPRS true +#define TINY_GSM_USE_WIFI false + +// set GSM PIN, if any +#define GSM_PIN "" // Your GPRS credentials // Leave empty, if missing user or pass @@ -82,7 +88,15 @@ void setup() { // Set console baud rate SerialMon.begin(115200); delay(10); - SerialMon.println(F("Wait...")); + + // Set your reset, enable, power pins here + pinMode(20, OUTPUT); + digitalWrite(20, HIGH); + + pinMode(23, OUTPUT); + digitalWrite(23, HIGH); + + SerialMon.println("Wait..."); // Set GSM module baud rate SerialAT.begin(115200); @@ -90,11 +104,11 @@ void setup() { // Restart takes quite some time // To skip it, call init() instead of restart() - SerialMon.println(F("Initializing modem...")); + SerialMon.println("Initializing modem..."); modem.restart(); String modemInfo = modem.getModemInfo(); - SerialMon.print(F("Modem: ")); + SerialMon.print("Modem: "); SerialMon.println(modemInfo); // Unlock your SIM card with a PIN @@ -108,17 +122,17 @@ void setup() { void loop() { - if (modem.hasWifi()) { - SerialMon.print(F("Setting SSID/password...")); - if (!modem.networkConnect(wifiSSID, wifiPass)) { - SerialMon.println(" fail"); - delay(10000); - return; - } - SerialMon.println(" OK"); +#if TINY_GSM_USE_WIFI + SerialMon.print(F("Setting SSID/password...")); + if (!modem.networkConnect(wifiSSID, wifiPass)) { + SerialMon.println(" fail"); + delay(10000); + return; } + SerialMon.println(" OK"); +#endif - SerialMon.print(F("Waiting for network...")); + SerialMon.print("Waiting for network..."); if (!modem.waitForNetwork()) { SerialMon.println(" fail"); delay(10000); @@ -126,7 +140,11 @@ void loop() { } SerialMon.println(" OK"); - if (modem.hasGPRS()) { + if (modem.isNetworkConnected()) { + SerialMon.print("Network connected"); + } + +#if TINY_GSM_USE_GPRS SerialMon.print(F("Connecting to ")); SerialMon.print(apn); if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { @@ -135,7 +153,7 @@ void loop() { return; } SerialMon.println(" OK"); - } +#endif SerialMon.print(F("Performing HTTPS GET request... ")); http.connectionKeepAlive(); // Currently, this is needed for HTTPS @@ -182,8 +200,14 @@ void loop() { http.stop(); SerialMon.println(F("Server disconnected")); - modem.gprsDisconnect(); - SerialMon.println(F("GPRS disconnected")); +#if TINY_GSM_USE_WIFI + modem.networkDisconnect(); + SerialMon.println(F("WiFi disconnected")); +#endif +#if TINY_GSM_USE_GPRS + modem.gprsDisconnect(); + SerialMon.println(F("GPRS disconnected")); +#endif // Do nothing forevermore while (true) { diff --git a/examples/WebClient/WebClient.ino b/examples/WebClient/WebClient.ino index 314c3ad..2109d58 100644 --- a/examples/WebClient/WebClient.ino +++ b/examples/WebClient/WebClient.ino @@ -9,7 +9,7 @@ **************************************************************/ // Select your modem: -#define TINY_GSM_MODEM_SIM800 +// #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM808 // #define TINY_GSM_MODEM_SIM868 // #define TINY_GSM_MODEM_SIM900 @@ -65,7 +65,7 @@ // Your GPRS credentials // Leave empty, if missing user or pass -const char apn[] = "YourAPN"; +const char apn[] = "hologram"; const char gprsUser[] = ""; const char gprsPass[] = ""; const char wifiSSID[] = "YourSSID"; @@ -106,11 +106,11 @@ void setup() { digitalWrite(23, HIGH); SerialMon.println("Wait..."); - delay(3000); // Set GSM module baud rate // TinyGsmAutoBaud(SerialAT,GSM_AUTOBAUD_MIN,GSM_AUTOBAUD_MAX); SerialAT.begin(9600); + delay(3000); // Restart takes quite some time // To skip it, call init() instead of restart() @@ -139,9 +139,11 @@ void loop() { SerialMon.print("Waiting for network..."); if (!modem.waitForNetwork()) { + SerialMon.println(" fail"); delay(10000); return; } + SerialMon.println(" OK"); if (modem.isNetworkConnected()) { SerialMon.print("Network connected"); diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index 9af1038..42f5265 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -12,6 +12,10 @@ //#define TINY_GSM_DEBUG Serial +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 256 +#endif + #define TINY_GSM_MUX_COUNT 8 #include @@ -119,6 +123,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -137,10 +145,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { #if defined(TINY_GSM_MODEM_A6) return "AI-Thinker A6"; @@ -269,6 +273,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 5907dea..49e4427 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -13,6 +13,10 @@ //#define TINY_GSM_DEBUG Serial //#define TINY_GSM_USE_HEX +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 12 #include @@ -152,6 +156,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -166,10 +174,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "Quectel BG96"; } @@ -292,6 +296,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 9fb0866..685493d 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -12,6 +12,10 @@ //#define TINY_GSM_DEBUG Serial +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 512 +#endif + #define TINY_GSM_MUX_COUNT 5 #include @@ -119,10 +123,6 @@ public: TINY_GSM_YIELD(); rx.clear(); sock_connected = at->modemConnect(host, port, mux, true); - // sock_connected = at->modemConnect(host, port, &mux); - // at->sockets[mux] = this; - // ^^ TODO: attach the socket after attempting connection or above at init? - // Currently done inconsistently between modems return sock_connected; } }; @@ -140,6 +140,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -161,10 +165,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "ESP8266"; } @@ -289,6 +289,7 @@ TINY_GSM_MODEM_MAINTAIN_LISTEN() /* * WiFi functions */ + bool networkConnect(const char* ssid, const char* pwd) { sendAT(GF("+CWJAP_CUR=\""), ssid, GF("\",\""), pwd, GF("\"")); if (waitResponse(30000L, GFP(GSM_OK), GF(GSM_NL "FAIL" GSM_NL)) != 1) { diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index e9e232a..2530525 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -12,6 +12,10 @@ //#define TINY_GSM_DEBUG Serial +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 256 +#endif + #define TINY_GSM_MUX_COUNT 2 #include @@ -117,6 +121,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -135,10 +143,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "Neoway M590"; } @@ -254,6 +258,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index d5e6431..87dc3e0 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -13,6 +13,10 @@ //#define TINY_GSM_DEBUG Serial //#define TINY_GSM_USE_HEX +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 6 #include @@ -152,6 +156,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -170,10 +178,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "Quectel M95"; } @@ -309,6 +313,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 47976f2..0157f53 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -16,6 +16,10 @@ //#define TINY_GSM_DEBUG Serial //#define TINY_GSM_USE_HEX +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 6 #include @@ -156,6 +160,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -172,10 +180,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { #if defined(TINY_GSM_MODEM_MC60) return "Quectel MC60"; @@ -315,6 +319,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index 8474816..ff25f1e 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -165,6 +165,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -179,10 +183,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "SIMCom SIM7000"; } @@ -352,6 +352,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); @@ -656,6 +657,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * Time functions */ + String getGSMDateTime(TinyGSMDateTimeFormat format) { sendAT(GF("+CCLK?")); if (waitResponse(2000L, GF(GSM_NL "+CCLK: \"")) != 1) { @@ -729,6 +731,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * Battery functions */ + // Use: float vBatt = modem.getBattVoltage() / 1000.0; uint16_t getBattVoltage() { sendAT(GF("+CBC")); diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index e417bce..76dd497 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -13,6 +13,10 @@ //#define TINY_GSM_DEBUG Serial //#define TINY_GSM_USE_HEX +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 5 #include @@ -162,6 +166,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -178,10 +186,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { #if defined(TINY_GSM_MODEM_SIM800) return "SIMCom SIM800"; @@ -339,6 +343,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); @@ -621,6 +626,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * Time functions */ + String getGSMDateTime(TinyGSMDateTimeFormat format) { sendAT(GF("+CCLK?")); if (waitResponse(2000L, GF(GSM_NL "+CCLK: \"")) != 1) { diff --git a/src/TinyGsmClientSaraR4.h b/src/TinyGsmClientSaraR4.h index 6220711..197000c 100644 --- a/src/TinyGsmClientSaraR4.h +++ b/src/TinyGsmClientSaraR4.h @@ -12,6 +12,10 @@ //#define TINY_GSM_DEBUG Serial +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 7 #include @@ -181,6 +185,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -212,10 +220,6 @@ public: } } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { sendAT(GF("+CGMI")); String res1; diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index 516fb61..720653a 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -194,6 +194,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -207,10 +211,6 @@ public: return true; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return "Sequans Monarch"; } @@ -361,6 +361,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { gprsDisconnect(); diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index ec43e8b..bc5b961 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -12,6 +12,10 @@ //#define TINY_GSM_DEBUG Serial +#if !defined(TINY_GSM_RX_BUFFER) + #define TINY_GSM_RX_BUFFER 64 +#endif + #define TINY_GSM_MUX_COUNT 7 #include @@ -165,6 +169,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); if (!testAT()) { @@ -196,10 +204,6 @@ public: } } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { sendAT(GF("+CGMI")); String res1; diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 4797ad6..63a8003 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -282,6 +282,10 @@ public: * Basic functions */ + bool begin(const char* pin = NULL) { + return init(pin); + } + bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); @@ -307,10 +311,6 @@ public: return ret_val; } - bool begin(const char* pin = NULL) { - return init(pin); - } - String getModemName() { return getBeeName(); } @@ -672,6 +672,7 @@ public: /* * WiFi functions */ + bool networkConnect(const char* ssid, const char* pwd) { if (!commandMode()) return false; // return immediately @@ -730,6 +731,7 @@ public: /* * GPRS functions */ + bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { if (!commandMode()) return false; // Return immediately sendAT(GF("AN"), apn); // Set the APN diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index 205a824..70667e5 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -34,10 +34,6 @@ #define TINY_GSM_YIELD() { delay(0); } #endif -#if !defined(TINY_GSM_RX_BUFFER) - #define TINY_GSM_RX_BUFFER 64 -#endif - #define TINY_GSM_ATTR_NOT_AVAILABLE __attribute__((error("Not available on this modem type"))) #define TINY_GSM_ATTR_NOT_IMPLEMENTED __attribute__((error("Not implemented")))