|
@ -126,6 +126,10 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
: GsmClientSim7000(modem, mux) {} |
|
|
: GsmClientSim7000(modem, mux) {} |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
|
|
|
bool setCertificate(const String & certificateName) { |
|
|
|
|
|
return at->setCertificate(certificateName, mux); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int connect(const char* host, uint16_t port, int timeout_s) override { |
|
|
int connect(const char* host, uint16_t port, int timeout_s) override { |
|
|
stop(); |
|
|
stop(); |
|
|
TINY_GSM_YIELD(); |
|
|
TINY_GSM_YIELD(); |
|
@ -140,7 +144,10 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
* Constructor |
|
|
* Constructor |
|
|
*/ |
|
|
*/ |
|
|
public: |
|
|
public: |
|
|
explicit TinyGsmSim7000(Stream& stream) : stream(stream) { |
|
|
|
|
|
|
|
|
explicit TinyGsmSim7000(Stream& stream): |
|
|
|
|
|
stream(stream), |
|
|
|
|
|
certificates() |
|
|
|
|
|
{ |
|
|
memset(sockets, 0, sizeof(sockets)); |
|
|
memset(sockets, 0, sizeof(sockets)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -262,6 +269,13 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected: |
|
|
protected: |
|
|
|
|
|
bool setCertificate(const String & certificateName, const uint8_t mux = 0) { |
|
|
|
|
|
if (mux >= TINY_GSM_MUX_COUNT) return false; |
|
|
|
|
|
certificates[mux] = certificateName; |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isNetworkConnectedImpl() { |
|
|
bool isNetworkConnectedImpl() { |
|
|
RegStatus s = getRegistrationStatus(); |
|
|
RegStatus s = getRegistrationStatus(); |
|
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING); |
|
|
return (s == REG_OK_HOME || s == REG_OK_ROAMING); |
|
@ -389,8 +403,6 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
sendAT(GF("+CGATT=1")); |
|
|
sendAT(GF("+CGATT=1")); |
|
|
if (waitResponse(60000L) != 1) { return false; } |
|
|
if (waitResponse(60000L) != 1) { return false; } |
|
|
|
|
|
|
|
|
// TODO(?): wait AT+CGATT? |
|
|
|
|
|
|
|
|
|
|
|
// Check data connection |
|
|
// Check data connection |
|
|
|
|
|
|
|
|
sendAT(GF("+CNACT?")); |
|
|
sendAT(GF("+CNACT?")); |
|
@ -563,10 +575,16 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
|
|
|
|
|
|
if (ssl) { |
|
|
if (ssl) { |
|
|
sendAT(GF("+CSSLCFG=\"sslversion\",0,3")); // TLS 1.2 |
|
|
sendAT(GF("+CSSLCFG=\"sslversion\",0,3")); // TLS 1.2 |
|
|
waitResponse(); |
|
|
|
|
|
|
|
|
if (waitResponse() != 1) return false; |
|
|
|
|
|
|
|
|
sendAT(GF("+CSSLCFG=\"ctxindex\",0")); |
|
|
sendAT(GF("+CSSLCFG=\"ctxindex\",0")); |
|
|
waitResponse(); |
|
|
|
|
|
|
|
|
if (waitResponse() != 1) return false; |
|
|
|
|
|
|
|
|
|
|
|
if (certificates[mux] != "") |
|
|
|
|
|
{ |
|
|
|
|
|
sendAT(GF("+CASSLCFG="), mux, ",CACERT,\"", certificates[mux].c_str(),"\""); |
|
|
|
|
|
if (waitResponse() != 1) return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sendAT(GF("+CASSLCFG="), mux, ',', GF("ssl,"), ssl); |
|
|
sendAT(GF("+CASSLCFG="), mux, ',', GF("ssl,"), ssl); |
|
@ -877,6 +895,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, |
|
|
|
|
|
|
|
|
protected: |
|
|
protected: |
|
|
GsmClientSim7000* sockets[TINY_GSM_MUX_COUNT]; |
|
|
GsmClientSim7000* sockets[TINY_GSM_MUX_COUNT]; |
|
|
|
|
|
String certificates[TINY_GSM_MUX_COUNT]; |
|
|
const char* gsmNL = GSM_NL; |
|
|
const char* gsmNL = GSM_NL; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|