Android Question Prefix mode woes

ardhuru

Member
Licensed User
Longtime User
Hi folks,

This problem is not strictly that of B4A, but I'm hoping the sharp minds on this forum can help.

I have designed a pic based device that generates 7 variables, and transmits them to the Android over bluetooth.

They are Lukup (2 digits), Raw (3 digits), LL (1 digit), HL (1 digit), FS (3 digits), Empty (3 digits) and N (1 digit).

All adding up to 14 digits.

My B4A program (WHICH WAS WORKING ALL THESE MONTHS), now gives an error

'An eeror has occurred in
sub:main_astreams_newdata (java line:448)
java.lang.StringIndexOutOfBoundsException:length=14,regionStart=14;regionLength=1
Continue?

Now, I am certain I have made NO changes to the B4A app; I had played around with the pic based softare, though I feel I have NOT changed the serial string output to the bluetooth module.

The data output from the pic is in the following format:

DEBUG 14,0,0,0,Dec2 LUKUP,DEC3 RAW,DEC1 LL,DEC1 HL,DEC3 FS,DEC3 EMPTY,DEC1 N

Is there anything wrong with the data format?

The data is definitely being transmitted by the pic, as confirmed using a bluetooth terminal emulator.

This one is really driving me crazy, as I have designed both ends (the Android app as well as the pic firmware), and I knew it was working, but now just cant figure out whats wrong.

Any help would be highly appreciated, guys!

Best Regards.
 
Last edited:

ardhuru

Member
Licensed User
Longtime User
I use Picbasic Pro on the pic side; this has a command (Decx) to convert a value to a decimal of x digits; if x is larger than the number of digits required, it pads leading places with zero. For example, Dec3 27 would be 027.

The pic outputs 14 (Total digits in the data packet), 0, 0, 0, ...followed by the actual data of 7 parameters, adding to 14 digits.

Again, this WAS working, so I'm sure the problem is not with the B4A code; its something thats gone wrong at the pic side, after many iterations of which I foolishly kept no track.
 
Upvote 0
Top