Updates not received when calling updateValueCallback repeatedly
See original GitHub issueHi, thanks for an awesome library! Im experiencing an issue at the moment but Im not sure whether its in Android or Bleno. (Im communicating with Bleno from an Android device)
Im using Bleno like a Socket (One characteristic and write data back and forth on it). The data can be bigger than the notification size limit, so Im splitting it into chunks (if neccessary) and sending this.updateValueCallback(chunk);
for each chunk.
Everything works as expected with up to exactly 9 chunks. When adding a 10th Chunk, I don’t receive anything on my Android device (Not the first 9 either). I experimented with adding Sleep()
calls between sending each Chunk. With short sleeps (like 5 ms) there is no difference. With longer sleeps (1 second) it starts to work again (I receive the characteristic updates on Android).
So Im wondering if this is an issue with Bleno or with Android. If its an Android issue, feel free to ignore it 😃
Issue Analytics
- State:
- Created 8 years ago
- Comments:17
I solved that issue by using a
toSend
stack. I then useonIndicate
(which is sent when a packaged as been successfully received) to check if toSend is empty. If not i callupdateValueCallback
andslice
the stackNo more need for a sleep timer
Another update: running under Raspbian on a Raspberry Pi 3 B+, I don’t need any wait at all. Using indicate does the right thing so that onIndicate() is really only getting called once the chunk is successfully sent. Is the faulty behavior a known issue on the Mac?