Android Question Bluetooth Problem: AStream_NewData receive data from RN-42 split in two parts.

PierPaduan

Active Member
Licensed User
Longtime User
Hi,
I'm testing an RN-42 Bluetooth module communicating with Android smartphone (Samsung S3 and S4).
I started from Erel's BluetoothExample.

I initialize AStream in this way:
B4X:
AStream.Initialize(Main.serial1.InputStream, Main.serial1.OutputStream, "AStream")

Establishing connection is OK.
When Android send data to RN-42 is OK.
Then RN-42 answer to Android sending an ACK package usually long 29 bytes with 2 bytes for CRC at the end.

AStream_NewData receive usually the ACK package in two times. May be 1byte and 28bytes or 7bytes and 22bytes or else. It receive all 29 bytes in one time very rarely.

Is this situation an error or is the usual work mode for bluetooth when AStream is not in prefix?

I can recovery the ACK package anyway reconstructing it from the two parts, but I would like to avoid this.

Thanks in advance to everyone for your help.
 

DonManfred

Expert
Licensed User
Longtime User
the usual work mode for bluetooth when AStream is not in prefix?
yes. The message can be splitted. This is the expected behaviour.
 
Upvote 0
Top