26 bool notify)
override {
62 return parser.popMessage(incomingMessage);
Type definitions and callback interfaces for communication between the low-level BLE stacks and highe...
BLEDataLifetime
Should a buffer of BLEData be consumed immediately inside of the callback, or can we hold on to it an...
#define BEGIN_CS_NAMESPACE
ArduinoBLE backend intended to be plugged into GenericBLEMIDI_Interface.
void handleSubscribe(BLEConnectionHandle, BLECharacteristicHandle, bool notify) override
Called by the BLE stack when the central subscribes to receive notifications for the MIDI GATT charac...
void handleMTU(BLEConnectionHandle, uint16_t mtu) override
Called by the BLE stack when the maximum transmission unit for the connection changes.
AnyMIDIMessage IncomingMIDIMessage
void handleConnect(BLEConnectionHandle) override
Called by the BLE stack when a connection is established.
void sendData(BLEDataView data)
Send the given MIDI BLE packet.
void handleData(BLEConnectionHandle, BLEDataGenerator &&data, BLEDataLifetime) override
Called by the BLE stack when the central writes data to the MIDI GATT characteristic.
void begin(BLESettings ble_settings)
Initialize the BLE stack etc.
bool isConnected() const
Returns true if we are connected to a BLE Central device.
PollingBLEMIDISender< ArduinoBLEBackend > Sender
bool subscribed
Did the BLE Central subscribe to be notified for the MIDI characteristic?
void end()
Deinitialize the BLE stack.
bool connected
Are we connected to a BLE Central?
bool popMessage(IncomingMIDIMessage &incomingMessage)
Retrieve and remove a single incoming MIDI message from the buffer.
void handleDisconnect(BLEConnectionHandle) override
Called by the BLE stack when a connection is terminated.
BufferedBLEMIDIParser< 1024 > parser
Contains incoming BLE MIDI data to be parsed.
Callable that returns the next chunk of data from a BLE packet when called.
FIFO buffer that you can push BLE packets into, and pop MIDI messages out of.
Defines the interface for callback functions registered by the low-level BLE code.
PollingBLEMIDISender()=default
BLEMIDIPacketBuilder packet
uint16_t getMinMTU() const
void setTimeout(std::chrono::milliseconds timeout)
void forceMinMTU(uint16_t mtu)
ProtectedBuilder acquirePacket()
void releasePacketAndNotify(ProtectedBuilder &lck)
void updateMTU(uint16_t mtu)
void sendNow(ProtectedBuilder &lck)
#define DEBUGREF(x)
Print an expression and its location (file and line number) to the debug output if debugging is enabl...
void notify(BLEDataView data)
bool init(MIDIBLEInstance &instance, BLESettings ble_settings)
MIDI message variant type (with timestamp).
Represents a handle to a local GATT characteristic.
Represents a handle to the connection to another device.
Non-owning, std::span-style read-only view of BLE data.
Configuration options for the low-level BLE code.