|
arduino-audio-tools
|
A simple BLE server that implements the serial protocol, so that it can be used to send and recevie audio. In BLE terminologiy this is a Peripheral. This implementation uses the ArduinoBLE library! This is working only correctly if the client sets the max MTU to a value >= 256. Otherwise some of the transmitted information gets silently dropped. More...
#include <AudioBLEServer.h>
Public Member Functions | |
| AudioBLEServer (int mtu=0) | |
| AudioBLEServer (int mtu=517) | |
| 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 | available () override |
| int | availableForWrite () override |
| int | availableForWrite () override |
| virtual bool | begin () |
| bool | begin (const char *name) |
| bool | begin (const char *name) |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| bool | connected () override |
| bool | connected () override |
| void | end () override |
| void | end () override |
| virtual void | flush () override |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| operator bool () | |
| size_t | readBytes (uint8_t *data, size_t len) override |
| 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 info) |
| Defines the input AudioInfo. | |
| void | setAudioInfoActive (bool flag) |
| void | setAudioInfoUUID (const char *uuid) |
| void | setFramed (bool flag) |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| void | setRxUUID (const char *uuid) |
| void | setServiceUUID (const char *uuid) |
| void | setTxUUID (const char *uuid) |
| void | setWriteBufferSize (int size) |
| AudioInfo | toInfo (const uint8_t *str) |
| StrView | toStr (AudioInfo info) |
| size_t | write (const uint8_t *data, size_t dataSize) override |
| 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 | checkCentralConnected () |
| int | getMTU () override |
| int | getMTU () override |
| size_t | getReadSize (size_t dataSize) |
| size_t | getReadSize (size_t dataSize) |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | onConnect (BLEDevice device) |
| void | onConnect (BLEServer *pServer) override |
| void | onDisconnect (BLEDevice device) |
| void | onDisconnect (BLEServer *pServer) override |
| void | onRead (BLECharacteristic *pCharacteristic) override |
| provide the next batch of audio data | |
| void | onRead (BLECharacteristic characteristic) |
| provide the next batch of audio data | |
| void | onWrite (BLECharacteristic *pCharacteristic) override |
| store the next batch of data | |
| void | onWrite (BLECharacteristic characteristic) |
| store the next batch of data | |
| virtual void | receiveAudio (const uint8_t *data, size_t size) |
| virtual void | receiveAudio (const uint8_t *data, size_t size) |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
| virtual void | setAudioInfo (const uint8_t *data, size_t size) |
| void | setupBLEService () |
| void | setupBLEService () |
| void | setupRXBuffer () |
| void | setupRXBuffer () |
| void | setupTXBuffer () |
| void | setupTXBuffer () |
| void | writeAudioInfoCharacteristic (AudioInfo info) |
| void | writeAudioInfoCharacteristic (AudioInfo info) |
Static Protected Member Functions | |
| static void | bleOnRead (BLEDevice device, BLECharacteristic characteristic) |
| static void | bleOnWrite (BLEDevice device, BLECharacteristic characteristic) |
| static void | blePeripheralConnectHandler (BLEDevice device) |
| static void | blePeripheralDisconnectHandler (BLEDevice device) |
Protected Attributes | |
| int | _timeout = 10 |
| char | audio_info_str [40] |
| const char * | BLE_AUDIO_SERVICE_UUID = "6e400001-b5a3-f393-e0a9-e50e24dcca9e" |
| 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_server_name = nullptr |
| BLEDevice | central |
| BLECharacteristic | ch01_char {BLE_CH1_UUID, BLERead, getMTU()} |
| BLECharacteristic * | ch01_char |
| BLEDescriptor | ch01_desc {"2901", "channel 1"} |
| BLECharacteristic | ch02_char {BLE_CH2_UUID, BLEWrite, getMTU()} |
| BLECharacteristic * | ch02_char |
| BLEDescriptor | ch02_desc {"2901", "channel 2"} |
| AudioInfo | info |
| BLECharacteristic | info_char |
| BLECharacteristic * | info_char |
| BLEDescriptor | info_desc {"2901", "info"} |
| bool | is_audio_info_active = false |
| bool | is_framed = false |
| bool | is_notify_active = true |
| bool | is_started = false |
| uint16_t | max_transfer_size = 0 |
| Vector< AudioInfoSupport * > | notify_vector |
| BLEAdvertising * | p_advertising = nullptr |
| BLEServer * | p_server = nullptr |
| BLEService * | p_service = nullptr |
| RingBuffer< uint8_t > | receive_buffer {0} |
| RingBuffer< uint16_t > | receive_sizes {0} |
| BLEService | service {BLE_AUDIO_SERVICE_UUID} |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| RingBuffer< uint8_t > | transmit_buffer {0} |
| RingBuffer< uint16_t > | transmit_buffer_sizes {0} |
| int | write_buffer_size = MAX_SINGLE_CHARS |
A simple BLE server that implements the serial protocol, so that it can be used to send and recevie audio. In BLE terminologiy this is a Peripheral. This implementation uses the ArduinoBLE library! This is working only correctly if the client sets the max MTU to a value >= 256. Otherwise some of the transmitted information gets silently dropped.
A simple BLE server that implements the serial protocol, so that it can be used to send and recevie audio. In BLE terminologiy this is a Peripheral.
|
inline |
|
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, and ResampleStreamT< TInterpolator >.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, AudioMP34DT05, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, VS1053Stream, WM8960Stream, AdaptiveResamplingStream, AudioLoRa, ESPNowStream, USBAudioDeviceBase, VBANStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, AudioStreamWrapper, TimerCallbackAudioStream, FrequencyDetectorAutoCorrelation, GoertzelStream, ResampleStreamT< TInterpolator >, FileLoopT< FileType >, FileLoopT< File >, EncodedAudioStream, AudioBoardStream, AudioKitStream, MiniAudioStream, PortAudioStream, StdioStream, HLSStreamT< URLStream >, NRF24Stream, AnalogAudioStream, AdapterAudioOutputToAudioStream, TimedStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, MeasuringStream, 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, QualityAnalysisStream, ResampleStream, VolumeStream, AudioFFTBase, and EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >.
|
inline |
|
inline |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlineprotected |
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtual |
Implements AudioBLEStream.
|
inlineoverridevirtual |
Implements AudioBLEStream.
|
inlineoverridevirtual |
Implements AudioBLEStream.
|
inlineoverridevirtual |
Implements AudioBLEStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, AudioStreamWrapper, ResampleStream, EncodedAudioStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
|
inlineoverrideprotectedvirtual |
Implements AudioBLEStream.
|
inlineoverrideprotectedvirtual |
Implements AudioBLEStream.
|
inlineprotected |
|
inlineprotected |
|
inlineinherited |
Checks if the automatic AudioInfo update is active.
|
inlineprotectedvirtualinherited |
|
inlineprotectedinherited |
|
inlineprotected |
|
inlineoverrideprotected |
|
inlineprotected |
|
inlineoverrideprotected |
|
inlineoverrideprotected |
provide the next batch of audio data
|
inlineprotected |
provide the next batch of audio data
|
inlineoverrideprotected |
store the next batch of data
|
inlineprotected |
store the next batch of data
|
inlinevirtualinherited |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlinevirtualinherited |
Source to generate silence: just sets the buffer to 0.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
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 >.
|
inlinevirtualinherited |
Defines the input AudioInfo.
Reimplemented from AudioStream.
|
inlineprotectedvirtualinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineinherited |
|
inlineinherited |
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
inlineprotectedvirtual |
Implements AudioBLEStream.
|
inlineprotectedvirtual |
Implements AudioBLEStream.
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |