|
arduino-audio-tools
|
Common functionality of the BLE serial server and client: data is exchanged via two characteristics like a serial connection. The audio info can optionally be exchanged via a third characteristic. More...
#include <BLESerialStream.h>


Public Member Functions | |
| BLESerialStream (int mtu) | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfoOut () |
| virtual int | available () override |
| virtual int | availableForWrite () override |
| virtual bool | begin () |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| virtual bool | connected ()=0 |
| Returns true if we are connected with the other side. | |
| virtual void | end ()=0 |
| virtual void | flush () override |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| operator bool () override | |
| int | packetSize () |
| virtual 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. | |
| void | setAudioInfo (AudioInfo newInfo) override |
| void | setAudioInfoActive (bool flag) |
| Activates the exchange of the audio info. | |
| void | setAudioInfoUUID (const char *uuid) |
| Defines the UUID of the audio info characteristic. | |
| void | setFramed (bool flag) |
| Keeps the write sizes: each write is one BLE packet. | |
| void | setMTU (int mtu) |
| Defines the requested MTU (must be called before begin) | |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| void | setRxBufferSize (int bytes, int packets=100) |
| void | setRxUUID (const char *uuid) |
| Defines the UUID of the characteristic which is written by the client. | |
| void | setServiceUUID (const char *uuid) |
| Defines the service UUID. | |
| void | setTxBufferSize (int bytes, int packets=100) |
| void | setTxUUID (const char *uuid) |
| Defines the UUID of the characteristic which is read by the client. | |
| void | setWriteBufferSize (int size) |
| AudioInfo | toInfo (const uint8_t *data, size_t len) |
| Converts the string from the info characteristic to the audio info. | |
| StrView | toStr (AudioInfo info) |
| virtual 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 | |
| BLESerialStream (BLESerialStream const &other)=delete | |
| virtual int | getMTU () |
| Effective MTU. | |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | operator= (BLESerialStream const &other)=delete |
| void | receiveAudioInfo (const uint8_t *data, size_t size) |
| Process the audio info which was received from the other side. | |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
| virtual void | writeAudioInfo (StrView info)=0 |
| Provides the audio info to the other side. | |
Static Protected Member Functions | |
| static int | getHeader (const uint8_t *packet, int packetLen) |
| Determines the payload length from the 2 byte header. | |
| static void | setHeader (uint8_t *packet, int len) |
| Copies the payload length into the 2 byte header. | |
Protected Attributes | |
| int | _timeout = 10 |
| char | audio_info_str [40] |
| const char * | BLE_CH1_UUID = "6e400002-b5a3-f393-e0a9-e50e24dcca9e" |
| const char * | BLE_CH2_UUID = "6e400003-b5a3-f393-e0a9-e50e24dcca9e" |
| const char * | BLE_INFO_UUID = "6e400004-b5a3-f393-e0a9-e50e24dcca9e" |
| const char * | BLE_SERIAL_SERVICE_UUID = "6e400001-b5a3-f393-e0a9-e50e24dcca9e" |
| AudioInfo | info |
| bool | is_audio_info_active = false |
| bool | is_audio_info_defined = false |
| bool | is_framed = false |
| bool | is_notify_active = true |
| int | max_transfer_size = 0 |
| Vector< AudioInfoSupport * > | notify_vector |
| int | rx_buffer_size = 4096 |
| int | rx_packet_count = 100 |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | tx_buffer_size = 4096 |
| int | tx_packet_count = 100 |
| int | write_buffer_size = MAX_SINGLE_CHARS |
Common functionality of the BLE serial server and client: data is exchanged via two characteristics like a serial connection. The audio info can optionally be exchanged via a third characteristic.
|
inline |
|
protecteddelete |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, EncodedAudioStream, 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 MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, ResampleStreamT< TInterpolator >, and SupportedRatesStream.
|
inlineoverridevirtualinherited |
Reimplemented from Stream.
Reimplemented in AudioKitStream, AudioLoRa, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, VBANStream, AudioStreamWrapper, FaustStream< DSP >, AudioMP34DT05, I2SCodecStream, MiniAudioStream, StdioStream, TfLiteAudioStream, A2DPStream, BLESerialServerBase, BLESerialClientBase, ESPNowStream, HammingFEC< bytecount, block_t >, HLSStreamT< URLStream >, HttpRequest, ICYStreamT< T >, URLStream, BufferedTaskStream, NRF24Stream, ReedSolomonFEC< bytecount, additional_bytes >, SPIAudioSlave, SPIRegAudioSlave, UDPStream, USBAudioStreamBase, AutomaticGainControlStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, MeasuringStream, QualityAnalysisStream, VolumeStream, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, I2SStream, ReformatBaseStream, TimedStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, ConverterStream< T >, ProgressStream, Throttle, InputMixer< T, SumT >, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, CatStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, FadeStream, Pipeline, Pipeline::ModifyingStreamAdapter, SupportedRatesStream, FileLoopT< FileType >, FileLoopT< File >, and AudioFFTBase.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in AudioLoRa, UDPStream, VBANStream, AudioStreamWrapper, ConverterStream< T >, EncodedAudioStream, FaustStream< DSP >, I2SCodecStream, MiniAudioStream, StdioStream, A2DPStream, BLESerialServerBase, BLESerialClientBase, ESPNowStream, HammingFEC< bytecount, block_t >, AbstractURLStream, URLStreamESP32, NRF24Stream, ReedSolomonFEC< bytecount, additional_bytes >, SPIAudioSlave, SPIRegAudioSlave, USBAudioStreamBase, AutomaticGainControlStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, MeasuringStream, QualityAnalysisStream, VolumeStream, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, I2SStream, ReformatBaseStream, TimedStream, MemoryStream, RingBufferStream, ProgressStream, Throttle, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, FadeStream, Pipeline, SupportedRatesStream, and AudioFFTBase.
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, AudioMP34DT05, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, VS1053Stream, WM8960Stream, AdaptiveResamplingStream, AudioLoRa, ESPNowStream, USBAudioDeviceBase, USBAudioHostBase, VBANStream, FrequencyDetectorAutoCorrelation, GoertzelStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, I2SStream, AudioTimeSourceStream, AudioStreamWrapper, TimerCallbackAudioStream, ResampleStreamT< TInterpolator >, FileLoopT< FileType >, FileLoopT< File >, EncodedAudioStream, AudioBoardStream, AudioKitStream, MiniAudioStream, PortAudioStream, StdioStream, HLSStreamT< URLStream >, NRF24Stream, ReedSolomonFEC< bytecount, additional_bytes >, AutomaticGainControlStream, MeasuringStream, QualityAnalysisStream, VolumeStream, AnalogAudioStream, AdapterAudioOutputToAudioStream, TimedStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, ProgressStream, Throttle, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, VolumeMeter, AudioInputMonitor, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, CatStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, Pipeline, Pipeline::ModifyingStreamAdapter, ResampleStream, SupportedRatesStream, AudioFFTBase, and EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >.
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
pure virtual |
Returns true if we are connected with the other side.
Implemented in BLESerialServerArduinoBLE, BLESerialServerESP32, and BLESerialClientBase.
|
pure virtual |
Reimplemented from BaseStream.
Implemented in BLESerialClientArduinoBLE, BLESerialClientESP32, BLESerialServerArduinoBLE, and BLESerialServerESP32.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, AudioStreamWrapper, ResampleStream, EncodedAudioStream, BLESerialClientBase, URLStream, BufferedTaskStream, AutomaticGainControlStream, MeasuringStream, QualityAnalysisStream, VolumeStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, I2SStream, TimedStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, QueueStream< T >, QueueStream< uint8_t >, FadeStream, Pipeline::ModifyingStreamAdapter, SupportedRatesStream, and EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >.
Determines the payload length from the 2 byte header.
|
inlineprotectedvirtual |
Effective MTU.
Reimplemented in BLESerialClientESP32, and BLESerialServerESP32.
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
protecteddelete |
|
inline |
Max number of payload bytes in one BLE packet: the packets read by the client also contain the length header and a value can not be longer than 512 bytes
Implements BaseStream.
Reimplemented in LMSEchoCancellationStream< T >, MDFEchoCancellationStream< T, SampleType >, USBAudioStreamBase, MozziStream, PureDataStream, AudioLoRa, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, AudioStreamWrapper, EncodedAudioStream, FaustStream< DSP >, AudioKitStream, AudioMP34DT05, I2SCodecStream, MiniAudioStream, PortAudioStream, TfLiteAudioStream, A2DPStream, AdaptiveResamplingStream, BLESerialServerBase, BLESerialClientBase, HLSStreamT< URLStream >, ICYStreamT< T >, URLStream, BufferedTaskStream, URLStreamESP32, NRF24Stream, SPIAudioSlave, SPIRegAudioSlave, VBANStream, AutomaticGainControlStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, GoertzelStream, MeasuringStream, QualityAnalysisStream, VolumeStream, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, I2SStream, ReformatBaseStream, TimedStream, AudioTimeSourceStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, ConverterStream< T >, ProgressStream, Throttle, InputMixer< T, SumT >, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, VolumeMeter, AudioInputMonitor, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FadeStream, Pipeline, SupportedRatesStream, AudioFFTBase, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, WM8960Stream, AnalogDriverESP32V1::IO16Bit, and AnalogDriverESP32V2::IO16Bit.
Source to generate silence: just sets the buffer to 0.
Process the audio info which was received from the other side.
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtual |
Defines the audio info and informs the other side if setAudioInfoActive(true) was called
Reimplemented from AudioStream.
|
inline |
Activates the exchange of the audio info.
|
inline |
Defines the UUID of the audio info characteristic.
|
inline |
Keeps the write sizes: each write is one BLE packet.
Copies the payload length into the 2 byte header.
|
inline |
Defines the requested MTU (must be called before begin)
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
Defines the size of the receive buffer and (in framed mode) the max number of packets: must be called before begin
|
inline |
Defines the UUID of the characteristic which is written by the client.
|
inline |
Defines the service UUID.
Defines the size of the transmit buffer and (in framed mode) the max number of packets: must be called before begin
|
inline |
Defines the UUID of the characteristic which is read by the client.
|
inlineinherited |
Converts the string from the info characteristic to the audio info.
Converts the audio info to the string which is used in the info characteristic
Implements BaseStream.
Reimplemented in URLStream, LMSEchoCancellationStream< T >, MDFEchoCancellationStream< T, SampleType >, ESP3288AudioOutput, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, AudioLoRa, USBAudioStreamBase, I2SStream, AudioStreamWrapper, ConverterStream< T >, EncodedAudioStream, FaustStream< DSP >, AudioKitStream, MiniAudioStream, PortAudioStream, TfLiteAudioStream, VS1053Stream, A2DPStream, AdaptiveResamplingStream, BLESerialServerBase, BLESerialClientBase, BufferedTaskStream, URLStreamESP32, NRF24Stream, SPIAudioSlave, VBANStream, AutomaticGainControlStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, GoertzelStream, MeasuringStream, QualityAnalysisStream, VolumeStream, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3BandsT< T >, Equalizer3BandsPerChannelT< T >, AdapterAudioOutputToAudioStream, TimedStream, AudioTimeSourceStream, MemoryStream, RingBufferStream, BufferedStream, ProgressStream, Throttle, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, VolumeMeter, AudioInputMonitor, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, FadeStream, Pipeline, Pipeline::ModifyingStreamAdapter, ResampleStream, ResampleStreamT< TInterpolator >, SupportedRatesStream, AudioFFTBase, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, TfLiteAudioStreamBase, WM8960Stream, AnalogDriverESP32V1::IO16Bit, and AnalogDriverESP32V2::IO16Bit.
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
protectedpure virtual |
Provides the audio info to the other side.
Implemented in BLESerialClientArduinoBLE, BLESerialClientESP32, BLESerialServerArduinoBLE, and BLESerialServerESP32.
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |