Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Arduino_GenericClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "Arduino_ConnectionHandler.h"

namespace connectionHandler {
inline Client* getNewClient(NetworkAdapter net) {
switch(net) {
#ifdef BOARD_HAS_WIFI
case NetworkAdapter::WIFI:
return new WiFiClient();
#endif // BOARD_HAS_WIFI
#ifdef BOARD_HAS_ETHERNET
case NetworkAdapter::ETHERNET:
return new EthernetClient();
#endif // BOARD_HAS_ETHERNET
#ifdef BOARD_HAS_NB
case NetworkAdapter::NB:
return new NBClient();
#endif // BOARD_HAS_NB
#ifdef BOARD_HAS_GSM
case NetworkAdapter::GSM:
return new GSMClient();
#endif // BOARD_HAS_GSM
#ifdef BOARD_HAS_CATM1_NBIOT
case NetworkAdapter::CATM1:
return new GSMClient();
#endif // BOARD_HAS_CATM1_NBIOT
default:
return nullptr;
}
}
}
48 changes: 48 additions & 0 deletions src/Arduino_GenericSSLClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#pragma once

#include "Arduino_ConnectionHandler.h"

#if defined(ARDUINO_UNOR4_WIFI)
#include <WiFiSSLClient.h>
#elif defined(BOARD_STM32H7)
#include <WiFiSSLClient.h>
#include "EthernetSSLClient.h"
#elif defined(ARDUINO_PORTENTA_C33)
#include "EthernetSSLClient.h"
#include <WiFiSSLClient.h>
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
#include <WiFiClientSecure.h>

namespace connectionHandler {
using WiFiSSLClient=WiFiClientSecure;
}
#endif

namespace connectionHandler {
inline Client* getNewSSLClient(NetworkAdapter net) {
switch(net) {
#ifdef BOARD_HAS_WIFI
case NetworkAdapter::WIFI:
return new WiFiSSLClient();
#endif // BOARD_HAS_WIFI
#ifdef BOARD_HAS_ETHERNET
case NetworkAdapter::ETHERNET:
return new EthernetSSLClient();
#endif // BOARD_HAS_ETHERNET
#ifdef BOARD_HAS_NB
case NetworkAdapter::NB:
return new NBSSLClient();
#endif // BOARD_HAS_NB
#ifdef BOARD_HAS_GSM
case NetworkAdapter::GSM:
return new GSMSSLClient();
#endif // BOARD_HAS_GSM
#ifdef BOARD_HAS_CATM1_NBIOT
case NetworkAdapter::CATM1:
return new GSMSSLClient();
#endif // BOARD_HAS_CATM1_NBIOT
default:
return nullptr;
}
}
}