Checking Input buffer
In Sysex communication some devices often respond using several sysex blocks. Example when responding to a Dump Request. In this case, it is necessary to get the contents until the end of all blocks and for this it is necessary to make sure that all blocks have been received. I thought about checking if the buffer input is empty or not. Is there a way to check this? or some other way of ensuring that all blocks referring to the same data request have been received?
For now I am using a procedure of giving a window of time when the first message is received by the listener. I give approximately 300ms which is enough time to receive the dump, but I believe that with a buffer checker we can have a more efficient routine, because shorter messages would not have to wait that long. I understand that the listener is completely asynchronous, however in the case of sysex there is this situation that the blocks need to be collected synchronously and have a definite ending.