ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::ble_midi Namespace Reference

Data Structures

class  BLEMidi
 Client for devices implementing the standard BLE-MIDI service, e.g. More...
 
struct  MidiMessage
 A decoded MIDI message. More...
 
class  MidiParser
 Decoder for the BLE-MIDI packet format (Apple/MMA "Bluetooth Low Energy MIDI" specification, section 3). More...
 

Typedefs

using ByteSpan = std::span<const uint8_t>
 The bytes of a received message, valid for the duration of the automation.
 
using MidiMessageHandler = void (*)(void *ctx, const MidiMessage &message)
 Called once per decoded message with the context passed to feed().
 

Enumerations

enum class  MessageType : uint8_t {
  NOTE_OFF , NOTE_ON , POLY_AFTERTOUCH , CONTROL_CHANGE ,
  PROGRAM_CHANGE , CHANNEL_AFTERTOUCH , PITCH_BEND , SYSEX ,
  SYSEX_INCOMPLETE , SYSTEM_COMMON , SYSTEM_REAL_TIME , INCOMPLETE ,
  UNKNOWN
}
 

Functions

 ESPHOME_LOG_TAG (TAG, "ble_midi")
 
size_t frame_sysex (const uint8_t *payload, size_t length, uint8_t *out, size_t out_size)
 Frame a SysEx payload for one BLE-MIDI packet: 0xF0 and 0xF7 are added when the payload lacks them, with the timestamp byte the specification requires before 0xF7.
 
 PROGMEM_STRING_TABLE (MessageTypeNames, "NOTE_OFF", "NOTE_ON", "POLY_AFTERTOUCH", "CONTROL_CHANGE", "PROGRAM_CHANGE", "CHANNEL_AFTERTOUCH", "PITCH_BEND", "SYSEX", "SYSEX_INCOMPLETE", "SYSTEM_COMMON", "SYSTEM_REAL_TIME", "INCOMPLETE", "UNKNOWN")
 

Typedef Documentation

◆ ByteSpan

using esphome::ble_midi::ByteSpan = std::span<const uint8_t>

The bytes of a received message, valid for the duration of the automation.

Definition at line 24 of file ble_midi.h.

◆ MidiMessageHandler

using esphome::ble_midi::MidiMessageHandler = void (*)(void *ctx, const MidiMessage &message)

Called once per decoded message with the context passed to feed().

Definition at line 52 of file midi_parser.h.

Enumeration Type Documentation

◆ MessageType

enum class esphome::ble_midi::MessageType : uint8_t
strong
Enumerator
NOTE_OFF 
NOTE_ON 
POLY_AFTERTOUCH 
CONTROL_CHANGE 
PROGRAM_CHANGE 
CHANNEL_AFTERTOUCH 
PITCH_BEND 
SYSEX 
SYSEX_INCOMPLETE 
SYSTEM_COMMON 
SYSTEM_REAL_TIME 
INCOMPLETE 
UNKNOWN 

Definition at line 12 of file midi_parser.h.

Function Documentation

◆ ESPHOME_LOG_TAG()

esphome::ble_midi::ESPHOME_LOG_TAG ( TAG ,
"ble_midi"  )

◆ frame_sysex()

size_t esphome::ble_midi::frame_sysex ( const uint8_t * payload,
size_t length,
uint8_t * out,
size_t out_size )

Frame a SysEx payload for one BLE-MIDI packet: 0xF0 and 0xF7 are added when the payload lacks them, with the timestamp byte the specification requires before 0xF7.

Returns the bytes written to out, or 0 when the payload is empty, holds a byte with bit 7 set, or does not fit out_size once framed.

Definition at line 176 of file midi_parser.cpp.

◆ PROGMEM_STRING_TABLE()

esphome::ble_midi::PROGMEM_STRING_TABLE ( MessageTypeNames ,
"NOTE_OFF" ,
"NOTE_ON" ,
"POLY_AFTERTOUCH" ,
"CONTROL_CHANGE" ,
"PROGRAM_CHANGE" ,
"CHANNEL_AFTERTOUCH" ,
"PITCH_BEND" ,
"SYSEX" ,
"SYSEX_INCOMPLETE" ,
"SYSTEM_COMMON" ,
"SYSTEM_REAL_TIME" ,
"INCOMPLETE" ,
"UNKNOWN"  )