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;
|
return;
|
||||||
}
|
}
|
||||||
mPebbleLESupport.mIsConnected = true;
|
mPebbleLESupport.mIsConnected = true;
|
||||||
|
synchronized (mPebbleLESupport) {
|
||||||
|
mPebbleLESupport.notify();
|
||||||
|
}
|
||||||
LOG.info("write request: offset = " + offset + " value = " + GB.hexdump(value, 0, -1));
|
LOG.info("write request: offset = " + offset + " value = " + GB.hexdump(value, 0, -1));
|
||||||
int header = value[0] & 0xff;
|
int header = value[0] & 0xff;
|
||||||
int command = header & 7;
|
int command = header & 7;
|
||||||
|
|
|
@ -36,9 +36,11 @@ public class PebbleLESupport {
|
||||||
if (mPebbleGATTServer.initialize()) {
|
if (mPebbleGATTServer.initialize()) {
|
||||||
mPebbleGATTClient = new PebbleGATTClient(this, context, mBtDevice);
|
mPebbleGATTClient = new PebbleGATTClient(this, context, mBtDevice);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(6000);
|
synchronized (this) {
|
||||||
if (mIsConnected) {
|
wait(30000);
|
||||||
return;
|
if (mIsConnected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue