Hello everyone,
I am building an application with "SerialExample.zip" as a foundation.
I can attach the code if required, but it differs little from the example (just removed stuff I didn't need).
I am successfully receiving data on the android device via the bluetooth serial interface from Arduino based hardware.
The data format is:
-114.23,-0.40,-0.64,490,579,568,517,499,519,
-114.23,-0.36,-0.61,499,565,577,524,491,504,
-114.24,-0.43,-0.49,521,568,581,515,497,514,
I am able to read & display each line as a string on the Android device without problems.
I would like to parse this data obviously.
I dont have much of a background with vb or b4a & I ususally find there is an 'easy way' after I do it the 'hard way'.
This process is pretty easy for a .csv file by using 'loadcsv', but, unless I write the serial stream to a file, then read & parse the file I don't believe I can use loadcsv for this application.
At this stage, I am going to read the data line into a char array, break the char array up by identifying the comma char and splitting the results up to individual char arrays (or strings maybe). I then have to convert the strings to floats (like C++ atoi or atof)
I am concerned there is a much simpler approach I am missing?
The incoming data format can also be changed easily if appropriate.
A possible option to fix this was to put a CRLF between each value. This would enable the data to be populated into a list pretty easily.
Ive found a number of XML parsing examples, but as these use a dedicated library I couldn't adapt it to my purpose.
I appreciate any advice you may offer.
Best wishes,
refsmmat
I am building an application with "SerialExample.zip" as a foundation.
I can attach the code if required, but it differs little from the example (just removed stuff I didn't need).
I am successfully receiving data on the android device via the bluetooth serial interface from Arduino based hardware.
The data format is:
-114.23,-0.40,-0.64,490,579,568,517,499,519,
-114.23,-0.36,-0.61,499,565,577,524,491,504,
-114.24,-0.43,-0.49,521,568,581,515,497,514,
I am able to read & display each line as a string on the Android device without problems.
I would like to parse this data obviously.
I dont have much of a background with vb or b4a & I ususally find there is an 'easy way' after I do it the 'hard way'.
This process is pretty easy for a .csv file by using 'loadcsv', but, unless I write the serial stream to a file, then read & parse the file I don't believe I can use loadcsv for this application.
At this stage, I am going to read the data line into a char array, break the char array up by identifying the comma char and splitting the results up to individual char arrays (or strings maybe). I then have to convert the strings to floats (like C++ atoi or atof)
I am concerned there is a much simpler approach I am missing?
The incoming data format can also be changed easily if appropriate.
A possible option to fix this was to put a CRLF between each value. This would enable the data to be populated into a list pretty easily.
Ive found a number of XML parsing examples, but as these use a dedicated library I couldn't adapt it to my purpose.
I appreciate any advice you may offer.
Best wishes,
refsmmat