Merge branch 'super2'
This commit is contained in:
@@ -39,7 +39,7 @@ enum RegStatus {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmA6
|
class TinyGsmA6 : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -177,12 +177,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmA6(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmA6(Stream& stream)
|
TinyGsmA6(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -190,11 +186,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -212,6 +205,15 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
#if defined(TINY_GSM_MODEM_A6)
|
||||||
|
return "AI-Thinker A6";
|
||||||
|
#elif defined(TINY_GSM_MODEM_A7)
|
||||||
|
return "AI-Thinker A7";
|
||||||
|
#endif
|
||||||
|
return "AI-Thinker A6";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -255,6 +257,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -371,22 +381,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -445,6 +439,10 @@ public:
|
|||||||
return (res == 1);
|
return (res == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+CIFSR"));
|
sendAT(GF("+CIFSR"));
|
||||||
String res;
|
String res;
|
||||||
@@ -457,10 +455,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -40,7 +40,7 @@ enum RegStatus {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmBG96
|
class TinyGsmBG96 : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -201,12 +201,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmBG96(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmBG96(Stream& stream)
|
TinyGsmBG96(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -214,11 +210,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -230,6 +223,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return "Quectel BG96";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -284,6 +281,14 @@ public:
|
|||||||
return false; // TODO: For now
|
return false; // TODO: For now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -405,22 +410,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -467,6 +456,10 @@ public:
|
|||||||
return localIP() != 0;
|
return localIP() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+CGPADDR=1"));
|
sendAT(GF("+CGPADDR=1"));
|
||||||
if (waitResponse(10000L, GF(GSM_NL "+CGPADDR:")) != 1) {
|
if (waitResponse(10000L, GF(GSM_NL "+CGPADDR:")) != 1) {
|
||||||
@@ -480,10 +473,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -39,7 +39,7 @@ enum RegStatus {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmESP8266
|
class TinyGsmESP8266 : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -193,12 +193,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmESP8266(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmESP8266(Stream& stream)
|
TinyGsmESP8266(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -206,11 +202,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -229,6 +222,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return "ESP8266";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -270,6 +267,14 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -366,6 +371,10 @@ public:
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+CIPSTA_CUR??"));
|
sendAT(GF("+CIPSTA_CUR??"));
|
||||||
int res1 = waitResponse(GF("ERROR"), GF("+CWJAP_CUR:"));
|
int res1 = waitResponse(GF("ERROR"), GF("+CWJAP_CUR:"));
|
||||||
@@ -377,34 +386,6 @@ public:
|
|||||||
return res2;
|
return res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPRS functions
|
|
||||||
*/
|
|
||||||
bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool gprsDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Messaging functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Location functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
String getGsmLocation() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Battery functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint16_t getBattVoltage() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
int getBattPercent() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool ssl = false) {
|
bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool ssl = false) {
|
||||||
|
@@ -39,7 +39,7 @@ enum RegStatus {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmM590
|
class TinyGsmM590 : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -174,12 +174,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmM590(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmM590(Stream& stream)
|
TinyGsmM590(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -187,11 +183,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -208,6 +201,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return "Neoway M590";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -259,6 +256,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -379,22 +384,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -451,6 +440,10 @@ public:
|
|||||||
return res == 1;
|
return res == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+XIIC?"));
|
sendAT(GF("+XIIC?"));
|
||||||
if (waitResponse(GF(GSM_NL "+XIIC:")) != 1) {
|
if (waitResponse(GF(GSM_NL "+XIIC:")) != 1) {
|
||||||
@@ -463,10 +456,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -40,7 +40,7 @@ enum RegStatus {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmM95
|
class TinyGsmM95 : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -181,12 +181,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmM95(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmM95(Stream& stream)
|
TinyGsmM95(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -194,11 +190,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -215,6 +208,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return "Quectel M95";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -273,6 +270,14 @@ public:
|
|||||||
return false; // TODO: For now
|
return false; // TODO: For now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -416,12 +421,6 @@ public:
|
|||||||
waitResponse();
|
waitResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -470,6 +469,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+QILOCIP"));
|
sendAT(GF("+QILOCIP"));
|
||||||
stream.readStringUntil('\n');
|
stream.readStringUntil('\n');
|
||||||
@@ -478,10 +481,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phone Call functions
|
* Phone Call functions
|
||||||
*/
|
*/
|
||||||
|
@@ -43,24 +43,10 @@ enum RegStatus {
|
|||||||
REG_UNKNOWN = 4,
|
REG_UNKNOWN = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
// Declaration of the TinyGsmMC60 Class
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
|
class TinyGsmMC60 : public TinyGsmModem
|
||||||
|
|
||||||
class TinyGsmMC60
|
|
||||||
{
|
{
|
||||||
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
// The MC60 Internal Client Class
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class GsmClient : public Client
|
class GsmClient : public Client
|
||||||
@@ -199,12 +185,6 @@ private:
|
|||||||
RxFifo rx;
|
RxFifo rx;
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
// The MC60 Secure Client
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
|
|
||||||
class GsmClientSecure : public GsmClient
|
class GsmClientSecure : public GsmClient
|
||||||
{
|
{
|
||||||
@@ -225,20 +205,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
// The MC60 Modem Functions
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmMC60(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmMC60(Stream& stream)
|
TinyGsmMC60(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -246,11 +217,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -264,6 +232,17 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
#if defined(TINY_GSM_MODEM_MC60)
|
||||||
|
return "Quectel MC60";
|
||||||
|
#elif defined(TINY_GSM_MODEM_MC60E)
|
||||||
|
return "Quectel MC60E";
|
||||||
|
#endif
|
||||||
|
return "Quectel MC60";
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBaud(unsigned long baud) { return false; };
|
||||||
|
|
||||||
bool testAT(unsigned long timeout = 10000L) {
|
bool testAT(unsigned long timeout = 10000L) {
|
||||||
//streamWrite(GF("AAAAA" GSM_NL)); // TODO: extra A's to help detect the baud rate
|
//streamWrite(GF("AAAAA" GSM_NL)); // TODO: extra A's to help detect the baud rate
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
||||||
@@ -319,15 +298,25 @@ public:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* under development
|
* under development
|
||||||
*
|
*/
|
||||||
bool hasSSL() {
|
// bool hasSSL() {
|
||||||
sendAT(GF("+QIPSSL=?"));
|
// sendAT(GF("+QIPSSL=?"));
|
||||||
if (waitResponse(GF(GSM_NL "+CIPSSL:")) != 1) {
|
// if (waitResponse(GF(GSM_NL "+CIPSSL:")) != 1) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// return waitResponse() == 1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool hasSSL() { return false; }
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return waitResponse() == 1;
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -458,22 +447,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -614,6 +587,10 @@ public:
|
|||||||
return waitResponse(60000L) == 1;
|
return waitResponse(60000L) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+CIFSR;E0"));
|
sendAT(GF("+CIFSR;E0"));
|
||||||
String res;
|
String res;
|
||||||
@@ -624,10 +601,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -39,23 +39,9 @@ enum RegStatus {
|
|||||||
REG_UNKNOWN = 4,
|
REG_UNKNOWN = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================//
|
class TinyGsmSim800 : public TinyGsmModem
|
||||||
//============================================================================//
|
|
||||||
// Declaration of the TinyGsmSim800 Class
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmSim800
|
|
||||||
{
|
{
|
||||||
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
// The Internal SIM800 Client Class
|
|
||||||
//============================================================================//
|
|
||||||
//============================================================================//
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class GsmClient : public Client
|
class GsmClient : public Client
|
||||||
@@ -223,12 +209,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmSim800(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmSim800(Stream& stream)
|
TinyGsmSim800(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -236,11 +218,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -254,6 +233,19 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
#if defined(TINY_GSM_MODEM_SIM800)
|
||||||
|
return "SIMCom SIM800";
|
||||||
|
#elif defined(TINY_GSM_MODEM_SIM808)
|
||||||
|
return "SIMCom SIM808";
|
||||||
|
#elif defined(TINY_GSM_MODEM_SIM868)
|
||||||
|
return "SIMCom SIM868";
|
||||||
|
#elif defined(TINY_GSM_MODEM_SIM900)
|
||||||
|
return "SIMCom SIM900";
|
||||||
|
#endif
|
||||||
|
return "SIMCom SIM800";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -323,6 +315,14 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -466,22 +466,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -602,6 +586,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+CIFSR;E0"));
|
sendAT(GF("+CIFSR;E0"));
|
||||||
String res;
|
String res;
|
||||||
@@ -614,10 +602,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
// enable GPS
|
// enable GPS
|
||||||
bool enableGPS() {
|
bool enableGPS() {
|
||||||
uint16_t state;
|
// uint16_t state;
|
||||||
|
|
||||||
sendAT(GF("+CGNSPWR=1"));
|
sendAT(GF("+CGNSPWR=1"));
|
||||||
if (waitResponse() != 1) {
|
if (waitResponse() != 1) {
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool disableGPS() {
|
bool disableGPS() {
|
||||||
uint16_t state;
|
// uint16_t state;
|
||||||
|
|
||||||
sendAT(GF("+CGNSPWR=0"));
|
sendAT(GF("+CGNSPWR=0"));
|
||||||
if (waitResponse() != 1) {
|
if (waitResponse() != 1) {
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
// works only with ans SIM808 V2
|
// works only with ans SIM808 V2
|
||||||
bool getGPS(float *lat, float *lon, float *speed=0, int *alt=0, int *vsat=0, int *usat=0) {
|
bool getGPS(float *lat, float *lon, float *speed=0, int *alt=0, int *vsat=0, int *usat=0) {
|
||||||
//String buffer = "";
|
//String buffer = "";
|
||||||
char chr_buffer[12];
|
// char chr_buffer[12];
|
||||||
bool fix = false;
|
bool fix = false;
|
||||||
|
|
||||||
sendAT(GF("+CGNSINF"));
|
sendAT(GF("+CGNSINF"));
|
||||||
|
@@ -40,7 +40,7 @@ enum RegStatus {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmUBLOX
|
class TinyGsmUBLOX : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -200,12 +200,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmUBLOX(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmUBLOX(Stream& stream)
|
TinyGsmUBLOX(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{
|
{
|
||||||
memset(sockets, 0, sizeof(sockets));
|
memset(sockets, 0, sizeof(sockets));
|
||||||
}
|
}
|
||||||
@@ -213,9 +209,6 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin(const char* pin = NULL) {
|
|
||||||
return init(pin);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init(const char* pin = NULL) {
|
bool init(const char* pin = NULL) {
|
||||||
if (!testAT()) {
|
if (!testAT()) {
|
||||||
@@ -232,6 +225,10 @@ public:
|
|||||||
return (getSimStatus() == SIM_READY);
|
return (getSimStatus() == SIM_READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return "ESP8266";
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
sendAT(GF("+IPR="), baud);
|
sendAT(GF("+IPR="), baud);
|
||||||
}
|
}
|
||||||
@@ -284,6 +281,14 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power functions
|
* Power functions
|
||||||
*/
|
*/
|
||||||
@@ -404,22 +409,6 @@ public:
|
|||||||
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForNetwork(unsigned long timeout = 60000L) {
|
|
||||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
|
||||||
if (isNetworkConnected()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
delay(250);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WiFi functions
|
|
||||||
*/
|
|
||||||
bool networkConnect(const char* ssid, const char* pwd) TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
bool networkDisconnect() TINY_GSM_ATTR_NOT_AVAILABLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
@@ -485,6 +474,10 @@ public:
|
|||||||
return localIP() != 0;
|
return localIP() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
sendAT(GF("+UPSND=0,0"));
|
sendAT(GF("+UPSND=0,0"));
|
||||||
if (waitResponse(GF(GSM_NL "+UPSND:")) != 1) {
|
if (waitResponse(GF(GSM_NL "+UPSND:")) != 1) {
|
||||||
@@ -499,10 +492,6 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Messaging functions
|
* Messaging functions
|
||||||
*/
|
*/
|
||||||
|
@@ -45,7 +45,7 @@ enum XBeeType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TinyGsmXBee
|
class TinyGsmXBee : public TinyGsmModem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -206,22 +206,15 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef GSM_DEFAULT_STREAM
|
|
||||||
TinyGsmXBee(Stream& stream = GSM_DEFAULT_STREAM)
|
|
||||||
#else
|
|
||||||
TinyGsmXBee(Stream& stream)
|
TinyGsmXBee(Stream& stream)
|
||||||
#endif
|
: TinyGsmModem(stream), stream(stream)
|
||||||
: stream(stream)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basic functions
|
* Basic functions
|
||||||
*/
|
*/
|
||||||
bool begin() {
|
|
||||||
return init();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool init() {
|
bool init(const char* pin = NULL) {
|
||||||
guardTime = 1100; // Start with a default guard time of 1 second
|
guardTime = 1100; // Start with a default guard time of 1 second
|
||||||
|
|
||||||
if (!commandMode(10)) return false; // Try up to 10 times for the init
|
if (!commandMode(10)) return false; // Try up to 10 times for the init
|
||||||
@@ -246,6 +239,10 @@ public:
|
|||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getModemName() {
|
||||||
|
return getBeeName();
|
||||||
|
}
|
||||||
|
|
||||||
void setBaud(unsigned long baud) {
|
void setBaud(unsigned long baud) {
|
||||||
if (!commandMode()) return;
|
if (!commandMode()) return;
|
||||||
switch(baud)
|
switch(baud)
|
||||||
@@ -313,6 +310,16 @@ public:
|
|||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWifi() {
|
||||||
|
if (beeType == XBEE_S6B_WIFI) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasGPRS() {
|
||||||
|
if (beeType == XBEE_S6B_WIFI) return false;
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
|
|
||||||
XBeeType getBeeType() {
|
XBeeType getBeeType() {
|
||||||
return beeType;
|
return beeType;
|
||||||
}
|
}
|
||||||
@@ -325,6 +332,7 @@ public:
|
|||||||
case XBEE3_LTE1_ATT: return "Digi XBee3™ Cellular LTE CAT 1";
|
case XBEE3_LTE1_ATT: return "Digi XBee3™ Cellular LTE CAT 1";
|
||||||
case XBEE3_LTEM_ATT: return "Digi XBee3™ Cellular LTE-M";
|
case XBEE3_LTEM_ATT: return "Digi XBee3™ Cellular LTE-M";
|
||||||
case XBEE3_LTENB: return "Digi XBee3™ Cellular NB-IoT";
|
case XBEE3_LTENB: return "Digi XBee3™ Cellular NB-IoT";
|
||||||
|
default: return "Digi XBee®";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,6 +567,10 @@ fail:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
if (!commandMode()) return ""; // Return immediately
|
if (!commandMode()) return ""; // Return immediately
|
||||||
sendAT(GF("MY"));
|
sendAT(GF("MY"));
|
||||||
@@ -570,10 +582,6 @@ fail:
|
|||||||
return IPaddr;
|
return IPaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress localIP() {
|
|
||||||
return TinyGsmIpFromString(getLocalIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPRS functions
|
* GPRS functions
|
||||||
*/
|
*/
|
||||||
|
@@ -69,6 +69,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#define DBG_PLAIN(...)
|
||||||
#define DBG(...)
|
#define DBG(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -194,4 +195,108 @@ String TinyGsmDecodeHex16bit(String &instr) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TinyGsmModem
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TinyGsmModem(Stream& stream)
|
||||||
|
: stream(stream)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Prepare the modem for further functionality
|
||||||
|
virtual bool init(const char* pin = NULL) = 0;
|
||||||
|
// Begin is redundant with init
|
||||||
|
virtual bool begin(const char* pin = NULL) {
|
||||||
|
return init(pin);
|
||||||
|
}
|
||||||
|
// Returns a string with the chip name
|
||||||
|
virtual String getModemName() = 0;
|
||||||
|
// Sets the serial communication baud rate
|
||||||
|
virtual void setBaud(unsigned long baud) = 0;
|
||||||
|
// Checks that the modem is responding to standard AT commands
|
||||||
|
virtual bool testAT(unsigned long timeout = 10000L) = 0;
|
||||||
|
// Holds open communication with the modem waiting for data to come in
|
||||||
|
virtual void maintain() = 0;
|
||||||
|
// Resets all modem chip settings to factor defaults
|
||||||
|
virtual bool factoryDefault() = 0;
|
||||||
|
// Returns the response to a get info request. The format varies by modem.
|
||||||
|
virtual String getModemInfo() = 0;
|
||||||
|
// Answers whether types of communication are available on this modem
|
||||||
|
virtual bool hasSSL() = 0;
|
||||||
|
virtual bool hasWifi() = 0;
|
||||||
|
virtual bool hasGPRS() = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Power functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual bool restart() = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SIM card functions - only apply to cellular modems
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual bool simUnlock(const char *pin) { return false; }
|
||||||
|
virtual String getSimCCID() { return ""; }
|
||||||
|
virtual String getIMEI() { return ""; }
|
||||||
|
virtual String getOperator() { return ""; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic network functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual int getSignalQuality() = 0;
|
||||||
|
// NOTE: this returns whether the modem is registered on the cellular or WiFi
|
||||||
|
// network NOT whether GPRS or other internet connections are available
|
||||||
|
virtual bool isNetworkConnected() = 0;
|
||||||
|
virtual bool waitForNetwork(unsigned long timeout = 60000L) {
|
||||||
|
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
||||||
|
if (isNetworkConnected()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
delay(250);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* WiFi functions - only apply to WiFi modems
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual bool networkConnect(const char* ssid, const char* pwd) { return false; }
|
||||||
|
virtual bool networkDisconnect() { return false; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GPRS functions - only apply to cellular modems
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual bool gprsDisconnect() { return false; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IP Address functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual String getLocalIP() = 0;
|
||||||
|
virtual IPAddress localIP() {
|
||||||
|
return TinyGsmIpFromString(getLocalIP());
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
Stream& stream;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* DO NOT USE THIS - this is just a compilation test!
|
* DO NOT USE THIS - this is just a compilation test!
|
||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
#define TINY_GSM_MODEM_SIM800
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
#include <TinyGsmClient.h>
|
||||||
|
|
||||||
@@ -77,4 +78,3 @@ void loop() {
|
|||||||
modem.networkDisconnect();
|
modem.networkDisconnect();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user