| 
   
    MIDI Control Surface library for Arduino 
   | 
 
 
 
 
Go to the documentation of this file.
   16                                 public BLEServerCallbacks,
 
   17                                 public BLECharacteristicCallbacks {
 
   30             ERROR(
F(
"Error: disconnect event, but was not connected"), 0x7788);
 
   36     void onRead(BLECharacteristic *pCharacteristic)
 override {
 
   38         pCharacteristic->setValue(
nullptr, 0);
 
   40     void onWrite(BLECharacteristic *pCharacteristic)
 override {
 
   42         std::string value = pCharacteristic->getValue();
 
   43         const uint8_t *
const data =
 
   44             reinterpret_cast<const uint8_t *
>(value.data());
 
   45         size_t len = value.size();
 
   75             DEBUGFN(
"No connected BLE clients");
 
   84         return MIDIReadEvent::NO_MESSAGE; 
 
   93         bool first = 
index == 0;
 
   98                 DEBUGFN(
"Message is larger than buffer");
 
  120     void sendImpl(uint8_t header, uint8_t d1, uint8_t d2, uint8_t cn)
 override {
 
  122         uint8_t msg[3] = {header, d1, d2};
 
  125     void sendImpl(uint8_t header, uint8_t d1, uint8_t cn)
 override {
 
  127         uint8_t msg[2] = {header, d1};
 
  131     void sendImpl(
const uint8_t *data, 
size_t length, uint8_t cn)
 override {
 
  142     void parse(
const uint8_t *
const data, 
const size_t len) {
 
  150         bool prevWasTimestamp = 
true;
 
  151         for (
const uint8_t *d = data + 2; d < data + len; d++) {
 
  154                 prevWasTimestamp = 
false;
 
  156                 if (prevWasTimestamp)
 
  158                 prevWasTimestamp = !prevWasTimestamp;
 
  
void begin(BLEServerCallbacks *serverCallbacks, BLECharacteristicCallbacks *midiCallbacks)
 
void sendImpl(uint8_t rt, uint8_t cn) override
Low-level function for sending a single-byte MIDI message.
 
Bluetooth Low Energy MIDI Interface for the ESP32.
 
BluetoothMIDI_Interface()
 
void sendImpl(uint8_t header, uint8_t d1, uint8_t cn) override
Low-level function for sending a 2-byte MIDI message.
 
static bool isData(uint8_t data)
Check if the given byte is a MIDI data byte.
 
void sendImpl(uint8_t header, uint8_t d1, uint8_t d2, uint8_t cn) override
Low-level function for sending a 3-byte MIDI message.
 
An abstract class for MIDI interfaces.
 
void onDisconnect(BLEServer *pServer) override
 
void onConnect(BLEServer *pServer) override
 
void addToBuffer(const uint8_t *data, size_t len)
 
constexpr static unsigned long MAX_MESSAGE_TIME
 
#define BEGIN_CS_NAMESPACE
 
void onWrite(BLECharacteristic *pCharacteristic) override
 
void onRead(BLECharacteristic *pCharacteristic) override
 
void sendImpl(const uint8_t *data, size_t length, uint8_t cn) override
Low-level function for sending a system exclusive MIDI message.
 
void update() override
Read the MIDI interface and call the callback if a message is received.
 
void addToBuffer(const uint8_t(&data)[N])
 
#define ERROR(msg, errc)
Print the error message and error code, and stop the execution if FATAL_ERRORS are enabled.
 
void notifyValue(uint8_t *data, size_t len)
 
void begin() override
Initialize this updatable.
 
bool dispatchMIDIEvent(MIDIReadEvent event)
 
void parse(const uint8_t *const data, const size_t len)
 
constexpr static size_t BUFFER_LENGTH
 
#define DEBUGFN(x)
Print an expression and its function (function name and line number) to the debug output if debugging...
 
MIDIReadEvent parse(uint8_t midibyte)
 
MIDIReadEvent
Result of the MIDI interface read methods.
 
MIDIReadEvent read() override
Try reading and parsing a single incoming MIDI message.
 
bool hasSpaceFor(size_t bytes)
 
uint8_t buffer[BUFFER_LENGTH]