LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - SysExBuffer.cpp (source / functions) Hit Total Coverage
Test: e224b347cd670555e44f06608ac41bd1ace9d9d8 Lines: 25 25 100.0 %
Date: 2020-09-08 17:44:46 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "SysExBuffer.hpp"
       2             : 
       3             : BEGIN_CS_NAMESPACE
       4             : 
       5          36 : void SysExBuffer::start() {
       6          36 :     SysExLength = 0; // if the previous message wasn't finished, overwrite it
       7          36 :     receiving = true;
       8          36 :     DEBUG("Start SysEx");
       9          36 : }
      10             : 
      11          36 : void SysExBuffer::end() {
      12          36 :     receiving = false;
      13          36 :     DEBUG("End SysEx");
      14          36 : }
      15             : 
      16         426 : bool SysExBuffer::add(uint8_t data) {
      17         426 :     if (!hasSpaceLeft()) // if the buffer is full
      18           4 :         return false;
      19         422 :     SysExBuffer[SysExLength] = data; // add the data to the buffer
      20         422 :     ++SysExLength;
      21         422 :     return true;
      22         426 : }
      23             : 
      24         426 : bool SysExBuffer::hasSpaceLeft() const {
      25         426 :     bool avail = SysExLength < SYSEX_BUFFER_SIZE;
      26         426 :     if (!avail)
      27           4 :         DEBUG("SysEx buffer full");
      28         852 :     return avail;
      29         426 : }
      30             : 
      31         354 : bool SysExBuffer::isReceiving() const { return receiving; }
      32             : 
      33          92 : const uint8_t *SysExBuffer::getBuffer() const { return SysExBuffer; }
      34             : 
      35          92 : size_t SysExBuffer::getLength() const { return SysExLength; }
      36             : 
      37             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-6-g40580cd