arduino-audio-tools
|
URLStream using the ESP32 IDF API. More...
#include <URLStreamESP32.h>
Public Member Functions | |
URLStreamESP32 (const char *ssid, const char *pwd) | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
void | addRequestHeader (const char *key, const char *value) override |
Adds/Updates a request header. | |
virtual AudioInfo | audioInfo () override |
provides the actual input AudioInfo | |
virtual AudioInfo | audioInfoOut () |
virtual int | available () override |
int | availableForWrite () override |
Writes are not supported. | |
virtual bool | begin () |
virtual bool | begin (const char *urlStr, const char *acceptMime="", MethodID action=GET, const char *reqMime="", const char *reqData="") |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
int | contentLength () override |
Provides the reported data size from the http reply. | |
virtual void | end () override |
virtual void | flush () override |
const char * | getReplyHeader (const char *key) override |
Provides a header entry. | |
HttpRequest & | httpRequest () override |
Used for request and reply header parameters. | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
virtual | operator bool () |
size_t | readBytes (uint8_t *data, size_t len) override |
virtual size_t | readSilence (uint8_t *buffer, size_t length) |
Source to generate silence: just sets the buffer to 0. | |
virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
virtual void | setAudioInfo (AudioInfo newInfo) override |
Defines the input AudioInfo. | |
void | setCACert (const char *cert) override |
void | setCACert (esp_err_t(*cb)(void *conf)) |
void | setClient (Client &client) override |
Does nothing. | |
void | setConnectionClose (bool flag) override |
Not used. | |
virtual bool | setMetadataCallback (void(*fn)(MetaDataType info, const char *str, int len)) |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
virtual void | setPassword (const char *password) |
Sets the password that will be used for logging in (when calling begin) | |
virtual void | setPowerSave (bool ps) |
Sets the power save mode (default false)! | |
void | setReadBufferSize (int size) |
Defines the read buffer size. | |
virtual void | setSSID (const char *ssid) |
Sets the ssid that will be used for logging in (when calling begin) | |
size_t | totalRead () override |
Total amout of data that was consumed so far. | |
const char * | urlStr () override |
Provides the url as string. | |
virtual bool | waitForData (int timeout) override |
Not used. | |
size_t | write (const uint8_t *data, size_t len) override |
virtual size_t | write (uint8_t ch) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
void | setCACert (const uint8_t *cert, int len) |
Static Protected Member Functions | |
static esp_err_t | http_event_handler (esp_http_client_event_t *evt) |
Protected Attributes | |
int | _timeout = 10 |
int | buffer_size = DEFAULT_BUFFER_SIZE |
esp_http_client_handle_t | client_handle = nullptr |
int | content_length = 0 |
esp_err_t(* | crt_bundle_attach )(void *conf) = nullptr |
int | id = 0 |
AudioInfo | info |
bool | is_notify_active = true |
bool | is_power_save = false |
Vector< AudioInfoSupport * > | notify_vector |
const char * | password = nullptr |
const uint8_t * | pem_cert = nullptr |
int | pem_cert_len = 0 |
HttpRequest | request |
const char * | ssid = nullptr |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
size_t | total_read = 0 |
const char * | url_str = nullptr |
URLStream using the ESP32 IDF API.
For Https you need to provide the certificate. Execute: openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null
To completely disable the certificate check, you will need to go to ESP-TLS in menuconfig, enable "Allow potentially insecure options" and then enable "Skip server certificate verification by default" (accepting risks).
This is unfortunately not an option when using Arduino!
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, MP3DecoderMAD, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtual |
Adds/Updates a request header.
Implements AbstractURLStream.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtualinherited |
Reimplemented from Stream.
Reimplemented in AudioKitStream, A2DPStream, AudioFFTBase, HLSStreamT< URLStream >, I2SCodecStream, TfLiteAudioStream, UDPStream, ICYStreamT< T >, BufferedTaskStream, I2SStream, TimedStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, ConverterStream< T >, InputMerge< T >, Pipeline::ModifyingStreamAdapter, and VolumeStream.
|
inlineoverridevirtual |
Writes are not supported.
Reimplemented from AbstractURLStream.
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, HLSStreamT< URLStream >, SPDIFOutput, VS1053Stream, WM8960Stream, ESPNowStream, TimerCallbackAudioStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, AudioFFTBase, AnalogAudioArduino, AnalogAudioStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, FormatConverterStream, and Pipeline.
|
inlinevirtual |
Implements AbstractURLStream.
|
inlineoverridevirtual |
Provides the reported data size from the http reply.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Implements AbstractURLStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.
|
inlineoverridevirtual |
Provides a header entry.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Used for request and reply header parameters.
Implements AbstractURLStream.
|
inlinevirtualinherited |
Reimplemented in A2DPStream, Pipeline, I2SStream, and MemoryStream.
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in VS1053Stream, WM8960Stream, I2SBitBang, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, VolumeStream, MiniAudioStream, PortAudioStream, I2SCodecStream, MozziStream, SPDIFOutput, AudioLoRa, AnalogAudioStream, I2SStream, MeasuringStream, VolumeMeter, TimerCallbackAudioStream, AudioBLEStream, LoRaStream, AudioFFTBase, AudioKitStream, VBANStream, AnalogAudioArduino, Equalizer3Bands, AdapterAudioOutputToAudioStream, TimedStream, ProgressStream, FormatConverterStream, FadeStream, Pipeline::ModifyingStreamAdapter, PureDataStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtual |
Define the Root PEM Certificate for SSL: Method compatible with Arduino WiFiClientSecure API
Implements AbstractURLStream.
|
inlineprotected |
Define the Root PEM Certificate for SSL: the last byte must be null, the len is including the ending null
|
inline |
Attach and enable use of a bundle for certificate verification e.g. esp_crt_bundle_attach or arduino_esp_crt_bundle_attach
|
inlineoverridevirtual |
Does nothing.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Not used.
Implements AbstractURLStream.
|
inlinevirtualinherited |
Reimplemented in ICYStreamT< T >.
|
inlinevirtual |
Sets the password that will be used for logging in (when calling begin)
Implements AbstractURLStream.
|
inlinevirtual |
Sets the power save mode (default false)!
Implements AbstractURLStream.
|
inlinevirtual |
Sets the ssid that will be used for logging in (when calling begin)
Implements AbstractURLStream.
|
inlineoverridevirtual |
Total amout of data that was consumed so far.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Provides the url as string.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Not used.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Reimplemented in BufferedTaskStream, and BufferedStream.