From b01c056c68ec3a39f422f6b7e44cf0cbb1814907 Mon Sep 17 00:00:00 2001 From: pschatzmann Date: Tue, 5 Nov 2024 14:28:30 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20doxygen=20from=20@=20pschatzma?= =?UTF-8?q?nn/arduino-audio-tools@6b2aca15bedc96ee3a130ae1b58ed76d46b662ee?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _h_l_s_stream_8h_source.html | 4 +- _i_c_y_stream_8h_source.html | 4 +- _u_r_l_stream_8h_source.html | 636 +++++++++--------- _u_r_l_stream_buffered_8h_source.html | 4 +- ...audio__tools_1_1_u_r_l_stream-members.html | 76 +-- classaudio__tools_1_1_u_r_l_stream.html | 7 - functions_func_s.html | 3 +- functions_s.html | 5 +- search/all_13.js | 34 +- search/functions_12.js | 34 +- 10 files changed, 401 insertions(+), 406 deletions(-) diff --git a/_h_l_s_stream_8h_source.html b/_h_l_s_stream_8h_source.html index c17a812e17..539279b370 100644 --- a/_h_l_s_stream_8h_source.html +++ b/_h_l_s_stream_8h_source.html @@ -778,9 +778,9 @@
int available() override
Available bytes of the audio stream.
Definition: HLSStream.h:115
URLLoader which saves the HLS segments to the indicated output.
Definition: HLSStream.h:32
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26
-
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:183
+
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:185
virtual bool begin(const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override
Execute http request: by default we use a GET request.
Definition: URLStream.h:80
-
virtual bool waitForData(int timeout)
waits for some data - returns false if the request has failed
Definition: URLStream.h:231
+
virtual bool waitForData(int timeout)
waits for some data - returns false if the request has failed
Definition: URLStream.h:233
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AudioConfig.h:821
uint32_t millis()
Returns the milliseconds since the start.
Definition: Time.h:12
diff --git a/_i_c_y_stream_8h_source.html b/_i_c_y_stream_8h_source.html index 2d6ea9681e..cfccc5fadd 100644 --- a/_i_c_y_stream_8h_source.html +++ b/_i_c_y_stream_8h_source.html @@ -230,9 +230,9 @@
virtual bool isData()
returns true if the actual bytes is an audio data byte (e.g.mp3)
Definition: MetaDataICY.h:87
virtual void processChar(char ch)
character based state engine
Definition: MetaDataICY.h:102
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26
-
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:183
+
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:185
virtual bool begin(const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override
Execute http request: by default we use a GET request.
Definition: URLStream.h:80
-
void setPowerSave(bool ps)
Definition: URLStream.h:192
+
void setPowerSave(bool ps)
Definition: URLStream.h:194
void setSSID(const char *ssid) override
Sets the ssid that will be used for logging in (when calling begin)
Definition: URLStream.h:70
void setClient(Client &clientPar) override
(Re-)defines the client
Definition: URLStream.h:67
void setPassword(const char *password) override
Sets the password that will be used for logging in (when calling begin)
Definition: URLStream.h:73
diff --git a/_u_r_l_stream_8h_source.html b/_u_r_l_stream_8h_source.html index f79e9450a0..bca43465bd 100644 --- a/_u_r_l_stream_8h_source.html +++ b/_u_r_l_stream_8h_source.html @@ -156,314 +156,321 @@
96  total_read = 0;
97  active = result == 200;
98  LOGI("==> http status: %d", result);
-
99  custom_log_level.reset();
-
100 
-
101  return active;
-
102  }
-
103 
-
105  virtual bool begin(const char* urlStr, const char* acceptMime,
-
106  MethodID action, const char* reqMime, Stream& reqData,
-
107  int len = -1) {
-
108  LOGI("%s: %s", LOG_METHOD, urlStr);
-
109  if (!preProcess(urlStr, acceptMime)) {
-
110  LOGE("preProcess failed");
-
111  return false;
-
112  }
-
113  int result = process<Stream&>(action, url, reqMime, reqData, len);
-
114  if (result > 0) {
-
115  size = request.contentLength();
-
116  LOGI("size: %d", (int)size);
-
117  if (size >= 0 && wait_for_data) {
-
118  waitForData(clientTimeout);
-
119  }
-
120  }
-
121  total_read = 0;
-
122  active = result == 200;
-
123  LOGI("==> http status: %d", result);
-
124  custom_log_level.reset();
-
125 
-
126  return active;
-
127  }
-
128 
-
129  virtual void end() override {
-
130  if (active) request.stop();
-
131  active = false;
-
132  clear();
-
133  }
-
134 
-
135  virtual int available() override {
-
136  if (!active || !request) return 0;
-
137 
-
138  int result = request.available();
-
139  LOGD("available: %d", result);
-
140  return result;
-
141  }
-
142 
-
143  virtual size_t readBytes(uint8_t* data, size_t len) override {
-
144  if (!active || !request) return 0;
-
145 
-
146  int read = request.read((uint8_t*)&data[0], len);
-
147  if (read < 0) {
-
148  read = 0;
-
149  }
-
150  total_read += read;
-
151  LOGD("readBytes %d -> %d", (int)len, read);
-
152  return read;
-
153  }
-
154 
-
155  virtual int read() override {
-
156  if (!active) return -1;
-
157  // lazy allocation since this is rarely used
-
158  read_buffer.resize(read_buffer_size);
-
159 
-
160  fillBuffer();
-
161  total_read++;
-
162  return isEOS() ? -1 : read_buffer[read_pos++];
-
163  }
-
164 
-
165  virtual int peek() override {
-
166  if (!active) return -1;
-
167  // lazy allocation since this is rarely used
-
168  read_buffer.resize(read_buffer_size);
-
169 
-
170  fillBuffer();
-
171  return isEOS() ? -1 : read_buffer[read_pos];
-
172  }
-
173 
-
174  virtual void flush() override {}
+
99 #if USE_AUDIO_LOGGING
+
100  custom_log_level.reset();
+
101 #endif
+
102  return active;
+
103  }
+
104 
+
106  virtual bool begin(const char* urlStr, const char* acceptMime,
+
107  MethodID action, const char* reqMime, Stream& reqData,
+
108  int len = -1) {
+
109  LOGI("%s: %s", LOG_METHOD, urlStr);
+
110  if (!preProcess(urlStr, acceptMime)) {
+
111  LOGE("preProcess failed");
+
112  return false;
+
113  }
+
114  int result = process<Stream&>(action, url, reqMime, reqData, len);
+
115  if (result > 0) {
+
116  size = request.contentLength();
+
117  LOGI("size: %d", (int)size);
+
118  if (size >= 0 && wait_for_data) {
+
119  waitForData(clientTimeout);
+
120  }
+
121  }
+
122  total_read = 0;
+
123  active = result == 200;
+
124  LOGI("==> http status: %d", result);
+
125 #if USE_AUDIO_LOGGING
+
126  custom_log_level.reset();
+
127 #endif
+
128  return active;
+
129  }
+
130 
+
131  virtual void end() override {
+
132  if (active) request.stop();
+
133  active = false;
+
134  clear();
+
135  }
+
136 
+
137  virtual int available() override {
+
138  if (!active || !request) return 0;
+
139 
+
140  int result = request.available();
+
141  LOGD("available: %d", result);
+
142  return result;
+
143  }
+
144 
+
145  virtual size_t readBytes(uint8_t* data, size_t len) override {
+
146  if (!active || !request) return 0;
+
147 
+
148  int read = request.read((uint8_t*)&data[0], len);
+
149  if (read < 0) {
+
150  read = 0;
+
151  }
+
152  total_read += read;
+
153  LOGD("readBytes %d -> %d", (int)len, read);
+
154  return read;
+
155  }
+
156 
+
157  virtual int read() override {
+
158  if (!active) return -1;
+
159  // lazy allocation since this is rarely used
+
160  read_buffer.resize(read_buffer_size);
+
161 
+
162  fillBuffer();
+
163  total_read++;
+
164  return isEOS() ? -1 : read_buffer[read_pos++];
+
165  }
+
166 
+
167  virtual int peek() override {
+
168  if (!active) return -1;
+
169  // lazy allocation since this is rarely used
+
170  read_buffer.resize(read_buffer_size);
+
171 
+
172  fillBuffer();
+
173  return isEOS() ? -1 : read_buffer[read_pos];
+
174  }
175 
-
176  virtual size_t write(uint8_t) override { return not_supported(0); }
+
176  virtual void flush() override {}
177 
-
178  virtual size_t write(const uint8_t*, size_t len) override {
-
179  return not_supported(0);
-
180  }
-
181 
-
183  virtual HttpRequest& httpRequest() override { return request; }
-
184 
-
185  operator bool() { return active && request.isReady(); }
+
178  virtual size_t write(uint8_t) override { return not_supported(0); }
+
179 
+
180  virtual size_t write(const uint8_t*, size_t len) override {
+
181  return not_supported(0);
+
182  }
+
183 
+
185  virtual HttpRequest& httpRequest() override { return request; }
186 
-
188  virtual void setTimeout(int ms) { clientTimeout = ms; }
-
189 
-
192  void setPowerSave(bool ps) { is_power_save = ps; }
-
193 
-
195  void setAutoCreateLines(bool flag) {
-
196  httpRequest().reply().setAutoCreateLines(flag);
-
197  }
-
198 
-
200  void setConnectionClose(bool close) {
-
201  httpRequest().setConnection(close ? CON_CLOSE : CON_KEEP_ALIVE);
-
202  }
-
203 
-
205  void clear() {
-
206  httpRequest().reply().clear();
-
207  httpRequest().header().clear();
-
208  read_buffer.resize(0);
-
209  read_pos = 0;
-
210  read_size = 0;
-
211  }
-
212 
-
214  void addRequestHeader(const char* header, const char* value) {
-
215  request.header().put(header, value);
-
216  }
-
217 
-
219  void setOnConnectCallback(void (*callback)(
-
220  HttpRequest& request, Url& url, HttpRequestHeader& request_header)) {
-
221  request.setOnConnectCallback(callback);
-
222  }
-
223 
-
224  void setWaitForData(bool flag) { wait_for_data = flag; }
+
187  operator bool() { return active && request.isReady(); }
+
188 
+
190  virtual void setTimeout(int ms) { clientTimeout = ms; }
+
191 
+
194  void setPowerSave(bool ps) { is_power_save = ps; }
+
195 
+
197  void setAutoCreateLines(bool flag) {
+
198  httpRequest().reply().setAutoCreateLines(flag);
+
199  }
+
200 
+
202  void setConnectionClose(bool close) {
+
203  httpRequest().setConnection(close ? CON_CLOSE : CON_KEEP_ALIVE);
+
204  }
+
205 
+
207  void clear() {
+
208  httpRequest().reply().clear();
+
209  httpRequest().header().clear();
+
210  read_buffer.resize(0);
+
211  read_pos = 0;
+
212  read_size = 0;
+
213  }
+
214 
+
216  void addRequestHeader(const char* header, const char* value) {
+
217  request.header().put(header, value);
+
218  }
+
219 
+
221  void setOnConnectCallback(void (*callback)(
+
222  HttpRequest& request, Url& url, HttpRequestHeader& request_header)) {
+
223  request.setOnConnectCallback(callback);
+
224  }
225 
-
226  int contentLength() { return size; }
+
226  void setWaitForData(bool flag) { wait_for_data = flag; }
227 
-
228  size_t totalRead() { return total_read; }
+
228  int contentLength() { return size; }
229 
-
231  virtual bool waitForData(int timeout) {
-
232  TRACED();
-
233  uint32_t end = millis() + timeout;
-
234  if (request.available() == 0) {
-
235  LOGI("Request written ... waiting for reply");
-
236  while (request.available() == 0) {
-
237  if (millis() > end) break;
-
238  // stop waiting if we got an error
-
239  if (request.reply().statusCode() >= 300) {
-
240  LOGE("Error code recieved ... stop waiting for reply");
-
241  break;
-
242  }
-
243  delay(500);
-
244  }
-
245  }
-
246  LOGD("available: %d", request.available());
-
247  return request.available() > 0;
-
248  }
-
249 
-
251  void setLogLevel(AudioLogger::LogLevel level) { custom_log_level.set(level); }
-
252 
-
253  const char* urlStr() { return url_str.c_str(); }
-
254 
-
255  protected:
-
256  HttpRequest request;
-
257  CustomLogLevel custom_log_level;
-
258  Str url_str;
-
259  Url url;
-
260  long size;
-
261  long total_read;
-
262  // buffered single byte read
-
263  Vector<uint8_t> read_buffer{0};
-
264  uint16_t read_buffer_size = DEFAULT_BUFFER_SIZE;
-
265  uint16_t read_pos;
-
266  uint16_t read_size;
-
267  bool active = false;
-
268  bool wait_for_data = true;
-
269  // optional
-
270  const char* network = nullptr;
-
271  const char* password = nullptr;
-
272  Client* client = nullptr; // client defined via setClient
-
273 #ifdef USE_WIFI
-
274  WiFiClient* clientInsecure = nullptr; // wifi client for http
-
275 #endif
-
276 #ifdef USE_WIFI_CLIENT_SECURE
-
277  WiFiClientSecure* clientSecure = nullptr; // wifi client for https
-
278 #endif
-
279  int clientTimeout = URL_CLIENT_TIMEOUT; // 60000;
-
280  unsigned long handshakeTimeout = URL_HANDSHAKE_TIMEOUT; // 120000
-
281  bool is_power_save = false;
-
282 
-
283  bool preProcess(const char* urlStr, const char* acceptMime) {
-
284  TRACED();
-
285  custom_log_level.set();
-
286  url_str = urlStr;
-
287  url.setUrl(url_str.c_str());
-
288  int result = -1;
-
289 
-
290  // close it - if we have an active connection
-
291  if (active) end();
-
292 
-
293 #ifdef USE_WIFI
-
294  // optional: login if necessary if no external client is defined
-
295  if (client == nullptr){
-
296  if (!login()){
-
297  LOGE("Not connected");
-
298  return false;
-
299  }
-
300  }
-
301 
-
302 #endif
-
303  // request.reply().setAutoCreateLines(false);
-
304  if (acceptMime != nullptr) {
-
305  request.setAcceptMime(acceptMime);
-
306  }
-
307 
-
308  // setup client
-
309  Client& client = getClient(url.isSecure());
-
310  request.setClient(client);
-
311 
-
312  // set timeout
-
313  client.setTimeout(clientTimeout / 1000);
-
314  request.setTimeout(clientTimeout);
-
315 
-
316 #ifdef ESP32
-
317  // There is a bug in IDF 4!
-
318  if (clientSecure != nullptr) {
-
319  clientSecure->setHandshakeTimeout(handshakeTimeout);
-
320  }
-
321 
-
322  // Performance optimization for ESP32
-
323  if (!is_power_save) {
-
324  esp_wifi_set_ps(WIFI_PS_NONE);
-
325  }
-
326 #endif
-
327  return true;
-
328  }
-
329 
-
331  template <typename T>
-
332  int process(MethodID action, Url& url, const char* reqMime, T reqData,
-
333  int len = -1) {
-
334  TRACED();
-
335  // keep icy across redirect requests ?
-
336  const char* icy = request.header().get("Icy-MetaData");
-
337 
-
338  int status_code = request.process(action, url, reqMime, reqData, len);
-
339  // redirect
-
340  while (request.reply().isRedirectStatus()) {
-
341  const char* redirect_url = request.reply().get(LOCATION);
-
342  if (redirect_url != nullptr) {
-
343  LOGW("Redirected to: %s", redirect_url);
-
344  url.setUrl(redirect_url);
-
345  Client* p_client = &getClient(url.isSecure());
-
346  p_client->stop();
-
347  request.setClient(*p_client);
-
348  if (icy) {
-
349  request.header().put("Icy-MetaData", icy);
-
350  }
-
351  status_code = request.process(action, url, reqMime, reqData, len);
-
352  } else {
-
353  LOGE("Location is null");
-
354  break;
-
355  }
-
356  }
-
357  return status_code;
-
358  }
-
359 
-
361  Client& getClient(bool isSecure) {
-
362 #ifdef USE_WIFI_CLIENT_SECURE
-
363  if (isSecure) {
-
364  if (clientSecure == nullptr) {
-
365  clientSecure = new WiFiClientSecure();
-
366  clientSecure->setInsecure();
-
367  }
-
368  LOGI("WiFiClientSecure");
-
369  return *clientSecure;
-
370  }
-
371 #endif
-
372 #ifdef USE_WIFI
-
373  if (clientInsecure == nullptr) {
-
374  clientInsecure = new WiFiClient();
-
375  LOGI("WiFiClient");
-
376  }
-
377  return *clientInsecure;
-
378 #else
-
379  if (client == nullptr){
-
380  LOGE("Client not set");
-
381  stop();
-
382  }
-
383  return *client; // to avoid compiler warning
-
384 #endif
-
385  }
-
386 
-
387  inline void fillBuffer() {
-
388  if (isEOS()) {
-
389  // if we consumed all bytes we refill the buffer
-
390  read_size = readBytes(&read_buffer[0], read_buffer_size);
-
391  read_pos = 0;
-
392  }
-
393  }
-
394 
-
395  inline bool isEOS() { return read_pos >= read_size; }
-
396 
-
397  bool login() {
-
398 #ifdef USE_WIFI
-
399  if (network != nullptr && password != nullptr &&
-
400  WiFi.status() != WL_CONNECTED) {
-
401  TRACEI();
-
402  WiFi.begin(network, password);
-
403  while (WiFi.status() != WL_CONNECTED) {
-
404  Serial.print(".");
-
405  delay(500);
-
406  }
-
407  Serial.println();
-
408  delay(10);
-
409  return WiFi.status() == WL_CONNECTED;
-
410  }
-
411  return WiFi.status() == WL_CONNECTED;
-
412 #else
-
413  return false;
-
414 #endif
-
415  }
-
416 };
-
417 
-
418 } // namespace audio_tools
-
419 
-
420 #endif
+
230  size_t totalRead() { return total_read; }
+
231 
+
233  virtual bool waitForData(int timeout) {
+
234  TRACED();
+
235  uint32_t end = millis() + timeout;
+
236  if (request.available() == 0) {
+
237  LOGI("Request written ... waiting for reply");
+
238  while (request.available() == 0) {
+
239  if (millis() > end) break;
+
240  // stop waiting if we got an error
+
241  if (request.reply().statusCode() >= 300) {
+
242  LOGE("Error code recieved ... stop waiting for reply");
+
243  break;
+
244  }
+
245  delay(500);
+
246  }
+
247  }
+
248  LOGD("available: %d", request.available());
+
249  return request.available() > 0;
+
250  }
+
251 
+
252 #if USE_AUDIO_LOGGING
+
254  void setLogLevel(AudioLogger::LogLevel level) { custom_log_level.set(level); }
+
255 #endif
+
256  const char* urlStr() { return url_str.c_str(); }
+
257 
+
258  protected:
+
259  HttpRequest request;
+
260 #if USE_AUDIO_LOGGING
+
261  CustomLogLevel custom_log_level;
+
262 #endif
+
263  Str url_str;
+
264  Url url;
+
265  long size;
+
266  long total_read;
+
267  // buffered single byte read
+
268  Vector<uint8_t> read_buffer{0};
+
269  uint16_t read_buffer_size = DEFAULT_BUFFER_SIZE;
+
270  uint16_t read_pos;
+
271  uint16_t read_size;
+
272  bool active = false;
+
273  bool wait_for_data = true;
+
274  // optional
+
275  const char* network = nullptr;
+
276  const char* password = nullptr;
+
277  Client* client = nullptr; // client defined via setClient
+
278 #ifdef USE_WIFI
+
279  WiFiClient* clientInsecure = nullptr; // wifi client for http
+
280 #endif
+
281 #ifdef USE_WIFI_CLIENT_SECURE
+
282  WiFiClientSecure* clientSecure = nullptr; // wifi client for https
+
283 #endif
+
284  int clientTimeout = URL_CLIENT_TIMEOUT; // 60000;
+
285  unsigned long handshakeTimeout = URL_HANDSHAKE_TIMEOUT; // 120000
+
286  bool is_power_save = false;
+
287 
+
288  bool preProcess(const char* urlStr, const char* acceptMime) {
+
289  TRACED();
+
290 #if USE_AUDIO_LOGGING
+
291  custom_log_level.set();
+
292 #endif
+
293  url_str = urlStr;
+
294  url.setUrl(url_str.c_str());
+
295  int result = -1;
+
296 
+
297  // close it - if we have an active connection
+
298  if (active) end();
+
299 
+
300 #ifdef USE_WIFI
+
301  // optional: login if necessary if no external client is defined
+
302  if (client == nullptr){
+
303  if (!login()){
+
304  LOGE("Not connected");
+
305  return false;
+
306  }
+
307  }
+
308 
+
309 #endif
+
310  // request.reply().setAutoCreateLines(false);
+
311  if (acceptMime != nullptr) {
+
312  request.setAcceptMime(acceptMime);
+
313  }
+
314 
+
315  // setup client
+
316  Client& client = getClient(url.isSecure());
+
317  request.setClient(client);
+
318 
+
319  // set timeout
+
320  client.setTimeout(clientTimeout / 1000);
+
321  request.setTimeout(clientTimeout);
+
322 
+
323 #ifdef ESP32
+
324  // There is a bug in IDF 4!
+
325  if (clientSecure != nullptr) {
+
326  clientSecure->setHandshakeTimeout(handshakeTimeout);
+
327  }
+
328 
+
329  // Performance optimization for ESP32
+
330  if (!is_power_save) {
+
331  esp_wifi_set_ps(WIFI_PS_NONE);
+
332  }
+
333 #endif
+
334  return true;
+
335  }
+
336 
+
338  template <typename T>
+
339  int process(MethodID action, Url& url, const char* reqMime, T reqData,
+
340  int len = -1) {
+
341  TRACED();
+
342  // keep icy across redirect requests ?
+
343  const char* icy = request.header().get("Icy-MetaData");
+
344 
+
345  int status_code = request.process(action, url, reqMime, reqData, len);
+
346  // redirect
+
347  while (request.reply().isRedirectStatus()) {
+
348  const char* redirect_url = request.reply().get(LOCATION);
+
349  if (redirect_url != nullptr) {
+
350  LOGW("Redirected to: %s", redirect_url);
+
351  url.setUrl(redirect_url);
+
352  Client* p_client = &getClient(url.isSecure());
+
353  p_client->stop();
+
354  request.setClient(*p_client);
+
355  if (icy) {
+
356  request.header().put("Icy-MetaData", icy);
+
357  }
+
358  status_code = request.process(action, url, reqMime, reqData, len);
+
359  } else {
+
360  LOGE("Location is null");
+
361  break;
+
362  }
+
363  }
+
364  return status_code;
+
365  }
+
366 
+
368  Client& getClient(bool isSecure) {
+
369 #ifdef USE_WIFI_CLIENT_SECURE
+
370  if (isSecure) {
+
371  if (clientSecure == nullptr) {
+
372  clientSecure = new WiFiClientSecure();
+
373  clientSecure->setInsecure();
+
374  }
+
375  LOGI("WiFiClientSecure");
+
376  return *clientSecure;
+
377  }
+
378 #endif
+
379 #ifdef USE_WIFI
+
380  if (clientInsecure == nullptr) {
+
381  clientInsecure = new WiFiClient();
+
382  LOGI("WiFiClient");
+
383  }
+
384  return *clientInsecure;
+
385 #else
+
386  if (client == nullptr){
+
387  LOGE("Client not set");
+
388  stop();
+
389  }
+
390  return *client; // to avoid compiler warning
+
391 #endif
+
392  }
+
393 
+
394  inline void fillBuffer() {
+
395  if (isEOS()) {
+
396  // if we consumed all bytes we refill the buffer
+
397  read_size = readBytes(&read_buffer[0], read_buffer_size);
+
398  read_pos = 0;
+
399  }
+
400  }
+
401 
+
402  inline bool isEOS() { return read_pos >= read_size; }
+
403 
+
404  bool login() {
+
405 #ifdef USE_WIFI
+
406  if (network != nullptr && password != nullptr &&
+
407  WiFi.status() != WL_CONNECTED) {
+
408  TRACEI();
+
409  WiFi.begin(network, password);
+
410  while (WiFi.status() != WL_CONNECTED) {
+
411  Serial.print(".");
+
412  delay(500);
+
413  }
+
414  Serial.println();
+
415  delay(10);
+
416  return WiFi.status() == WL_CONNECTED;
+
417  }
+
418  return WiFi.status() == WL_CONNECTED;
+
419 #else
+
420  return false;
+
421 #endif
+
422  }
+
423 };
+
424 
+
425 } // namespace audio_tools
+
426 
+
427 #endif
Abstract Base class for all URLStream implementations.
Definition: AbstractURLStream.h:11
Definition: NoArduino.h:139
void setAutoCreateLines(bool is_auto_line)
automatically create new lines
Definition: HttpHeader.h:294
@@ -476,22 +483,21 @@
virtual const char * c_str()
provides the string value as const char*
Definition: StrView.h:379
Definition: NoArduino.h:125
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26
-
void setLogLevel(AudioLogger::LogLevel level)
Defines the class specific custom log level.
Definition: URLStream.h:251
-
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:183
+
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:185
virtual bool begin(const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override
Execute http request: by default we use a GET request.
Definition: URLStream.h:80
-
virtual void setTimeout(int ms)
Defines the client timeout.
Definition: URLStream.h:188
-
void setPowerSave(bool ps)
Definition: URLStream.h:192
-
Client & getClient(bool isSecure)
Determines the client.
Definition: URLStream.h:361
-
int process(MethodID action, Url &url, const char *reqMime, T reqData, int len=-1)
Process the Http request and handle redirects.
Definition: URLStream.h:332
+
virtual void setTimeout(int ms)
Defines the client timeout.
Definition: URLStream.h:190
+
void setPowerSave(bool ps)
Definition: URLStream.h:194
+
Client & getClient(bool isSecure)
Determines the client.
Definition: URLStream.h:368
+
int process(MethodID action, Url &url, const char *reqMime, T reqData, int len=-1)
Process the Http request and handle redirects.
Definition: URLStream.h:339
void setSSID(const char *ssid) override
Sets the ssid that will be used for logging in (when calling begin)
Definition: URLStream.h:70
-
virtual bool begin(const char *urlStr, const char *acceptMime, MethodID action, const char *reqMime, Stream &reqData, int len=-1)
Execute e.g. http POST request which submits the content as a stream.
Definition: URLStream.h:105
-
virtual bool waitForData(int timeout)
waits for some data - returns false if the request has failed
Definition: URLStream.h:231
+
virtual bool begin(const char *urlStr, const char *acceptMime, MethodID action, const char *reqMime, Stream &reqData, int len=-1)
Execute e.g. http POST request which submits the content as a stream.
Definition: URLStream.h:106
+
virtual bool waitForData(int timeout)
waits for some data - returns false if the request has failed
Definition: URLStream.h:233
void setClient(Client &clientPar) override
(Re-)defines the client
Definition: URLStream.h:67
-
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: URLStream.h:219
-
void clear()
Releases the memory from the request and reply.
Definition: URLStream.h:205
-
void setAutoCreateLines(bool flag)
If set to true, new undefined reply parameters will be stored.
Definition: URLStream.h:195
-
void addRequestHeader(const char *header, const char *value)
Adds/Updates a request header.
Definition: URLStream.h:214
-
void setConnectionClose(bool close)
Sets if the connection should be close automatically.
Definition: URLStream.h:200
+
void setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))
Callback which allows you to add additional paramters dynamically.
Definition: URLStream.h:221
+
void clear()
Releases the memory from the request and reply.
Definition: URLStream.h:207
+
void setAutoCreateLines(bool flag)
If set to true, new undefined reply parameters will be stored.
Definition: URLStream.h:197
+
void addRequestHeader(const char *header, const char *value)
Adds/Updates a request header.
Definition: URLStream.h:216
+
void setConnectionClose(bool close)
Sets if the connection should be close automatically.
Definition: URLStream.h:202
void setPassword(const char *password) override
Sets the password that will be used for logging in (when calling begin)
Definition: URLStream.h:73
URL parser which breaks a full url string up into its individual parts.
Definition: Url.h:22
void stop()
Public generic methods.
Definition: AudioRuntime.h:27
diff --git a/_u_r_l_stream_buffered_8h_source.html b/_u_r_l_stream_buffered_8h_source.html index f6baebd5f1..2bccf216bd 100644 --- a/_u_r_l_stream_buffered_8h_source.html +++ b/_u_r_l_stream_buffered_8h_source.html @@ -310,9 +310,9 @@
void setPassword(const char *password) override
Sets the password that will be used for logging in (when calling begin)
Definition: URLStreamBuffered.h:226
HttpRequest & httpRequest()
provides access to the HttpRequest
Definition: URLStreamBuffered.h:217
Represents the content of a URL as Stream. We use the WiFi.h API.
Definition: URLStream.h:26
-
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:183
+
virtual HttpRequest & httpRequest() override
provides access to the HttpRequest
Definition: URLStream.h:185
virtual bool begin(const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override
Execute http request: by default we use a GET request.
Definition: URLStream.h:80
-
void setPowerSave(bool ps)
Definition: URLStream.h:192
+
void setPowerSave(bool ps)
Definition: URLStream.h:194
void setSSID(const char *ssid) override
Sets the ssid that will be used for logging in (when calling begin)
Definition: URLStream.h:70
void setClient(Client &clientPar) override
(Re-)defines the client
Definition: URLStream.h:67
void setPassword(const char *password) override
Sets the password that will be used for logging in (when calling begin)
Definition: URLStream.h:73
diff --git a/classaudio__tools_1_1_u_r_l_stream-members.html b/classaudio__tools_1_1_u_r_l_stream-members.html index 954e4089f9..d63ddf2912 100644 --- a/classaudio__tools_1_1_u_r_l_stream-members.html +++ b/classaudio__tools_1_1_u_r_l_stream-members.html @@ -92,45 +92,43 @@ client (defined in URLStream)URLStreamprotected clientTimeout (defined in URLStream)URLStreamprotected contentLength() (defined in URLStream)URLStreaminline - custom_log_level (defined in URLStream)URLStreamprotected - end() override (defined in URLStream)URLStreaminlinevirtual - fillBuffer() (defined in URLStream)URLStreaminlineprotected - flush() override (defined in URLStream)URLStreaminlinevirtual - getClient(bool isSecure)URLStreaminlineprotected - handshakeTimeout (defined in URLStream)URLStreamprotected - httpRequest() overrideURLStreaminlinevirtual - info (defined in AudioStream)AudioStreamprotected - is_notify_active (defined in AudioInfoSource)AudioInfoSourceprotected - is_power_save (defined in URLStream)URLStreamprotected - isEOS() (defined in URLStream)URLStreaminlineprotected - isNotifyActive()AudioInfoSourceinline - login() (defined in URLStream)URLStreaminlineprotected - network (defined in URLStream)URLStreamprotected - not_supported(int out, const char *msg="") (defined in AudioStream)AudioStreaminlineprotectedvirtual - notify_vector (defined in AudioInfoSource)AudioInfoSourceprotected - notifyAudioChange(AudioInfo info) (defined in AudioInfoSource)AudioInfoSourceinlineprotected - operator bool() (defined in URLStream)URLStreaminlinevirtual - operator=(AudioStream const &)=delete (defined in AudioStream)AudioStream - operator=(BaseStream const &)=delete (defined in BaseStream)BaseStream - password (defined in URLStream)URLStreamprotected - peek() override (defined in URLStream)URLStreaminlinevirtual - preProcess(const char *urlStr, const char *acceptMime) (defined in URLStream)URLStreaminlineprotected - process(MethodID action, Url &url, const char *reqMime, T reqData, int len=-1)URLStreaminlineprotected - read() override (defined in URLStream)URLStreaminlinevirtual - read_buffer (defined in URLStream)URLStreamprotected - read_buffer_size (defined in URLStream)URLStreamprotected - read_pos (defined in URLStream)URLStreamprotected - read_size (defined in URLStream)URLStreamprotected - readBytes(uint8_t *data, size_t len) override (defined in URLStream)URLStreaminlinevirtual - readSilence(uint8_t *buffer, size_t length)AudioStreaminlinevirtual - refillReadBuffer() (defined in BaseStream)BaseStreaminlineprotected - removeNotifyAudioChange(AudioInfoSupport &bi)AudioInfoSourceinlinevirtual - request (defined in URLStream)URLStreamprotected - setAudioInfo(AudioInfo newInfo) overrideAudioStreaminlinevirtual - setAutoCreateLines(bool flag)URLStreaminline - setClient(Client &clientPar) overrideURLStreaminlinevirtual - setConnectionClose(bool close)URLStreaminline - setLogLevel(AudioLogger::LogLevel level)URLStreaminline + end() override (defined in URLStream)URLStreaminlinevirtual + fillBuffer() (defined in URLStream)URLStreaminlineprotected + flush() override (defined in URLStream)URLStreaminlinevirtual + getClient(bool isSecure)URLStreaminlineprotected + handshakeTimeout (defined in URLStream)URLStreamprotected + httpRequest() overrideURLStreaminlinevirtual + info (defined in AudioStream)AudioStreamprotected + is_notify_active (defined in AudioInfoSource)AudioInfoSourceprotected + is_power_save (defined in URLStream)URLStreamprotected + isEOS() (defined in URLStream)URLStreaminlineprotected + isNotifyActive()AudioInfoSourceinline + login() (defined in URLStream)URLStreaminlineprotected + network (defined in URLStream)URLStreamprotected + not_supported(int out, const char *msg="") (defined in AudioStream)AudioStreaminlineprotectedvirtual + notify_vector (defined in AudioInfoSource)AudioInfoSourceprotected + notifyAudioChange(AudioInfo info) (defined in AudioInfoSource)AudioInfoSourceinlineprotected + operator bool() (defined in URLStream)URLStreaminlinevirtual + operator=(AudioStream const &)=delete (defined in AudioStream)AudioStream + operator=(BaseStream const &)=delete (defined in BaseStream)BaseStream + password (defined in URLStream)URLStreamprotected + peek() override (defined in URLStream)URLStreaminlinevirtual + preProcess(const char *urlStr, const char *acceptMime) (defined in URLStream)URLStreaminlineprotected + process(MethodID action, Url &url, const char *reqMime, T reqData, int len=-1)URLStreaminlineprotected + read() override (defined in URLStream)URLStreaminlinevirtual + read_buffer (defined in URLStream)URLStreamprotected + read_buffer_size (defined in URLStream)URLStreamprotected + read_pos (defined in URLStream)URLStreamprotected + read_size (defined in URLStream)URLStreamprotected + readBytes(uint8_t *data, size_t len) override (defined in URLStream)URLStreaminlinevirtual + readSilence(uint8_t *buffer, size_t length)AudioStreaminlinevirtual + refillReadBuffer() (defined in BaseStream)BaseStreaminlineprotected + removeNotifyAudioChange(AudioInfoSupport &bi)AudioInfoSourceinlinevirtual + request (defined in URLStream)URLStreamprotected + setAudioInfo(AudioInfo newInfo) overrideAudioStreaminlinevirtual + setAutoCreateLines(bool flag)URLStreaminline + setClient(Client &clientPar) overrideURLStreaminlinevirtual + setConnectionClose(bool close)URLStreaminline setMetadataCallback(void(*fn)(MetaDataType info, const char *str, int len)) (defined in AbstractURLStream)AbstractURLStreaminlinevirtual setNotifyActive(bool flag)AudioInfoSourceinline setOnConnectCallback(void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header))URLStreaminline diff --git a/classaudio__tools_1_1_u_r_l_stream.html b/classaudio__tools_1_1_u_r_l_stream.html index a93773b0c5..e9228ce0d5 100644 --- a/classaudio__tools_1_1_u_r_l_stream.html +++ b/classaudio__tools_1_1_u_r_l_stream.html @@ -204,10 +204,6 @@ void setConnectionClose (bool close)  Sets if the connection should be close automatically.
  - -void setLogLevel (AudioLogger::LogLevel level) - Defines the class specific custom log level.
virtual bool setMetadataCallback (void(*fn)(MetaDataType info, const char *str, int len))   @@ -307,9 +303,6 @@ int clientTimeout = URL_CLIENT_TIMEOUT   - -CustomLogLevel custom_log_level unsigned long handshakeTimeout = URL_HANDSHAKE_TIMEOUT   diff --git a/functions_func_s.html b/functions_func_s.html index 287253e95b..7829ccc661 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -279,7 +279,7 @@

- s -