Moved begin above init, reset historic buffer sizes

This commit is contained in:
Sara Damiano
2019-05-17 16:40:01 -04:00
parent 5411535870
commit 70ca06dc9d
16 changed files with 189 additions and 97 deletions

View File

@@ -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 <TinyGsmCommon.h>
@@ -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();

View File

@@ -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 <TinyGsmCommon.h>
@@ -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();

View File

@@ -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 <TinyGsmCommon.h>
@@ -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) {

View File

@@ -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 <TinyGsmCommon.h>
@@ -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();

View File

@@ -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 <TinyGsmCommon.h>
@@ -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();

View File

@@ -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 <TinyGsmCommon.h>
@@ -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();

View File

@@ -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"));

View File

@@ -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 <TinyGsmCommon.h>
@@ -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) {

View File

@@ -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 <TinyGsmCommon.h>
@@ -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;

View File

@@ -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();

View File

@@ -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 <TinyGsmCommon.h>
@@ -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;

View File

@@ -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

View File

@@ -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")))