AndroidBluetoothLibrary icon indicating copy to clipboard operation
AndroidBluetoothLibrary copied to clipboard

OnReadyRead only when bufferSize is reached

Open Shunt22 opened this issue 4 years ago • 2 comments

As mentioned in #41 OnDataRead will be called when a characterDelimiter is received, or when the total data received exceeds the character limit of bufferSize.

Originally posted by @douglasjunior in https://github.com/douglasjunior/AndroidBluetoothLibrary/issues/41#issuecomment-787958999

Is there anyway to set OnDataRead to be called ONLY when config.bufferSize is reached? I don't care about character delimiter. Just want to read fixed-size portions of data.

Shunt22 avatar Dec 08 '21 13:12 Shunt22

You can pass a characterDelimiter that never will be received by your device.

douglasjunior avatar Dec 08 '21 14:12 douglasjunior

You can pass a characterDelimiter that never will be received by your device.

In my case I transfer pretty much random data bytes (audio data), so I can't for sure say which character will never appear. I tried '\n', '\0',0x00, etc as characterDelimiter, but these characters sometimes occur in data stream and OnDataRead is called.

Shunt22 avatar Dec 08 '21 14:12 Shunt22