B4J Question B4X BlueTooth - error connecting B4J to B4A Chat Demo - BigEndian, LittleEndian OH My!

MrKim

Well-Known Member
Licensed User
Longtime User
Wasn't sure where to put this message since it is more of a heads up than a question. Using the new B4A BlueTooth Chat example Here I couldn't connect to B4J JBlueTooth Here after playing around I found that Two B4As connected OK but if I sent a message from B4A to B4J nothing happened - AStream_NewData never fired. If I sent from B4J then B4A would fail with no error just the message "connection is broken".

While looking at the code I found this note in the new B4A:
B4X:
    'prefix mode! Change to non-prefix mode if communicating with non-B4X device.

Then, in comparing the lines in both programs:
B4X:
      AStream.InitializePrefix(serial.InputStream, False, serial.OutputStream, "astream")
I found that one is set for BigEndian (true) and the other for LittleEndian (False).

Making them both True solved the problem but it does bring up the question.
If you are trying to communicate with an unknown device is there a protocol for establishing the protocol?
 
Last edited:

MicroDrie

Well-Known Member
Licensed User
Of course not, what is the fun and what do we learn from programming?
 
Upvote 0
Top