I'm developing Android application, which is continuously receiving data from medical device. Device configured as Serial Com port.
On android 4.2.2 everything is Ok. After updating Asus K00E to Android 4.4.2 there was a problem.
After connecting device immediately begins transmitting data. For several seconds Asus receives data normally, then stops. No errors in logs.
Video here: http://youtu.be/GEc3yKVQGJc
Pay attention to the last few seconds.
Connection fragment:
protected Void ConnectToCardioBT(BluetoothDevice device) {
try {
Method m = null;
try {
m = device.getClass().getMethod("createRfcommSocket",
new Class[] { int.class });
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
try {
socket = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
socket.connect();
..........................
Read from stream fragment:
private class ConnectedThread extends Thread {
private final InputStream mmInStream;
public ConnectedThread(BluetoothSocket socket) {
InputStream tmpIn = null;
try {
tmpIn = socket.getInputStream();
} catch (IOException e) {
}
mmInStream = tmpIn;
}
public void run() {
byte[] buffer = new byte[2048];
int bytes;
while (true) {
try {
Log.d(TAG,Integer.toString(mmInStream.available())+": " + new Date().getTime());
bytes = mmInStream.read(buffer);
...............................
Any assistance is greatly appreciated.