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:
Andreas Shimokawa 2016-11-10 11:05:32 +01:00
parent 1fcd7d8144
commit f68bbe453b
2 changed files with 10 additions and 14 deletions

View File

@ -181,9 +181,9 @@ class PebbleIoThread extends GBDeviceIoThread {
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress);
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");
mInStream = new PipedInputStream(new PipedOutputStream()); // fake so that io blocks
mOutStream = new PipedOutputStream(new PipedInputStream()); // fake so that io blocks
//new PebbleLESupport(this.getContext(),btDeviceAddress); // secret branch :P
mInStream = new PipedInputStream(); // fake so that io blocks
mOutStream = new PipedOutputStream(); // fake so that io blocks
//new PebbleLESupport(this.getContext(),btDeviceAddress,(PipedInputStream)mInStream,(PipedOutputStream)mOutStream); // secret branch :P
}
else {
ParcelUuid uuids[] = btDevice.getUuids();
@ -323,9 +323,10 @@ class PebbleIoThread extends GBDeviceIoThread {
}
int bytes = mInStream.read(buffer, 0, 4);
if (bytes < 4) {
continue;
while (bytes < 4) {
bytes += mInStream.read(buffer, bytes, 4 - bytes);
}
ByteBuffer buf = ByteBuffer.wrap(buffer);
buf.order(ByteOrder.BIG_ENDIAN);
short length = buf.getShort();
@ -340,11 +341,6 @@ class PebbleIoThread extends GBDeviceIoThread {
bytes = mInStream.read(buffer, 4, length);
while (bytes < length) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
bytes += mInStream.read(buffer, bytes + 4, length - bytes);
}

View File

@ -1297,11 +1297,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
buf.putInt(os);
buf.put(PHONEVERSION_APPVERSION_MAGIC);
buf.put((byte) 3); // major
buf.put((byte) 12); // minor
buf.put((byte) 0); // patch
buf.put((byte) 4); // major
buf.put((byte) 1); // minor
buf.put((byte) 1); // patch
buf.order(ByteOrder.LITTLE_ENDIAN);
buf.putLong(0x00000000000001af); //flags
buf.putLong(0x00000000000029af); //flags
return buf.array();
}