Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
BLEMIDIParser Class Reference

#include <MIDI_Parsers/BLEMIDIParser.hpp>

Detailed Description

Class for parsing BLE-MIDI packets.

It doesn't parse the actual MIDI messages, it just extracts the relevant MIDI data from the BLE packets.

Definition at line 16 of file BLEMIDIParser.hpp.

Collaboration diagram for BLEMIDIParser:

Public Member Functions

 BLEMIDIParser (const uint8_t *data, size_t length)
void extend (const uint8_t *data, size_t length)
 Extend the BLE packet with the given buffer.
bool pull (uint8_t &output)
 Get the next MIDI byte from the BLE packet (if available).
uint16_t getTimestamp () const

Static Private Member Functions

static bool isData (uint8_t data)
 Check if the given byte is a data byte (and not a header, timestamp or status byte).

Private Attributes

const uint8_t * data
const uint8_t * end
bool prevWasTimestamp = true
uint16_t timestamp = 0

Constructor & Destructor Documentation

◆ BLEMIDIParser()

BLEMIDIParser ( const uint8_t * data,
size_t length )
inline

Definition at line 18 of file BLEMIDIParser.hpp.

Member Function Documentation

◆ extend()

void extend ( const uint8_t * data,
size_t length )
inline

Extend the BLE packet with the given buffer.

Precondition
The previous buffer was fully consumed (pull returned false).
Note
This function should only be used for a single packet that spans multiple buffers. If you want to parse a new packet, you should create a new BLEMIDIParser instance.

Definition at line 53 of file BLEMIDIParser.hpp.

◆ pull()

bool pull ( uint8_t & output)
inline

Get the next MIDI byte from the BLE packet (if available).

Returns
True if a byte was available, false otherwise.

Definition at line 60 of file BLEMIDIParser.hpp.

◆ getTimestamp()

uint16_t getTimestamp ( ) const
inline

Definition at line 99 of file BLEMIDIParser.hpp.

◆ isData()

bool isData ( uint8_t data)
inlinestaticprivate

Check if the given byte is a data byte (and not a header, timestamp or status byte).

Definition at line 110 of file BLEMIDIParser.hpp.

Member Data Documentation

◆ data

const uint8_t* data
private

Definition at line 102 of file BLEMIDIParser.hpp.

◆ end

const uint8_t* end
private

Definition at line 103 of file BLEMIDIParser.hpp.

◆ prevWasTimestamp

bool prevWasTimestamp = true
private

Definition at line 104 of file BLEMIDIParser.hpp.

◆ timestamp

uint16_t timestamp = 0
private

Definition at line 105 of file BLEMIDIParser.hpp.


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