|
|
@ -43,24 +43,10 @@ enum RegStatus { |
|
|
|
REG_UNKNOWN = 4, |
|
|
|
}; |
|
|
|
|
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
// Declaration of the TinyGsmMC60 Class |
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TinyGsmMC60 |
|
|
|
class TinyGsmMC60 : public TinyGsmModem |
|
|
|
{ |
|
|
|
|
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
// The MC60 Internal Client Class |
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
class GsmClient : public Client |
|
|
@ -199,12 +185,6 @@ private: |
|
|
|
RxFifo rx; |
|
|
|
}; |
|
|
|
|
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
// The MC60 Secure Client |
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
|
|
|
|
|
|
|
|
class GsmClientSecure : public GsmClient |
|
|
|
{ |
|
|
@ -225,20 +205,11 @@ public: |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
// The MC60 Modem Functions |
|
|
|
//============================================================================// |
|
|
|
//============================================================================// |
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
#ifdef GSM_DEFAULT_STREAM |
|
|
|
TinyGsmMC60(Stream& stream = GSM_DEFAULT_STREAM) |
|
|
|
#else |
|
|
|
TinyGsmMC60(Stream& stream) |
|
|
|
#endif |
|
|
|
: stream(stream) |
|
|
|
: TinyGsmModem(stream), stream(stream) |
|
|
|
{ |
|
|
|
memset(sockets, 0, sizeof(sockets)); |
|
|
|
} |
|
|
@ -246,11 +217,8 @@ public: |
|
|
|
/* |
|
|
|
* Basic functions |
|
|
|
*/ |
|
|
|
bool begin() { |
|
|
|
return init(); |
|
|
|
} |
|
|
|
|
|
|
|
bool init() { |
|
|
|
bool init(const char* pin = NULL) { |
|
|
|
if (!testAT()) { |
|
|
|
return false; |
|
|
|
} |
|
|
@ -264,6 +232,17 @@ public: |
|
|
|
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) { |
|
|
|
//streamWrite(GF("AAAAA" GSM_NL)); // TODO: extra A's to help detect the baud rate |
|
|
|
for (unsigned long start = millis(); millis() - start < timeout; ) { |
|
|
@ -319,15 +298,25 @@ public: |
|
|
|
|
|
|
|
/* |
|
|
|
* under development |
|
|
|
* |
|
|
|
bool hasSSL() { |
|
|
|
sendAT(GF("+QIPSSL=?")); |
|
|
|
if (waitResponse(GF(GSM_NL "+CIPSSL:")) != 1) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return waitResponse() == 1; |
|
|
|
*/ |
|
|
|
// bool hasSSL() { |
|
|
|
// sendAT(GF("+QIPSSL=?")); |
|
|
|
// if (waitResponse(GF(GSM_NL "+CIPSSL:")) != 1) { |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
// return waitResponse() == 1; |
|
|
|
// } |
|
|
|
|
|
|
|
bool hasSSL() { return false; } |
|
|
|
|
|
|
|
bool hasWifi() { |
|
|
|
return false; |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
bool hasGPRS() { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Power functions |
|
|
|
*/ |
|
|
@ -458,22 +447,6 @@ public: |
|
|
|
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 |
|
|
|
*/ |
|
|
@ -614,6 +587,10 @@ public: |
|
|
|
return waitResponse(60000L) == 1; |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* IP Address functions |
|
|
|
*/ |
|
|
|
|
|
|
|
String getLocalIP() { |
|
|
|
sendAT(GF("+CIFSR;E0")); |
|
|
|
String res; |
|
|
@ -624,10 +601,6 @@ public: |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
IPAddress localIP() { |
|
|
|
return TinyGsmIpFromString(getLocalIP()); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Messaging functions |
|
|
|
*/ |
|
|
|