LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - SysExBuffer.cpp (source / functions) Coverage Total Hit
Test: 73449d9b107c772cf65493691543348214e5d5eb Lines: 100.0 % 20 20
Test Date: 2026-06-06 17:44:35 Functions: 100.0 % 8 8
Legend: Lines:     hit not hit

            Line data    Source code
       1              : #include "SysExBuffer.hpp"
       2              : #include <string.h>
       3              : 
       4              : BEGIN_CS_NAMESPACE
       5              : 
       6           48 : void SysExBuffer::start() {
       7           48 :     length = 0; // if the previous message wasn't finished, overwrite it
       8           48 :     receiving = true;
       9           48 : }
      10              : 
      11           42 : void SysExBuffer::end() { receiving = false; }
      12              : 
      13          768 : void SysExBuffer::add(uint8_t data) {
      14          768 :     buffer[length] = data;
      15          768 :     ++length;
      16          768 : }
      17              : 
      18          108 : void SysExBuffer::add(const uint8_t *data, uint8_t len) {
      19          108 :     memcpy(buffer + length, data, len);
      20          108 :     length += len;
      21          108 : }
      22              : 
      23          852 : bool SysExBuffer::hasSpaceLeft(uint8_t amount) const {
      24          852 :     bool avail = length <= SYSEX_BUFFER_SIZE - amount;
      25          852 :     if (!avail)
      26              :         DEBUG(F("SysEx: Buffer full (") << amount << ')');
      27          852 :     return avail;
      28              : }
      29              : 
      30          108 : bool SysExBuffer::isReceiving() const { return receiving; }
      31              : 
      32           78 : const uint8_t *SysExBuffer::getBuffer() const { return buffer; }
      33              : 
      34           78 : uint16_t SysExBuffer::getLength() const { return length; }
      35              : 
      36              : END_CS_NAMESPACE
        

Generated by: LCOV version 2.4-beta