Pebble: bump flags and version we report
Plus some small preparations for P2 support which do not hurt in master
This commit is contained in:
parent
1fcd7d8144
commit
f68bbe453b
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble
|
@ -181,9 +181,9 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
|
||||||
if (btDevice.getType() == BluetoothDevice.DEVICE_TYPE_LE) {
|
if (btDevice.getType() == BluetoothDevice.DEVICE_TYPE_LE) {
|
||||||
LOG.info("Ok this seems to be a LE Pebble, will try something that does not work :P");
|
LOG.info("Ok this seems to be a LE Pebble, will try something that does not work :P");
|
||||||
mInStream = new PipedInputStream(new PipedOutputStream()); // fake so that io blocks
|
mInStream = new PipedInputStream(); // fake so that io blocks
|
||||||
mOutStream = new PipedOutputStream(new PipedInputStream()); // fake so that io blocks
|
mOutStream = new PipedOutputStream(); // fake so that io blocks
|
||||||
//new PebbleLESupport(this.getContext(),btDeviceAddress); // secret branch :P
|
//new PebbleLESupport(this.getContext(),btDeviceAddress,(PipedInputStream)mInStream,(PipedOutputStream)mOutStream); // secret branch :P
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ParcelUuid uuids[] = btDevice.getUuids();
|
ParcelUuid uuids[] = btDevice.getUuids();
|
||||||
|
@ -323,9 +323,10 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
}
|
}
|
||||||
int bytes = mInStream.read(buffer, 0, 4);
|
int bytes = mInStream.read(buffer, 0, 4);
|
||||||
|
|
||||||
if (bytes < 4) {
|
while (bytes < 4) {
|
||||||
continue;
|
bytes += mInStream.read(buffer, bytes, 4 - bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.wrap(buffer);
|
ByteBuffer buf = ByteBuffer.wrap(buffer);
|
||||||
buf.order(ByteOrder.BIG_ENDIAN);
|
buf.order(ByteOrder.BIG_ENDIAN);
|
||||||
short length = buf.getShort();
|
short length = buf.getShort();
|
||||||
|
@ -340,11 +341,6 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
|
|
||||||
bytes = mInStream.read(buffer, 4, length);
|
bytes = mInStream.read(buffer, 4, length);
|
||||||
while (bytes < length) {
|
while (bytes < length) {
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
bytes += mInStream.read(buffer, bytes + 4, length - bytes);
|
bytes += mInStream.read(buffer, bytes + 4, length - bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1297,11 +1297,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
buf.putInt(os);
|
buf.putInt(os);
|
||||||
|
|
||||||
buf.put(PHONEVERSION_APPVERSION_MAGIC);
|
buf.put(PHONEVERSION_APPVERSION_MAGIC);
|
||||||
buf.put((byte) 3); // major
|
buf.put((byte) 4); // major
|
||||||
buf.put((byte) 12); // minor
|
buf.put((byte) 1); // minor
|
||||||
buf.put((byte) 0); // patch
|
buf.put((byte) 1); // patch
|
||||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
buf.putLong(0x00000000000001af); //flags
|
buf.putLong(0x00000000000029af); //flags
|
||||||
|
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue