arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::URLStreamDefault Class Reference

Represents the content of a URL as Stream. We use the WiFi.h API. More...

#include <URLStream.h>

Inheritance diagram for audio_tools::URLStreamDefault:
audio_tools::AbstractURLStream audio_tools::AudioStream audio_tools::Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource audio_tools::Print audio_tools::URLStream

Public Member Functions

 URLStreamDefault (Client &clientPar, int readBufferSize=DEFAULT_BUFFER_SIZE)
 
 URLStreamDefault (const char *network, const char *password, int readBufferSize=DEFAULT_BUFFER_SIZE)
 
 URLStreamDefault (int readBufferSize=DEFAULT_BUFFER_SIZE)
 
virtual int available () override
 
virtual bool begin (const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override
 
virtual void end () override
 
virtual void flush () override
 
virtual HttpRequesthttpRequest () override
 provides access to the HttpRequest More...
 
 operator bool ()
 
virtual int peek () override
 
virtual int read () override
 
virtual size_t readBytes (uint8_t *buffer, size_t length) override
 
void setPowerSave (bool ps)
 if set to true, it activates the power save mode which comes at the cost of porformance! - By default this is deactivated.
 
virtual void setTimeout (int ms)
 Defines the client timeout.
 
virtual size_t write (const uint8_t *, size_t) override
 
virtual size_t write (uint8_t) override
 
- Public Member Functions inherited from audio_tools::AbstractURLStream
int availableForWrite ()
 Writes are not supported. More...
 
virtual bool begin (const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="")=0
 
virtual void end ()=0
 
virtual HttpRequesthttpRequest ()=0
 provides access to the HttpRequest More...
 
virtual bool setMetadataCallback (void(*fn)(MetaDataType info, const char *str, int len))
 
- Public Member Functions inherited from audio_tools::AudioStream
 AudioStream (AudioStream const &)=delete
 
virtual AudioBaseInfo audioInfo () override
 
virtual int availableForWrite () override
 
virtual bool begin ()
 
virtual void end ()
 
virtual void flush () override
 
 operator bool ()
 
AudioStreamoperator= (AudioStream const &)=delete
 
virtual size_t readBytes (char *buffer, size_t length)
 
virtual size_t readBytes (uint8_t *buffer, size_t length) STREAM_WRITE_OVERRIDE=0
 
virtual void setAudioInfo (AudioBaseInfo info) override
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
 
virtual StreamtoStreamPointer ()
 
virtual size_t write (const uint8_t *buffer, size_t size) override=0
 
- Public Member Functions inherited from audio_tools::Stream
virtual int available ()
 
virtual int peek ()
 
virtual int read ()
 
virtual size_t readBytes (uint8_t *buffer, size_t len)
 
virtual void setTimeout (size_t t)
 
- Public Member Functions inherited from audio_tools::Print
virtual int availableForWrite ()
 
virtual void flush ()
 
virtual int print (char c, PrintCharFmt spec)
 
virtual int print (const char *msg)
 
virtual int print (int number)
 
virtual int println (const char *msg="")
 
virtual size_t write (const char *buffer, size_t size)
 
virtual size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t ch)
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
 
virtual void setAudioInfo (AudioBaseInfo info)=0
 
virtual bool validate (AudioBaseInfo &info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Member Functions

void fillBuffer ()
 
ClientgetClient (bool isSecure)
 Determines the client.
 
bool isEOS ()
 
void login ()
 
int process (MethodID action, Url &url, const char *reqMime, const char *reqData, int len=-1)
 Process the Http request and handle redirects.
 
void setTimeouts ()
 
virtual bool waitForData ()
 waits for some data - returns fals if the request has failed
 
- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)
 

Protected Attributes

bool active = false
 
Clientclient =nullptr
 
WiFiClient * clientInsecure =nullptr
 
WiFiClientSecure * clientSecure =nullptr
 
int clientTimeout = URL_CLIENT_TIMEOUT
 
unsigned long handshakeTimeout = URL_HANDSHAKE_TIMEOUT
 
bool is_power_save = false
 
char * network =nullptr
 
char * password =nullptr
 
Vector< uint8_t > read_buffer {0}
 
uint16_t read_buffer_size
 
uint16_t read_pos
 
uint16_t read_size
 
HttpRequest request
 
long size
 
long total_read
 
Url url
 
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
 
AudioBaseInfoDependentp_notify =nullptr
 

Detailed Description

Represents the content of a URL as Stream. We use the WiFi.h API.

Author
Phil Schatzmann

Member Function Documentation

◆ available()

virtual int audio_tools::URLStreamDefault::available ( )
inlineoverridevirtual

Reimplemented from audio_tools::Stream.

◆ begin()

virtual bool audio_tools::URLStreamDefault::begin ( const char *  urlStr,
const char *  acceptMime = nullptr,
MethodID  action = GET,
const char *  reqMime = "",
const char *  reqData = "" 
)
inlineoverridevirtual

◆ end()

virtual void audio_tools::URLStreamDefault::end ( )
inlineoverridevirtual

◆ flush()

virtual void audio_tools::URLStreamDefault::flush ( )
inlineoverridevirtual

Reimplemented from audio_tools::AudioStream.

◆ httpRequest()

virtual HttpRequest & audio_tools::URLStreamDefault::httpRequest ( )
inlineoverridevirtual

provides access to the HttpRequest

Implements audio_tools::AbstractURLStream.

Reimplemented in audio_tools::URLStream.

◆ peek()

virtual int audio_tools::URLStreamDefault::peek ( )
inlineoverridevirtual

Reimplemented from audio_tools::Stream.

◆ read()

virtual int audio_tools::URLStreamDefault::read ( )
inlineoverridevirtual

Reimplemented from audio_tools::Stream.

◆ readBytes()

virtual size_t audio_tools::URLStreamDefault::readBytes ( uint8_t *  buffer,
size_t  length 
)
inlineoverridevirtual

◆ write() [1/2]

virtual size_t audio_tools::URLStreamDefault::write ( const uint8_t *  ,
size_t   
)
inlineoverridevirtual

◆ write() [2/2]

virtual size_t audio_tools::URLStreamDefault::write ( uint8_t  )
inlineoverridevirtual

Reimplemented from audio_tools::Print.


The documentation for this class was generated from the following file: