Pebble 2/LE: on connect wait 30s max and stop waiting immediately if a real PP connection got establish (ie write request on the gatt server)
This commit is contained in:
parent
3eda2d4b81
commit
bc9041a4c9
|
@ -104,6 +104,9 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
|||
return;
|
||||
}
|
||||
mPebbleLESupport.mIsConnected = true;
|
||||
synchronized (mPebbleLESupport) {
|
||||
mPebbleLESupport.notify();
|
||||
}
|
||||
LOG.info("write request: offset = " + offset + " value = " + GB.hexdump(value, 0, -1));
|
||||
int header = value[0] & 0xff;
|
||||
int command = header & 7;
|
||||
|
|
|
@ -36,10 +36,12 @@ public class PebbleLESupport {
|
|||
if (mPebbleGATTServer.initialize()) {
|
||||
mPebbleGATTClient = new PebbleGATTClient(this, context, mBtDevice);
|
||||
try {
|
||||
Thread.sleep(6000);
|
||||
synchronized (this) {
|
||||
wait(30000);
|
||||
if (mIsConnected) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue