java - Android Bluetooth Received Serial Data Garbled -


i've gone through following thread doubt. but, it's still unclear.

why serial bt data received chopped out?

chris, that's nice workaround suggested. in solutions you've provided, 1 appending '\n' suitable me i'm purely transmitting float values pc (matlab) - after converting string - android phone. i'm using following code group data searching '\n' still received data garbled up. please tell me i've change.

areader = new inputstreamreader( mminstream ); mbufferedreader = new bufferedreader( areader ); astring = mbufferedreader.readline(); mhandler.obtainmessage(bluetoothactivity.message_read, astring).sendtotarget(); 

this have in handler display data:

string readmessage = (string) msg.obj;         try{             float readm = float.parsefloat(readmessage);             text.append("\n" + readm);         }catch (numberformatexception e) {             text.append("\n number format exception!!");             e.printstacktrace();         } 

what wrong kind of reception? nice if answer bit concluding part of project , deadline nearing. thanks!

i myself solved this. changed delimiter '\n' 'n' (since no characters part of data float values) , i've achieved satisfactory transmission rate more 99% data integrity (out of 2000 samples sent @ rate of 600 samples per second matlab, 10 got garbled) @ receiver (my app). but, idea @chris stratton!


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -