Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PollingBLEMIDISender< Derived > Class Template Reference

#include <MIDI_Interfaces/BLEMIDI/PollingBLEMIDISender.hpp>

Detailed Description

template<class Derived>
class PollingBLEMIDISender< Derived >

Class that buffers MIDI BLE packets.

Definition at line 14 of file PollingBLEMIDISender.hpp.

+ Collaboration diagram for PollingBLEMIDISender< Derived >:

Classes

struct  ProtectedBuilder
 

Public Member Functions

 PollingBLEMIDISender ()=default
 
 PollingBLEMIDISender (const PollingBLEMIDISender &)=delete
 
PollingBLEMIDISenderoperator= (const PollingBLEMIDISender &)=delete
 
 ~PollingBLEMIDISender ()
 
void begin ()
 Initialize.
 
ProtectedBuilder acquirePacket ()
 Acquire exclusive access to the buffer.
 
void releasePacketAndNotify (ProtectedBuilder &lck)
 Release exclusive access to the buffer and notify the sender thread that data is available.
 
void sendNow (ProtectedBuilder &lck)
 Sends the data immediately without waiting for the timeout.
 
void updateMTU (uint16_t mtu)
 Set the maximum transmission unit of the Bluetooth link.
 
uint16_t getMinMTU () const
 Get the minimum MTU of all connected clients.
 
void forceMinMTU (uint16_t mtu)
 Force the MTU to an artificially small value (used for testing).
 
void setTimeout (std::chrono::milliseconds timeout)
 Set the timeout, the number of milliseconds to buffer the outgoing MIDI messages.
 

Private Member Functions

void sendData (BLEDataView)=delete
 Actually perform the BLE notification with the given data.
 

Private Attributes

BLEMIDIPacketBuilder packet
 View of the data to send.
 
unsigned long timeout {10}
 Timeout before the sender thread sends a packet.
 
unsigned long packet_start_time {0}
 Time point when the packet was started.
 
uint16_t min_mtu {23}
 The minimum MTU of all connected clients.
 
uint16_t force_min_mtu {515}
 Override the minimum MTU (0 means don't override, nonzero overrides if it's smaller than the minimum MTU of the clients).
 

Constructor & Destructor Documentation

◆ PollingBLEMIDISender() [1/2]

template<class Derived >
PollingBLEMIDISender ( )
default

◆ PollingBLEMIDISender() [2/2]

template<class Derived >
PollingBLEMIDISender ( const PollingBLEMIDISender< Derived > & )
delete

◆ ~PollingBLEMIDISender()

template<class Derived >
~PollingBLEMIDISender ( )

Member Function Documentation

◆ operator=()

template<class Derived >
PollingBLEMIDISender & operator= ( const PollingBLEMIDISender< Derived > & )
delete

◆ begin()

template<class Derived >
void begin ( )

Initialize.

◆ acquirePacket()

template<class Derived >
ProtectedBuilder acquirePacket ( )

Acquire exclusive access to the buffer.

Returns
A RAII wrapper that automatically releases the buffer upon destruction. Just make sure you don't keep any pointers to the packet member.

◆ releasePacketAndNotify()

template<class Derived >
void releasePacketAndNotify ( ProtectedBuilder & lck)

Release exclusive access to the buffer and notify the sender thread that data is available.

◆ sendNow()

template<class Derived >
void sendNow ( ProtectedBuilder & lck)

Sends the data immediately without waiting for the timeout.

◆ updateMTU()

template<class Derived >
void updateMTU ( uint16_t mtu)

Set the maximum transmission unit of the Bluetooth link.

Used to compute the MIDI BLE packet size.

◆ getMinMTU()

template<class Derived >
uint16_t getMinMTU ( ) const
inline

Get the minimum MTU of all connected clients.

Definition at line 42 of file PollingBLEMIDISender.hpp.

◆ forceMinMTU()

template<class Derived >
void forceMinMTU ( uint16_t mtu)

Force the MTU to an artificially small value (used for testing).

◆ setTimeout()

template<class Derived >
void setTimeout ( std::chrono::milliseconds timeout)

Set the timeout, the number of milliseconds to buffer the outgoing MIDI messages.

◆ sendData()

template<class Derived >
void sendData ( BLEDataView )
privatedelete

Actually perform the BLE notification with the given data.

Member Data Documentation

◆ packet

template<class Derived >
BLEMIDIPacketBuilder packet
private

View of the data to send.

Definition at line 56 of file PollingBLEMIDISender.hpp.

◆ timeout

template<class Derived >
unsigned long timeout {10}
private

Timeout before the sender thread sends a packet.

See also
setTimeout()

Definition at line 59 of file PollingBLEMIDISender.hpp.

◆ packet_start_time

template<class Derived >
unsigned long packet_start_time {0}
private

Time point when the packet was started.

Definition at line 61 of file PollingBLEMIDISender.hpp.

◆ min_mtu

template<class Derived >
uint16_t min_mtu {23}
private

The minimum MTU of all connected clients.

Definition at line 65 of file PollingBLEMIDISender.hpp.

◆ force_min_mtu

template<class Derived >
uint16_t force_min_mtu {515}
private

Override the minimum MTU (0 means don't override, nonzero overrides if it's smaller than the minimum MTU of the clients).

See also
forceMinMTU()

Definition at line 69 of file PollingBLEMIDISender.hpp.


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