arduino-audio-tools
|
Represents the content of a URL as Stream. We use the WiFi.h API. More...
#include <URLStream.h>
Public Member Functions | |
URLStream (Client &clientPar, int readBufferSize=DEFAULT_BUFFER_SIZE) | |
URLStream (const char *network, const char *password, int readBufferSize=DEFAULT_BUFFER_SIZE) | |
URLStream (const URLStream &)=delete | |
URLStream (int readBufferSize=DEFAULT_BUFFER_SIZE) | |
void | addRequestHeader (const char *header, const char *value) |
Adds/Updates a request header. | |
virtual AudioInfo | audioInfo () override |
virtual int | available () override |
int | availableForWrite () override |
Writes are not supported. | |
virtual bool | begin () |
virtual bool | begin (const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override |
void | clear () |
Releases the memory from the request and reply. | |
int | contentLength () |
virtual void | end () override |
virtual void | flush () override |
virtual HttpRequest & | httpRequest () override |
provides access to the HttpRequest | |
operator bool () | |
virtual int | peek () override |
virtual int | read () override |
virtual size_t | readBytes (uint8_t *buffer, size_t length) override |
virtual size_t | readSilence (uint8_t *buffer, size_t length) |
Source to generate silence: just sets the buffer to 0. | |
virtual void | setAudioInfo (AudioInfo info) override |
void | setAutoCreateLines (bool flag) |
If set to true, new undefined reply parameters will be stored. | |
void | setClient (Client &clientPar) override |
(Re-)defines the client | |
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)) |
virtual void | setNotifyAudioChange (AudioInfoSupport &bi) override |
void | setOnConnectCallback (void(*callback)(HttpRequest &request, Url &url, HttpRequestHeader &request_header)) |
Callback which allows you to add additional paramters dynamically. | |
void | setPassword (const char *password) override |
Sets the password that will be used for logging in (when calling begin) | |
void | setPowerSave (bool ps) |
if set to true, it activates the power save mode which comes at the cost of performance! - By default this is deactivated. ESP32 Only! | |
void | setReadBufferSize (int readBufferSize) |
void | setSSID (const char *ssid) override |
Sets the ssid that will be used for logging in (when calling begin) | |
virtual void | setTimeout (int ms) |
Defines the client timeout. | |
void | setWaitForData (bool flag) |
size_t | totalRead () |
virtual bool | validate (AudioInfo &info) |
virtual bool | waitForData () |
waits for some data - returns false if the request has failed | |
virtual size_t | write (const uint8_t *, size_t) override |
virtual size_t | write (uint8_t) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
void | fillBuffer () |
Client & | getClient (bool isSecure) |
Determines the client. | |
bool | isEOS () |
void | login () |
virtual int | not_supported (int out, const char *msg="") |
int | process (MethodID action, Url &url, const char *reqMime, const char *reqData, int len=-1) |
Process the Http request and handle redirects. | |
void | refillReadBuffer () |
Protected Attributes | |
bool | active = false |
Client * | client =nullptr |
WiFiClient * | clientInsecure =nullptr |
int | clientTimeout = 60000 |
CustomLogLevel | custom_log_level |
unsigned long | handshakeTimeout = 120000 |
AudioInfo | info |
bool | is_power_save = false |
const char * | network =nullptr |
AudioInfoSupport * | p_notify =nullptr |
const char * | password =nullptr |
Vector< uint8_t > | read_buffer {0} |
uint16_t | read_buffer_size =DEFAULT_BUFFER_SIZE |
uint16_t | read_pos |
uint16_t | read_size |
HttpRequest | request |
long | size |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
long | total_read |
Url | url |
StrExt | url_str |
bool | wait_for_data = true |
Represents the content of a URL as Stream. We use the WiFi.h API.