Skip to content

Commit df90716

Browse files
committed
Rename WiFiClient and WiFiClientSecure
1 parent a39dcfd commit df90716

File tree

73 files changed

+268
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+268
-262
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ set(ARDUINO_LIBRARY_Networking_SRCS
207207
libraries/Networking/src/NetworkInterface.cpp
208208
libraries/Networking/src/NetworkEvents.cpp
209209
libraries/Networking/src/NetworkManager.cpp
210-
libraries/Networking/src/WiFiClient.cpp
210+
libraries/Networking/src/NetworkClient.cpp
211211
libraries/Networking/src/NetworkServer.cpp
212212
libraries/Networking/src/NetworkUdp.cpp)
213213

libraries/ArduinoOTA/src/ArduinoOTA.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#endif
44
#include <functional>
55
#include "ArduinoOTA.h"
6-
#include "WiFiClient.h"
6+
#include "NetworkClient.h"
77
#include "ESPmDNS.h"
88
#include "MD5Builder.h"
99
#include "Update.h"
@@ -266,7 +266,7 @@ void ArduinoOTAClass::_runUpdate() {
266266
_progress_callback(0, _size);
267267
}
268268

269-
WiFiClient client;
269+
NetworkClient client;
270270
if (!client.connect(_ota_ip, _ota_port)) {
271271
if (_error_callback) {
272272
_error_callback(OTA_CONNECT_ERROR);

libraries/ESPmDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <WiFi.h>
2020
#include <ESPmDNS.h>
21-
#include <WiFiClient.h>
21+
#include <NetworkClient.h>
2222

2323
const char* ssid = "............";
2424
const char* password = "..............";
@@ -69,7 +69,7 @@ void setup(void)
6969
void loop(void)
7070
{
7171
// Check if a client has connected
72-
WiFiClient client = server.accept();
72+
NetworkClient client = server.accept();
7373
if (!client) {
7474
return;
7575
}

libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void testClient(const char * host, uint16_t port)
5858
Serial.print("\nconnecting to ");
5959
Serial.println(host);
6060

61-
WiFiClient client;
61+
NetworkClient client;
6262
if (!client.connect(host, port)) {
6363
Serial.println("connection failed");
6464
return;

libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void testClient(const char * host, uint16_t port)
5656
Serial.print("\nconnecting to ");
5757
Serial.println(host);
5858

59-
WiFiClient client;
59+
NetworkClient client;
6060
if (!client.connect(host, port)) {
6161
Serial.println("connection failed");
6262
return;

libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void testClient(const char * host, uint16_t port)
7777
Serial.print("\nconnecting to ");
7878
Serial.println(host);
7979

80-
WiFiClient client;
80+
NetworkClient client;
8181
if (!client.connect(host, port)) {
8282
Serial.println("connection failed");
8383
return;

libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void testClient(const char * host, uint16_t port)
7575
Serial.print("\nconnecting to ");
7676
Serial.println(host);
7777

78-
WiFiClient client;
78+
NetworkClient client;
7979
if (!client.connect(host, port)) {
8080
Serial.println("connection failed");
8181
return;

libraries/HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <HTTPClient.h>
1414

15-
#include <WiFiClientSecure.h>
15+
#include <NetworkClientSecure.h>
1616

1717
// This is GandiStandardSSLCA2.pem, the root Certificate Authority that signed
1818
// the server certifcate for the demo server https://jigsaw.w3.org in this
@@ -53,7 +53,7 @@ const char* rootCACertificate = \
5353
"BT02Vf6Dsuimrdfp5gJ0iHRc2jTbkNJtUQoj1iM=\n" \
5454
"-----END CERTIFICATE-----\n";
5555

56-
// Not sure if WiFiClientSecure checks the validity date of the certificate.
56+
// Not sure if NetworkClientSecure checks the validity date of the certificate.
5757
// Setting clock just to be sure...
5858
void setClock() {
5959
configTime(0, 0, "pool.ntp.org");
@@ -100,12 +100,12 @@ void setup() {
100100
}
101101

102102
void loop() {
103-
WiFiClientSecure *client = new WiFiClientSecure;
103+
NetworkClientSecure *client = new NetworkClientSecure;
104104
if(client) {
105105
client -> setCACert(rootCACertificate);
106106

107107
{
108-
// Add a scoping block for HTTPClient https to make sure it is destroyed before WiFiClientSecure *client is
108+
// Add a scoping block for HTTPClient https to make sure it is destroyed before NetworkClientSecure *client is
109109
HTTPClient https;
110110

111111
Serial.print("[HTTPS] begin...\n");

libraries/HTTPClient/examples/StreamHttpClient/StreamHttpClient.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void loop() {
6363
uint8_t buff[128] = { 0 };
6464

6565
// get tcp stream
66-
WiFiClient * stream = http.getStreamPtr();
66+
NetworkClient * stream = http.getStreamPtr();
6767

6868
// read all data from server
6969
while(http.connected() && (len > 0 || len == -1)) {

libraries/HTTPClient/src/HTTPClient.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <esp32-hal-log.h>
3131

3232
#ifdef HTTPCLIENT_1_1_COMPATIBLE
33-
#include <WiFiClient.h>
34-
#include <WiFiClientSecure.h>
33+
#include <NetworkClient.h>
34+
#include <NetworkClientSecure.h>
3535
#endif
3636

3737
#include <StreamString.h>
@@ -50,12 +50,12 @@ class TransportTraits
5050
{
5151
}
5252

53-
virtual std::unique_ptr<WiFiClient> create()
53+
virtual std::unique_ptr<NetworkClient> create()
5454
{
55-
return std::unique_ptr<WiFiClient>(new WiFiClient());
55+
return std::unique_ptr<NetworkClient>(new NetworkClient());
5656
}
5757

58-
virtual bool verify(WiFiClient& client, const char* host)
58+
virtual bool verify(NetworkClient& client, const char* host)
5959
{
6060
return true;
6161
}
@@ -69,14 +69,14 @@ class TLSTraits : public TransportTraits
6969
{
7070
}
7171

72-
std::unique_ptr<WiFiClient> create() override
72+
std::unique_ptr<NetworkClient> create() override
7373
{
74-
return std::unique_ptr<WiFiClient>(new WiFiClientSecure());
74+
return std::unique_ptr<NetworkClient>(new NetworkClientSecure());
7575
}
7676

77-
bool verify(WiFiClient& client, const char* host) override
77+
bool verify(NetworkClient& client, const char* host) override
7878
{
79-
WiFiClientSecure& wcs = static_cast<WiFiClientSecure&>(client);
79+
NetworkClientSecure& wcs = static_cast<NetworkClientSecure&>(client);
8080
if (_cacert == nullptr) {
8181
wcs.setInsecure();
8282
} else {
@@ -135,7 +135,7 @@ void HTTPClient::clear()
135135
* @param https bool
136136
* @return success bool
137137
*/
138-
bool HTTPClient::begin(WiFiClient &client, String url) {
138+
bool HTTPClient::begin(NetworkClient &client, String url) {
139139
#ifdef HTTPCLIENT_1_1_COMPATIBLE
140140
if(_tcpDeprecated) {
141141
log_d("mix up of new and deprecated api");
@@ -174,7 +174,7 @@ bool HTTPClient::begin(WiFiClient &client, String url) {
174174
* @param https bool
175175
* @return success bool
176176
*/
177-
bool HTTPClient::begin(WiFiClient &client, String host, uint16_t port, String uri, bool https)
177+
bool HTTPClient::begin(NetworkClient &client, String host, uint16_t port, String uri, bool https)
178178
{
179179
#ifdef HTTPCLIENT_1_1_COMPATIBLE
180180
if(_tcpDeprecated) {
@@ -862,24 +862,24 @@ int HTTPClient::getSize(void)
862862

863863
/**
864864
* returns the stream of the tcp connection
865-
* @return WiFiClient
865+
* @return NetworkClient
866866
*/
867-
WiFiClient& HTTPClient::getStream(void)
867+
NetworkClient& HTTPClient::getStream(void)
868868
{
869869
if (connected()) {
870870
return *_client;
871871
}
872872

873873
log_w("getStream: not connected");
874-
static WiFiClient empty;
874+
static NetworkClient empty;
875875
return empty;
876876
}
877877

878878
/**
879879
* returns a pointer to the stream of the tcp connection
880-
* @return WiFiClient*
880+
* @return NetworkClient*
881881
*/
882-
WiFiClient* HTTPClient::getStreamPtr(void)
882+
NetworkClient* HTTPClient::getStreamPtr(void)
883883
{
884884
if(connected()) {
885885
return _client;
@@ -1164,7 +1164,7 @@ bool HTTPClient::connect(void)
11641164
return false;
11651165
}
11661166

1167-
// set Timeout for WiFiClient and for Stream::readBytesUntil() and Stream::readStringUntil()
1167+
// set Timeout for NetworkClient and for Stream::readBytesUntil() and Stream::readStringUntil()
11681168
_client->setTimeout(_tcpTimeout);
11691169

11701170
log_d(" connected to %s:%u", _host.c_str(), _port);

libraries/HTTPClient/src/HTTPClient.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
#include <memory>
3535
#include <Arduino.h>
36-
#include <WiFiClient.h>
37-
#include <WiFiClientSecure.h>
36+
#include <NetworkClient.h>
37+
#include <NetworkClientSecure.h>
3838

3939
/// Cookie jar support
4040
#include <vector>
@@ -180,8 +180,8 @@ class HTTPClient
180180
* Since both begin() functions take a reference to client as a parameter, you need to
181181
* ensure the client object lives the entire time of the HTTPClient
182182
*/
183-
bool begin(WiFiClient &client, String url);
184-
bool begin(WiFiClient &client, String host, uint16_t port, String uri = "/", bool https = false);
183+
bool begin(NetworkClient &client, String url);
184+
bool begin(NetworkClient &client, String host, uint16_t port, String uri = "/", bool https = false);
185185

186186
#ifdef HTTPCLIENT_1_1_COMPATIBLE
187187
bool begin(String url);
@@ -236,8 +236,8 @@ class HTTPClient
236236
int getSize(void);
237237
const String &getLocation(void);
238238

239-
WiFiClient& getStream(void);
240-
WiFiClient* getStreamPtr(void);
239+
NetworkClient& getStream(void);
240+
NetworkClient* getStreamPtr(void);
241241
int writeToStream(Stream* stream);
242242
String getString(void);
243243

@@ -269,10 +269,10 @@ class HTTPClient
269269

270270
#ifdef HTTPCLIENT_1_1_COMPATIBLE
271271
TransportTraitsPtr _transportTraits;
272-
std::unique_ptr<WiFiClient> _tcpDeprecated;
272+
std::unique_ptr<NetworkClient> _tcpDeprecated;
273273
#endif
274274

275-
WiFiClient* _client = nullptr;
275+
NetworkClient* _client = nullptr;
276276

277277
/// request handling
278278
String _host;

libraries/HTTPUpdate/examples/httpUpdate/httpUpdate.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void loop() {
5656
// wait for WiFi connection
5757
if ((WiFiMulti.run() == WL_CONNECTED)) {
5858

59-
WiFiClient client;
59+
NetworkClient client;
6060

6161
// The line below is optional. It can be used to blink the LED on the board during flashing
6262
// The LED will be on during download of one buffer of data from the network. The LED will

libraries/HTTPUpdate/examples/httpUpdateSPIFFS/httpUpdateSPIFFS.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void loop() {
4141

4242
Serial.println("Update SPIFFS...");
4343

44-
WiFiClient client;
44+
NetworkClient client;
4545

4646
// The line below is optional. It can be used to blink the LED on the board during flashing
4747
// The LED will be on during download of one buffer of data from the network. The LED will

libraries/HTTPUpdate/examples/httpUpdateSecure/httpUpdateSecure.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void loop() {
9292

9393
setClock();
9494

95-
WiFiClientSecure client;
95+
NetworkClientSecure client;
9696
client.setCACert(rootCACertificate);
9797

9898
// Reading data over SSL may be slow, use an adequate timeout

libraries/HTTPUpdate/src/HTTPUpdate.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ HTTPUpdate::~HTTPUpdate(void)
5454
{
5555
}
5656

57-
HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& url, const String& currentVersion, HTTPUpdateRequestCB requestCB)
57+
HTTPUpdateResult HTTPUpdate::update(NetworkClient& client, const String& url, const String& currentVersion, HTTPUpdateRequestCB requestCB)
5858
{
5959
HTTPClient http;
6060
if(!http.begin(client, url))
@@ -69,7 +69,7 @@ HTTPUpdateResult HTTPUpdate::updateSpiffs(HTTPClient& httpClient, const String&
6969
return handleUpdate(httpClient, currentVersion, true, requestCB);
7070
}
7171

72-
HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion, HTTPUpdateRequestCB requestCB)
72+
HTTPUpdateResult HTTPUpdate::updateSpiffs(NetworkClient& client, const String& url, const String& currentVersion, HTTPUpdateRequestCB requestCB)
7373
{
7474
HTTPClient http;
7575
if(!http.begin(client, url))
@@ -85,7 +85,7 @@ HTTPUpdateResult HTTPUpdate::update(HTTPClient& httpClient,
8585
return handleUpdate(httpClient, currentVersion, false, requestCB);
8686
}
8787

88-
HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
88+
HTTPUpdateResult HTTPUpdate::update(NetworkClient& client, const String& host, uint16_t port, const String& uri,
8989
const String& currentVersion, HTTPUpdateRequestCB requestCB)
9090
{
9191
HTTPClient http;
@@ -315,10 +315,10 @@ HTTPUpdateResult HTTPUpdate::handleUpdate(HTTPClient& http, const String& curren
315315
_cbStart();
316316
}
317317

318-
WiFiClient * tcp = http.getStreamPtr();
318+
NetworkClient * tcp = http.getStreamPtr();
319319

320320
// To do? NetworkUDP::stopAll();
321-
// To do? WiFiClient::stopAllExcept(tcp);
321+
// To do? NetworkClient::stopAllExcept(tcp);
322322

323323
delay(100);
324324

libraries/HTTPUpdate/src/HTTPUpdate.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ class HTTPUpdate
9999
_auth = auth;
100100
}
101101

102-
t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
102+
t_httpUpdate_return update(NetworkClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
103103

104-
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
104+
t_httpUpdate_return update(NetworkClient& client, const String& host, uint16_t port, const String& uri = "/",
105105
const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
106106

107-
t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
107+
t_httpUpdate_return updateSpiffs(NetworkClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
108108

109109
t_httpUpdate_return update(HTTPClient& httpClient,
110110
const String& currentVersion = "",

libraries/HTTPUpdateServer/examples/WebUpdater/WebUpdater.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
#include <WiFi.h>
6-
#include <WiFiClient.h>
6+
#include <NetworkClient.h>
77
#include <WebServer.h>
88
#include <ESPmDNS.h>
99
#include <HTTPUpdateServer.h>

0 commit comments

Comments
 (0)