5 #include "AudioTools/CoreAudio/BaseStream.h"
6 #include "AudioTools/CoreAudio/Buffers.h"
31 setPassword(password);
41 void setUDP(UDP &udp) { p_udp = &udp; };
52 int size = p_udp->available();
55 size = p_udp->parsePacket();
61 bool begin(IPAddress a, uint16_t port) {
63 remote_address_ext = a;
64 remote_port_ext = port;
65 return p_udp->begin(port);
69 bool begin(uint16_t port, uint16_t port_ext = 0) {
71 remote_address_ext = IPAddress((uint32_t)0);
72 remote_port_ext = port_ext != 0 ? port_ext : port;
73 return p_udp->begin(port);
79 return p_udp->beginMulticast(address,port);
84 uint16_t result = p_udp->remotePort();
85 return result != 0 ? result : remote_port_ext;
91 if ((uint32_t)remote_address_ext == 0) {
92 remote_address_ext = p_udp->remoteIP();
96 return remote_address_ext;
100 size_t write(
const uint8_t *data,
size_t len)
override {
103 size_t result = p_udp->write(data, len);
112 size_t bytes_read = 0;
115 bytes_read = p_udp->readBytes((uint8_t *)data, len);
120 void setSSID(
const char *ssid) { this->ssid = ssid; }
122 void setPassword(
const char *pwd) { this->password = pwd; }
126 UDP *p_udp = &default_udp;
127 uint16_t remote_port_ext;
128 IPAddress remote_address_ext;
129 const char *ssid =
nullptr;
130 const char *password =
nullptr;
134 if (WiFi.status() != WL_CONNECTED && ssid !=
nullptr &&
135 password !=
nullptr) {
136 WiFi.begin(ssid, password);
137 while (WiFi.status() != WL_CONNECTED) {
142 if (WiFi.status() == WL_CONNECTED) {
145 esp_wifi_set_ps(WIFI_PS_NONE);