Open GoogleCodeExporter opened 9 years ago
and only running this app.
Original comment by rod12...@gmail.com
on 7 May 2014 at 9:07
Please send me whole code to verify.
Original comment by i...@eurotronik.si
on 29 May 2014 at 6:49
oh i don't know your e-mail.
so, i'll write here. and simply.
base code is this android-serialport-api.
and only changed SerialPortActivity.java file.
--- original source ---------------------------
private class ReadThread extends Thread {
@Override
public void run() {
super.run();
while(!isInterrupted()) {
int size;
try {
byte[] buffer = new byte[64];
if (mInputStream == null) return;
size = mInputStream.read(buffer);
if (size > 0) {
onDataReceived(buffer, size);
}
} catch (IOException e) {
e.printStackTrace();
return;
} catch(Exception e){ }
}
}
}
---------------------------------------------------
----- and changed ---------------------------------
private class ReadThread extends Thread {
@Override
public void run() {
super.run();
while(!isInterrupted()) {
int size;
try {
byte[] buffer = new byte[64];
if (mInputStream == null) return;
size = mInputStream.read(buffer);
if (size > 0) {
onDataReceived(buffer, size);
}
} catch (IOException e) {
e.printStackTrace();
return;
} catch(Exception e){ }
try
{
Thread.sleep(1000);
}catch(InterruptedException e){ }
}
}
}
---------------------------------------------
just added
Thread.sleep(1000);
and try to send '1' -- 500ms later --> '2' -- 500ms later -> '3' ....~
then this source can't receive all of char.
Original comment by rod12...@gmail.com
on 3 Jun 2014 at 7:29
Original issue reported on code.google.com by
rod12...@gmail.com
on 7 May 2014 at 9:05