Skip to content

Commit 414e00c

Browse files
added getNewSSLClient for ssl over tcp connections
1 parent cbe3db0 commit 414e00c

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/Arduino_GenericSSLClient.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#pragma once
2+
3+
#include "Arduino_ConnectionHandler.h"
4+
5+
#if defined(ARDUINO_UNOR4_WIFI)
6+
#include <WiFiSSLClient.h>
7+
#elif defined(BOARD_STM32H7)
8+
#include <WiFiSSLClient.h>
9+
#include "EthernetSSLClient.h"
10+
#elif defined(ARDUINO_PORTENTA_C33)
11+
#include "EthernetSSLClient.h"
12+
#include <WiFiSSLClient.h>
13+
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
14+
#include <WiFiClientSecure.h>
15+
16+
namespace connectionHandler {
17+
using WiFiSSLClient=WiFiClientSecure;
18+
}
19+
#endif
20+
21+
namespace connectionHandler {
22+
inline Client* getNewSSLClient(NetworkAdapter net) {
23+
switch(net) {
24+
#ifdef BOARD_HAS_WIFI
25+
case NetworkAdapter::WIFI:
26+
return new WiFiSSLClient();
27+
#endif // BOARD_HAS_WIFI
28+
#ifdef BOARD_HAS_ETHERNET
29+
case NetworkAdapter::ETHERNET:
30+
return new EthernetSSLClient();
31+
#endif // BOARD_HAS_ETHERNET
32+
#ifdef BOARD_HAS_NB
33+
case NetworkAdapter::NB:
34+
return new NBSSLClient();
35+
#endif // BOARD_HAS_NB
36+
#ifdef BOARD_HAS_GSM
37+
case NetworkAdapter::GSM:
38+
return new GSMSSLClient();
39+
#endif // BOARD_HAS_GSM
40+
#ifdef BOARD_HAS_CATM1_NBIOT
41+
case NetworkAdapter::CATM1:
42+
return new GSMSSLClient();
43+
#endif // BOARD_HAS_CATM1_NBIOT
44+
default:
45+
return nullptr;
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)