Stateful decoder. More...
#include <ble_midi.hpp>
Public Types | |
| using | MessageCallback |
Public Member Functions | |
| void | set_message_callback (MessageCallback cb) |
| bool | decode (const uint8_t *data, std::size_t size) |
| Feed one notification packet. | |
| void | reset () |
| Reset running status + the in-flight sysex buffer. | |
Stateful decoder.
Feed BLE GATT notification bytes via decode(); each decoded MIDI message arrives on the registered callback with a millisecond timestamp reconstructed from the BLE packet header.
| bool pulp::midi::BleMidiPacketDecoder::decode | ( | const uint8_t * | data, |
| std::size_t | size ) |
Feed one notification packet.
Returns true if the packet was well-formed (header + at least one timestamp byte + status). Malformed packets are dropped to satisfy spec section 3 — the decoder does not throw and recovers on the next packet.
| void pulp::midi::BleMidiPacketDecoder::reset | ( | ) |
Reset running status + the in-flight sysex buffer.
Call after a disconnect or when the host knows the stream has been interrupted (e.g. OS sleep/wake).
|
inline |