walterf25 Expert Licensed User Longtime User Nov 20, 2013 #1 Hello all, i have a Linvor bluetooth Module that i have been using for a while, it has been working great with a program written in B4A, today i started doing some data acquisition and noticed that i was not receiving the full message data on my phone, i was receiving broken messages, so I decided to try to use InitializePrefix, now the problem is that when i start the program now it won't work, i get this message i the filtered logs. java.lang.OutOfMemoryError at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:172) at java.lang.Thread.run(Thread.java:841) ** Activity (chatactivity) Pause, UserClosed = true ** Click to expand... Can anyone, maybe Erel can help me figure out what this means, the only thing i changed was Code: Copy AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStreams") to this Code: Copy AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "Astreams") I don't understand what the difference is, any help guys will be greatly appreciated. Thanks, Walter
Hello all, i have a Linvor bluetooth Module that i have been using for a while, it has been working great with a program written in B4A, today i started doing some data acquisition and noticed that i was not receiving the full message data on my phone, i was receiving broken messages, so I decided to try to use InitializePrefix, now the problem is that when i start the program now it won't work, i get this message i the filtered logs. java.lang.OutOfMemoryError at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:172) at java.lang.Thread.run(Thread.java:841) ** Activity (chatactivity) Pause, UserClosed = true ** Click to expand... Can anyone, maybe Erel can help me figure out what this means, the only thing i changed was Code: Copy AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStreams") to this Code: Copy AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "Astreams") I don't understand what the difference is, any help guys will be greatly appreciated. Thanks, Walter
Erel B4X founder Staff member Licensed User Longtime User Nov 21, 2013 #2 It is explained in the tutorial: AsyncStreams Tutorial Upvote 0
walterf25 Expert Licensed User Longtime User Nov 21, 2013 #3 Erel said: It is explained in the tutorial: AsyncStreams Tutorial Click to expand... Hi Erel thanks for the reply, i think i understand how the prefix mode works, what i don't understand is why the application crashes at this line Code: Copy AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "Astreams") it crashes even before jumping to the new data event. am i missing something? another issue is if i use only Initialize mode, it works fine, but i don't get the full data stream, i should be getting "Volt2.59" but sometimes i only get the V followed by a carriage return and then on the next line i get "olt2.59", why is that? this is driving me nuts, any suggestions Erel? Thanks, Walter Upvote 0
Erel said: It is explained in the tutorial: AsyncStreams Tutorial Click to expand... Hi Erel thanks for the reply, i think i understand how the prefix mode works, what i don't understand is why the application crashes at this line Code: Copy AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "Astreams") it crashes even before jumping to the new data event. am i missing something? another issue is if i use only Initialize mode, it works fine, but i don't get the full data stream, i should be getting "Volt2.59" but sometimes i only get the V followed by a carriage return and then on the next line i get "olt2.59", why is that? this is driving me nuts, any suggestions Erel? Thanks, Walter
Erel B4X founder Staff member Licensed User Longtime User Nov 21, 2013 #4 It is not crashing on this line. It crashes when it receives the first message. It expects the message to start with a "length header". See AsyncStreamsText class. Note that it doesn't add any new line characters. You just see it this way in the logs. Upvote 0
It is not crashing on this line. It crashes when it receives the first message. It expects the message to start with a "length header". See AsyncStreamsText class. Note that it doesn't add any new line characters. You just see it this way in the logs.