Pebble 2/LE: More fun with reconnect

here
Andreas Shimokawa 2016-11-30 23:56:58 +01:00
parent b878fa5eda
commit 74c20f3a82
2 changed files with 9 additions and 3 deletions

View File

@ -473,7 +473,7 @@ class PebbleIoThread extends GBDeviceIoThread {
mOutStream.flush();
}
} catch (IOException e) {
LOG.error("Error writing.", e);
LOG.error("Error writing.", e.getMessage());
}
try {
Thread.sleep(100);

View File

@ -82,6 +82,10 @@ public class PebbleLESupport {
mPipedInputStream.close();
} catch (IOException ignore) {
}
try {
mPipedOutputStream.close();
} catch (IOException ignore) {
}
}
void setMTU(int mtu) {
@ -126,18 +130,20 @@ public class PebbleLESupport {
}
Thread.sleep(500); // FIXME ugly wait 0.5s after each pebble package send to the pebble (we do not wait for the GATT chunks)
} catch (InterruptedIOException | InterruptedException e) {
} catch (IOException | InterruptedException e) {
LOG.info(e.getMessage());
Thread.currentThread().interrupt();
break;
} catch (IOException ignore) {
}
}
LOG.info("Pipereader thread shut down");
}
@Override
public void interrupt() {
super.interrupt();
try {
LOG.info("closing piped inputstream");
mPipedInputStream.close();
} catch (IOException ignore) {
}