What steps will reproduce the problem?
1.Install VrtualBox, using x86 android image.
2.Connect XBee receiver via FT232R converter.
3.Use the example apk to receive the data with a modified rate 9600.
What is the expected output? What do you see instead?
Continuous receiving.
But get only some output at the beginning, then the app doesn't output any data
anymore.
What version of the product are you using? On what operating system?
The latest. Android x86 eepc 4.0.2 image.
One way to fix:
1.Debugging:
According to the log from LogCat, an exception threw by this:
if (totalBytesRead < MODEM_STATUS_HEADER_LENGTH) {
throw new IOException("Expected at least " + MODEM_STATUS_HEADER_LENGTH + " bytes");
}
This exception completely make the IOManager stop working.
However, add some code to figure out the value of totalBytesRead when it throws
the exception.
if(0 > totalBytesRead){
Log.d(TAG, "Bulkerror reached <0");
}
if(0==totalBytesRead){
Log.d(TAG, "Bulkerror reached ==0");
}
if(1==totalBytesRead){
Log.d(TAG, "Bulkerror reached ==1");
}
And comment the line to avoid throwing exception:
// throw new IOException("Expected at least " + MODEM_STATUS_HEADER_LENGTH + " bytes");
Then on the log(u can see it from attachment) is:
06-24 23:39:17.286: D/FtdiSerialDriver(2799): Bulkerror reached <0
According to the log it is always caused by the negative return of mConnection.
2. Way to fix:
If mConnection read failed from the buffer, the buffer might be busy but
doesn't means it stopped working.
So no need to throw a serious exception and then make the thread stop.
Code in the if branch can be modified to:
if (totalBytesRead < MODEM_STATUS_HEADER_LENGTH&&totalBytesRead>=0) {
throw new IOException("Expected at least " + MODEM_STATUS_HEADER_LENGTH + " bytes");
}
After this, the app can get consecutive data and no stop.
Please provide any additional information below.
Original issue reported on code.google.com by TangJinc...@gmail.com on 25 Jun 2013 at 9:11
Original issue reported on code.google.com by
TangJinc...@gmail.com
on 25 Jun 2013 at 9:11Attachments: