Pebble 2/LE: More fun with reconnect

This commit is contained in:
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(); mOutStream.flush();
} }
} catch (IOException e) { } catch (IOException e) {
LOG.error("Error writing.", e); LOG.error("Error writing.", e.getMessage());
} }
try { try {
Thread.sleep(100); Thread.sleep(100);

View File

@ -82,6 +82,10 @@ public class PebbleLESupport {
mPipedInputStream.close(); mPipedInputStream.close();
} catch (IOException ignore) { } catch (IOException ignore) {
} }
try {
mPipedOutputStream.close();
} catch (IOException ignore) {
}
} }
void setMTU(int mtu) { 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) 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(); Thread.currentThread().interrupt();
break; break;
} catch (IOException ignore) {
} }
} }
LOG.info("Pipereader thread shut down");
} }
@Override @Override
public void interrupt() { public void interrupt() {
super.interrupt(); super.interrupt();
try { try {
LOG.info("closing piped inputstream");
mPipedInputStream.close(); mPipedInputStream.close();
} catch (IOException ignore) { } catch (IOException ignore) {
} }