3#if CONFIG_BT_BLE_ENABLED
9namespace cs::midi_ble_bluedroid {
16using namespace cs::midi_ble_bluedroid;
19 if (midi_ble_bluedroid_instance)
20 midi_ble_bluedroid_instance->handleConnect(
24 if (midi_ble_bluedroid_instance)
25 midi_ble_bluedroid_instance->handleDisconnect(
29 if (midi_ble_bluedroid_instance)
30 midi_ble_bluedroid_instance->handleMTU(
34 uint16_t char_handle,
bool notify) {
35 if (midi_ble_bluedroid_instance)
36 midi_ble_bluedroid_instance->handleSubscribe(
42 if (midi_ble_bluedroid_instance) {
44 auto data_gen = [view {view}]()
mutable {
45#if __cplusplus >= 201402
46 return std::exchange(view, {});
53 midi_ble_bluedroid_instance->handleData(
60namespace cs::midi_ble_bluedroid {
63 midi_ble_bluedroid_instance = &instance;
@ ConsumeImmediately
Buffer is valid only during the callback. Do not keep any pointers to it.
Advertising the MIDI service for Bluetooth Low Energy.
void advertising_set_connection_interval(uint16_t itvl_min, uint16_t itvl_max)
Set the connection interval range in the advertising data.
void midi_ble_instance_handle_data(uint16_t conn_handle, const uint8_t *data, uint16_t length)
void midi_ble_instance_handle_disconnect(uint16_t conn_handle)
void midi_ble_instance_handle_subscribe(uint16_t conn_handle, uint16_t char_handle, bool notify)
void midi_ble_instance_handle_connect(uint16_t conn_handle)
void midi_ble_instance_handle_mtu(uint16_t conn_handle, uint16_t mtu)
Callable that returns the next chunk of data from a BLE packet when called.
Defines the interface for callback functions registered by the low-level BLE code.
Public MIDI over Bluetooth Low Energy API.
bool midi_init()
Initialize the Bluetooth stack and register the MIDI BLE application with the Bluedroid driver.
void set_security_initiate_encryption(bool security_initiate_encryption_)
Configure whether the Arduino should initiate the bonding/secure connection.
void set_midi_ble_name(const char *name)
Set the name of the BLE device. Must be set before calling midi_init().
bool midi_notify(uint16_t conn_handle, uint16_t char_handle, const uint8_t *data, size_t len)
Send a MIDI BLE notification to the client.
void notify(BLEDataView data)
bool init(MIDIBLEInstance &instance, BLESettings ble_settings)
static in_place_t in_place
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.
struct BLESettings::@4 connection_interval
Connection intervals as multiples of 1.25 milliseconds (e.g.0x000C = 15 ms).
const char * device_name
Device name (used for advertising)
bool initiate_security
Set to true if you want the Arduino to always initiate the Bluetooth bonding or secure connection.