Android Question Async stream prefix_?

sanduro

Member
Licensed User
Longtime User
I use modified version of bluetooth example.

When I go in raw mode
AStream.Initialize(Main.serial1.InputStream, Main.serial1.OutputStream, "AStream")
everythings all right

until i switch to prefix
AStream.InitializePrefix(Main.serial1.InputStream, False, Main.serial1.OutputStream, "AStream")
getting
AStream_Terminated event
Though data should be all right

dump

8E8E8E8EFE8102010200800000000000000000003C00F00000000000A600F900000101012B6756CE
01040100010E0005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000AAAAAAAA

this is sent circulary
 

sanduro

Member
Licensed User
Longtime User
This is the data I am receving from other side, is there anything more I need to receive the data via prefix that sender side sends 4 same bytes of length on the begging of the message ?

I am just receiving the data on android so far ?

San
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
From the logs, the prefix is obviously wrong. You shouldn't see 4 equal bytes in the beginning. You should encode it the way Erel just mentioned.
 
Upvote 0

sanduro

Member
Licensed User
Longtime User
Sorry so i misunderstood, I will change it , BTW how AsyncStream knows what is the beggining of the message ????? If it catches somewhere in the middle of the message ?

THX FOR HELP
 
Upvote 0

sanduro

Member
Licensed User
Longtime User
hmmm , thats the problem I have, well then I should restart the connection on connection broke then .....

Problem i try to solve is because of wifi, bluestooth is allright and works fine, with wifi it randomly buffers messages and raises newData event randomly 1-7 seconds .... hmmm
 
Upvote 0
Top