Skip to content

Commit dbeadf5

Browse files
committed
events return a pointer to this for easy event chaining
1 parent 950ff4e commit dbeadf5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/BLEMIDI_Transport.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,26 @@ class BLEMIDI_Transport
180180
void (*_connectedCallback)() = nullptr;
181181
void (*_disconnectedCallback)() = nullptr;
182182

183-
void setName(const char *deviceName)
184-
{
183+
BLEMIDI_Transport &setName(const char *deviceName)
184+
{
185185
strncpy(mDeviceName, deviceName, sizeof(mDeviceName));
186+
return *this;
186187
};
187188

188189
public:
189-
void setHandleConnected(void (*fptr)())
190+
BLEMIDI_Transport &setHandleConnected(void (*fptr)())
190191
{
191192
_connectedCallback = fptr;
193+
return *this;
192194
}
193195

194-
void setHandleDisconnected(void (*fptr)())
196+
BLEMIDI_Transport &setHandleDisconnected(void (*fptr)())
195197
{
196198
_disconnectedCallback = fptr;
199+
return *this;
197200
}
198201

199-
/*
202+
/*
200203
The general form of a MIDI message follows:
201204
n-byte MIDI Message
202205
Byte 0 MIDI message Status byte, Bit 7 is Set to 1.
@@ -227,12 +230,12 @@ class BLEMIDI_Transport
227230
from other messages – except for System Exclusive messages.
228231
*/
229232

230-
/**
233+
/**
231234
* If #define RUNNING_ENABLE is commented/disabled, it will transform all incoming runningStatus messages in full midi messages.
232235
* Else, it will put in the buffer the same info that it had received (runningStatus will be not transformated).
233236
* It recommend not use runningStatus by default. Only use if parser accepts runningStatus and your application has a so high transmission rate.
234237
*/
235-
#define RUNNING_ENABLE
238+
#define RUNNING_ENABLE
236239

237240
void receive(byte *buffer, size_t length)
238241
{

0 commit comments

Comments
 (0)