Add SSLOPT to SIM800 with preprocessor flag to use
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -71,6 +71,9 @@
|
|||||||
// set GSM PIN, if any
|
// set GSM PIN, if any
|
||||||
#define GSM_PIN ""
|
#define GSM_PIN ""
|
||||||
|
|
||||||
|
// flag to force SSL client authentication, if needed
|
||||||
|
// #define TINY_GSM_SSL_CLIENT_AUTHENTICATION
|
||||||
|
|
||||||
// Your GPRS credentials, if any
|
// Your GPRS credentials, if any
|
||||||
const char apn[] = "YourAPN";
|
const char apn[] = "YourAPN";
|
||||||
const char gprsUser[] = "";
|
const char gprsUser[] = "";
|
||||||
@@ -81,9 +84,9 @@ const char wifiSSID[] = "YourSSID";
|
|||||||
const char wifiPass[] = "YourWiFiPass";
|
const char wifiPass[] = "YourWiFiPass";
|
||||||
|
|
||||||
// Server details
|
// Server details
|
||||||
const char server[] = "vsh.pp.ua";
|
const char server[] = "vsh.pp.ua";
|
||||||
const char resource[] = "/TinyGSM/logo.txt";
|
const char resource[] = "/TinyGSM/logo.txt";
|
||||||
const int port = 443;
|
const int port = 443;
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
#include <TinyGsmClient.h>
|
||||||
#include <ArduinoHttpClient.h>
|
#include <ArduinoHttpClient.h>
|
||||||
@@ -103,15 +106,15 @@ const int port = 443;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DUMP_AT_COMMANDS
|
#ifdef DUMP_AT_COMMANDS
|
||||||
#include <StreamDebugger.h>
|
#include <StreamDebugger.h>
|
||||||
StreamDebugger debugger(SerialAT, SerialMon);
|
StreamDebugger debugger(SerialAT, SerialMon);
|
||||||
TinyGsm modem(debugger);
|
TinyGsm modem(debugger);
|
||||||
#else
|
#else
|
||||||
TinyGsm modem(SerialAT);
|
TinyGsm modem(SerialAT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TinyGsmClientSecure client(modem);
|
TinyGsmClientSecure client(modem);
|
||||||
HttpClient http(client, server, port);
|
HttpClient http(client, server, port);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set console baud rate
|
// Set console baud rate
|
||||||
|
@@ -506,6 +506,18 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
|||||||
sendAT(GF("+CIPSSL="), ssl);
|
sendAT(GF("+CIPSSL="), ssl);
|
||||||
rsp = waitResponse();
|
rsp = waitResponse();
|
||||||
if (ssl && rsp != 1) { return false; }
|
if (ssl && rsp != 1) { return false; }
|
||||||
|
#ifdef TINY_GSM_SSL_CLIENT_AUTHENTICATION
|
||||||
|
// set SSL options
|
||||||
|
// +SSLOPT=<opt>,<enable>
|
||||||
|
// <opt>
|
||||||
|
// 0 (default) ignore invalid certificate
|
||||||
|
// 1 client authentication
|
||||||
|
// <enable>
|
||||||
|
// 0 (default) close
|
||||||
|
// 1 open
|
||||||
|
sendAT(GF("+CIPSSL=1,1"));
|
||||||
|
if (waitResponse() != 1) return false;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host,
|
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host,
|
||||||
GF("\","), port);
|
GF("\","), port);
|
||||||
|
Reference in New Issue
Block a user