|
arduino-audio-tools
|
A BLE client that implements a serial protocol, so that it can be used to send and receive audio. In BLE terminology this is a Central. This implementation uses the ArduinoBLE library. More...
#include <BLESerialClientArduinoBLE.h>


Public Member Functions | |
| BLESerialClientArduinoBLE (int mtu=242) | |
| 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 () |
| int | available () override |
| int | availableForWrite () override |
| virtual bool | begin () |
| bool | begin (const char *localName, int seconds) |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| bool | connected () override |
| Returns true if we are connected with the other side. | |
| void | end () override |
| void | flush () override |
| Sends the buffered data which does not fill a complete packet. | |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| operator bool () override | |
| int | packetSize () |
| 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 | setConfirmWrite (bool flag) |
| Writes with response: slower but with flow control. | |
| 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) |
| void | setWriteThrottle (int ms) |
| Waits the indicated ms after each write. | |
| AudioInfo | toInfo (const uint8_t *data, size_t len) |
| Converts the string from the info characteristic to the audio info. | |
| StrView | toStr (AudioInfo info) |
| 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 | |
| bool | connect () override |
| Connects to the server if it was found: returns true if successful. | |
| virtual int | getMTU () |
| Effective MTU. | |
| bool | isConnected () override |
| Returns true if we are connected. | |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | onConnected () |
| Common setup after the connection was established. | |
| bool | readAudioInfo () override |
| Requests the audio info from the server: returns true if successful. | |
| int | readPacket (uint8_t *data, int maxLen) override |
| Reads the next packet (incl. header) from the server: returns the size. | |
| void | receiveAudioInfo (const uint8_t *data, size_t size) |
| Process the audio info which was received from the other side. | |
| void | receivePacket () |
| Reads the next packet from the server into the receive buffer. | |
| bool | reconnectLater () |
| disconnect and scan again | |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
| bool | sendPacket (const uint8_t *data, size_t len) |
| bool | startClient (const char *localName) override |
| Starts BLE and the scanning for the server. | |
| void | startScan () |
| void | writeAudioInfo (StrView str) override |
| Provides the audio info to the other side. | |
| bool | writePacket (const uint8_t *data, int len) override |
| Writes a packet to the server. | |
Static Protected Member Functions | |
| static int | getHeader (const uint8_t *packet, int packetLen) |
| Determines the payload length from the 2 byte header. | |
| static void | onInfoUpdatedCB (BLEDevice device, BLECharacteristic characteristic) |
| static BLESerialClientArduinoBLE *& | selfBLESerialClientArduinoBLE () |
| static void | setHeader (uint8_t *packet, int len) |
| Copies the payload length into the 2 byte header. | |
A BLE client that implements a serial protocol, so that it can be used to send and receive audio. In BLE terminology this is a Central. This implementation uses the ArduinoBLE library.
|
inline |
|
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 BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented from BaseStream.
|
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 >.
Starts the BLE client and waits at most the indicated seconds for the connection to the server. With 0 seconds we connect in the background.
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverrideprotectedvirtual |
Connects to the server if it was found: returns true if successful.
Implements BLESerialClientBase.
|
inlineoverridevirtualinherited |
Returns true if we are connected with the other side.
Implements BLESerialStream.
|
inlineoverridevirtual |
Implements BLESerialStream.
|
inlineoverridevirtualinherited |
Sends the buffered data which does not fill a complete packet.
Reimplemented from BaseStream.
Determines the payload length from the 2 byte header.
|
inlineprotectedvirtualinherited |
Effective MTU.
Reimplemented in BLESerialClientESP32, and BLESerialServerESP32.
|
inlineoverrideprotectedvirtual |
Returns true if we are connected.
Implements BLESerialClientBase.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
Common setup after the connection was established.
|
inlinestaticprotected |
|
inlineoverridevirtualinherited |
Reimplemented from AudioStream.
|
inlineinherited |
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
|
inlineoverrideprotectedvirtual |
Requests the audio info from the server: returns true if successful.
Implements BLESerialClientBase.
Reimplemented from AudioStream.
Reads the next packet (incl. header) from the server: returns the size.
Implements BLESerialClientBase.
Source to generate silence: just sets the buffer to 0.
Process the audio info which was received from the other side.
|
inlineprotectedinherited |
Reads the next packet from the server into the receive buffer.
|
inlineprotected |
disconnect and scan again
|
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 >.
|
inlinestaticprotected |
|
inlineoverridevirtualinherited |
Defines the audio info and informs the other side if setAudioInfoActive(true) was called
Reimplemented from AudioStream.
|
inlineinherited |
Activates the exchange of the audio info.
|
inlineinherited |
Defines the UUID of the audio info characteristic.
|
inlineinherited |
Writes with response: slower but with flow control.
|
inlineinherited |
Keeps the write sizes: each write is one BLE packet.
Copies the payload length into the 2 byte header.
|
inlineinherited |
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
|
inlineinherited |
Defines the UUID of the characteristic which is written by the client.
|
inlineinherited |
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
|
inlineinherited |
Defines the UUID of the characteristic which is read by the client.
|
inlineinherited |
|
inlineinherited |
Waits the indicated ms after each write.
|
inlineoverrideprotectedvirtual |
Starts BLE and the scanning for the server.
Implements BLESerialClientBase.
|
inlineprotected |
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
Reimplemented from AudioStream.
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
inlineoverrideprotectedvirtual |
Provides the audio info to the other side.
Implements BLESerialStream.
Writes a packet to the server.
Implements BLESerialClientBase.
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |