Control Surface  1.1.0
MIDI Control Surface library for Arduino
SysExBuffer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Settings/SettingsWrapper.hpp>
4 
6 
7 class SysExBuffer {
8  private:
10  size_t SysExLength = 0;
11  bool receiving = false;
12 
13  public:
14  /// Start a new SysEx message.
15  void start();
16  /// Finish the current SysEx message.
17  void end();
18  /// Add a byte to the current SysEx message.
19  bool add(uint8_t data);
20  /// Check if the buffer has at least 1 byte of free space available.
21  bool hasSpaceLeft() const;
22  /// Check if the buffer is receiving a SysEx message.
23  bool isReceiving() const;
24  /// Get a pointer to the buffer.
25  const uint8_t *getBuffer() const;
26  /// Get the length of the SysEx message in the buffer.
27  size_t getLength() const;
28 };
29 
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
SysExBuffer::add
bool add(uint8_t data)
Add a byte to the current SysEx message.
Definition: SysExBuffer.cpp:16
SysExBuffer::getLength
size_t getLength() const
Get the length of the SysEx message in the buffer.
Definition: SysExBuffer.cpp:35
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
SysExBuffer::isReceiving
bool isReceiving() const
Check if the buffer is receiving a SysEx message.
Definition: SysExBuffer.cpp:31
SysExBuffer::SysExLength
size_t SysExLength
Definition: SysExBuffer.hpp:10
SysExBuffer::receiving
bool receiving
Definition: SysExBuffer.hpp:11
SysExBuffer
Definition: SysExBuffer.hpp:7
SysExBuffer::getBuffer
const uint8_t * getBuffer() const
Get a pointer to the buffer.
Definition: SysExBuffer.cpp:33
SysExBuffer::hasSpaceLeft
bool hasSpaceLeft() const
Check if the buffer has at least 1 byte of free space available.
Definition: SysExBuffer.cpp:24
SYSEX_BUFFER_SIZE
constexpr size_t SYSEX_BUFFER_SIZE
The length of the maximum System Exclusive message that can be received.
Definition: Settings/Settings.hpp:53
SysExBuffer::start
void start()
Start a new SysEx message.
Definition: SysExBuffer.cpp:5
SysExBuffer::end
void end()
Finish the current SysEx message.
Definition: SysExBuffer.cpp:11