LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - SysExBuffer.cpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 20 20 100.0 %
Date: 2024-11-09 15:32:27 Functions: 8 8 100.0 %
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 1.15