Skip to content

Commit 8ad8822

Browse files
committed
WiFiClient completely removed
1 parent 2a56919 commit 8ad8822

File tree

5 files changed

+13
-27
lines changed

5 files changed

+13
-27
lines changed

examples/Ethernet/ETH_IP101.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#include "Audio.h"
33
#include "ETH.h"
44

5-
#define ETHERNET_IF
6-
75
#ifdef CONFIG_IDF_TARGET_ESP32
86
#define I2S_DOUT 25
97
#define I2S_BCLK 27

examples/Ethernet/ETH_W5500.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "Arduino.h" // >= Arduino V3
22
#include <ETH.h>
33
#include <SPI.h>
4-
#define ETHERNET_IF
54
#include "Audio.h"
65

76
Audio audio;

examples/Ethernet/WT32-ETH01.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define I2S_BCLK 14
1414
#define I2S_LRC 15
1515

16-
#define ETHERNET_IF
1716
#define ETH_PHY_TYPE ETH_PHY_LAN8720
1817
#define ETH_PHY_MDC 23
1918
#define ETH_PHY_MDIO 18

src/Audio.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
audio.cpp
44
55
Created on: Oct 28.2018 */char audioI2SVers[] ="\
6-
Version 3.4.1k ";
7-
/* Updated on: Aug 17.2025
6+
Version 3.4.1l ";
7+
/* Updated on: Aug 18.2025
88
99
Author: Wolle (schreibfaul1)
1010
Audio library for ESP32, ESP32-S3 or ESP32-P4
@@ -365,7 +365,7 @@ void Audio::setDefaults() {
365365
m_hashQueue.shrink_to_fit(); // uint32_t vector
366366
client.stop();
367367
clientsecure.stop();
368-
m_client = static_cast<WiFiClient*>(&client); /* default to *something* so that no NULL deref can happen */
368+
m_client = static_cast<NetworkClient*>(&client); /* default to *something* so that no NULL deref can happen */
369369
ts_parsePacket(0, 0, 0); // reset ts routine
370370
m_lastM3U8host.reset();
371371

@@ -542,7 +542,7 @@ bool Audio::openai_speech(const String& api_key, const String& model, const Stri
542542

543543
bool res = true;
544544
int port = 443;
545-
m_client = static_cast<WiFiClient*>(&clientsecure);
545+
m_client = static_cast<NetworkClientSecure*>(&clientsecure);
546546

547547
uint32_t t = millis();
548548
AUDIO_INFO("Connect to: \"%s\"", host.get());
@@ -702,8 +702,8 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
702702
rqh.append("Accept-Encoding: identity;q=1,*;q=0\r\n");
703703
rqh.append("Connection: keep-alive\r\n\r\n");
704704

705-
if(m_f_ssl) { m_client = static_cast<WiFiClient*>(&clientsecure); if(port == 80) port = 443;}
706-
else { m_client = static_cast<WiFiClient*>(&client); }
705+
if(m_f_ssl) { m_client = static_cast<NetworkClientSecure*>(&clientsecure); if(port == 80) port = 443;}
706+
else { m_client = static_cast<NetworkClient*>(&client); }
707707

708708
timestamp = millis();
709709
m_client->setTimeout(m_f_ssl ? m_timeout_ms_ssl : m_timeout_ms);
@@ -817,8 +817,8 @@ bool Audio::httpPrint(const char* host) {
817817
if(m_client->connected()) m_client->stop();
818818
}
819819
if(!m_client->connected() ) {
820-
if(m_f_ssl) { m_client = static_cast<WiFiClient*>(&clientsecure); if(m_f_ssl && port == 80) port = 443;}
821-
else { m_client = static_cast<WiFiClient*>(&client); }
820+
if(m_f_ssl) { m_client = static_cast<NetworkClientSecure*>(&clientsecure); if(m_f_ssl && port == 80) port = 443;}
821+
else { m_client = static_cast<NetworkClient*>(&client); }
822822
if(f_equal) AUDIO_INFO("The host has disconnected, reconnecting");
823823

824824
if(!m_client->connect(hwoe.get(), port)) {
@@ -909,8 +909,8 @@ bool Audio::httpRange(uint32_t seek, uint32_t length){
909909
rqh.append("User-Agent: VLC/3.0.21 LibVLC/3.0.21 AppleWebKit/537.36 (KHTML, like Gecko)\r\n\r\n");
910910

911911
if(m_client->connected()) {m_client->stop();}
912-
if(m_f_ssl) { m_client = static_cast<WiFiClient*>(&clientsecure); if(m_f_ssl && port == 80) port = 443;}
913-
else { m_client = static_cast<WiFiClient*>(&client); }
912+
if(m_f_ssl) { m_client = static_cast<NetworkClientSecure*>(&clientsecure); if(m_f_ssl && port == 80) port = 443;}
913+
else { m_client = static_cast<NetworkClient*>(&client); }
914914

915915
if(!m_client->connect(hwoe.get(), port)) {
916916
AUDIO_LOG_ERROR("connection lost %s", c_host.c_get());
@@ -999,7 +999,7 @@ bool Audio::connecttospeech(const char* speech, const char* lang) {
999999
req.append("Accept: text/html\r\n");
10001000
req.append("Connection: close\r\n\r\n");
10011001

1002-
m_client = static_cast<WiFiClient*>(&client);
1002+
m_client = static_cast<NetworkClient*>(&client);
10031003
AUDIO_INFO("connect to \"%s\"", host);
10041004
if(!m_client->connect(host, 80)) {
10051005
AUDIO_LOG_ERROR("Connection failed");

src/Audio.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@
2525
#include <codecvt>
2626
#include <locale>
2727
#include <memory>
28-
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)
29-
#include <WiFiClient.h>
30-
#include <WiFiClientSecure.h>
31-
#else
3228
#include <NetworkClient.h>
3329
#include <NetworkClientSecure.h>
34-
#endif // ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)
3530
#include <driver/i2s_std.h>
3631
#include "psram_unique_ptr.hpp"
3732

@@ -847,15 +842,10 @@ class Audio{
847842
} pid_array;
848843

849844
File m_audiofile;
850-
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)
851-
WiFiClient client;
852-
WiFiClientSecure clientsecure;
853-
WiFiClient* m_client = nullptr;
854-
#else
855845
NetworkClient client;
856846
NetworkClientSecure clientsecure;
857-
NetworkClient* m_client = nullptr;
858-
#endif // ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)
847+
NetworkClient* m_client = nullptr;
848+
859849
SemaphoreHandle_t mutex_playAudioData;
860850
SemaphoreHandle_t mutex_audioTask;
861851
TaskHandle_t m_audioTaskHandle = nullptr;

0 commit comments

Comments
 (0)