forked from arduino-libraries/ArduinoIoTCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTLSClientOta.h
97 lines (90 loc) · 2.25 KB
/
TLSClientOta.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
This file is part of the ArduinoIoTCloud library.
Copyright (c) 2024 Arduino SA
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <Arduino_ConnectionHandler.h>
#include <AIoTC_Config.h>
#if defined(BOARD_HAS_OFFLOADED_ECCX08)
/*
* Arduino MKR WiFi1010 - WiFi
* Arduino NANO 33 IoT - WiFi
*/
#include "WiFiSSLClient.h"
class TLSClientOta : public WiFiBearSSLClient {
#elif defined(BOARD_HAS_ECCX08)
/*
* Arduino MKR GSM 1400
* Arduino MKR NB 1500
* Arduino NANO RP 2040
* Arduino Portenta H7
* Arduino Giga R1
* OPTA
*/
#include <tls/BearSSLClient.h>
class TLSClientOta : public BearSSLClient {
#elif defined(ARDUINO_PORTENTA_C33)
/*
* Arduino Portenta C33
*/
#include <SSLClient.h>
class TLSClientOta : public SSLClient {
#elif defined(ARDUINO_NICLA_VISION)
/*
* Arduino Nicla Vision
*/
#include <WiFiSSLSE050Client.h>
class TLSClientOta : public WiFiSSLSE050Client {
#elif defined(ARDUINO_EDGE_CONTROL)
/*
* Arduino Edge Control
*/
#include <GSMSSLClient.h>
class TLSClientOta : public GSMSSLClient {
#elif defined(ARDUINO_UNOR4_WIFI)
/*
* Arduino UNO R4 WiFi
*/
#include <WiFiSSLClient.h>
class TLSClientOta : public WiFiSSLClient {
#elif defined(BOARD_ESP)
/*
* ESP32*
* ESP82*
*/
#include <WiFiClientSecure.h>
class TLSClientOta : public WiFiClientSecure {
#endif
public:
void begin(ConnectionHandler & connection);
private:
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;
}
}
};