arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioBLEStream Class Referenceabstract

Transmit and receive data via BLE using a Serial API. The following additional experimental features are offered: setFramed(true) tries to keep the original write sizes; setAudioInfoActive(true) informs about changes in the audio info. More...

#include <AudioBLEStream.h>

Inheritance diagram for AudioBLEStream:
AudioStream BaseStream AudioInfoSupport AudioInfoSource Stream Print AudioBLEClient AudioBLEClient AudioBLEServer AudioBLEServer

Public Member Functions

 AudioBLEStream (int defaultMTU)
 
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 ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
virtual int available () override
 
virtual int availableForWrite () override
 
virtual bool begin ()
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
virtual bool connected ()=0
 
virtual void end ()=0
 
virtual void flush () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 operator bool ()
 
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 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)
 
AudioInfo toInfo (const uint8_t *str)
 
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

 AudioBLEStream (AudioBLEStream const &other)=delete
 
virtual int getMTU ()=0
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void operator= (AudioBLEStream const &other)=delete
 
void refillReadBuffer ()
 
virtual void setAudioInfo (const uint8_t *data, size_t size)
 
virtual void writeAudioInfoCharacteristic (AudioInfo info)=0
 

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
 
AudioInfo 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
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 

Detailed Description

Transmit and receive data via BLE using a Serial API. The following additional experimental features are offered: setFramed(true) tries to keep the original write sizes; setAudioInfoActive(true) informs about changes in the audio info.


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