Closed nmakes closed 7 years ago
Buffering/max characteristic length ?
Hey @yurik94 !
The issue was solved. It turned out that, changing the characteristic length did not help. Each packet is still restricted to 20 bytes (Bluetooth specifications), and the string passed to this function is one packet.
To solve it without hampering the library's architecture, I had to implement an additional, synchronous layer of buffer. The onSerialReceived function would would append the received string into the buffer. I wrote another thread which would run synchronously (with mutex lock applied on this additional layer of buffer), tokenize the buffer and pop out values. Basically, implementing a producer - consumer model.
Hi!
This is regarding the onSerialReceive(String theString) function, in MainActivity.
I am using a Bluno Beetle to take readings from a PPG sensor and sending the comma separated raw values over bluetooth to an Android App.
However, if I send 20 values (by appending them in a comma separated string), I receive only 5 values in one execution of the function onSerialReceive.
For eg.
If I send the following from Bluno Beetle:
"231,511,231,524,231,522,231,525,231,513,506,230,509,230,515,522,231,525,231,513"
I receive the following theString values in 4 consecutive executions of the function:
"231,511,231,524,231" ",522,231,525,231,513" ",506,230,509,230,515" ",522,231,525,231,513"
I do not receive the complete string in a go.
Debugging this is a little urgent, so I request you to kindly reply soon. Let me know if you need more information to help me out with this.
Thanks!