1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-07 05:38:13 +02:00

Pebble: Speed up app/firmware installation by sending 2000 bytes at once instead of 512. Closes #22.

This commit is contained in:
Andreas Shimokawa 2015-04-27 01:15:03 +02:00
parent 29d4f7d615
commit 2eb62ebff3

View File

@ -146,9 +146,14 @@ public class PebbleIoThread extends GBDeviceIoThread {
}
break;
case APP_UPLOAD_CHUNK:
int bytes = mZis.read(buffer);
int bytes = 0;
do {
int read = mZis.read(buffer, bytes, 2000 - bytes);
if (read <= 0) break;
bytes += read;
} while (bytes < 2000);
if (bytes != -1) {
if (bytes > 0) {
writeInstallApp(mPebbleProtocol.encodeUploadChunk(mAppInstallToken, buffer, bytes));
mAppInstallToken = -1;
mInstallState = PebbleAppInstallState.APP_WAIT_TOKEN;