diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java index 02f60c7a..8c9665c5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java @@ -125,6 +125,7 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport { sendToDevice(bytes); } + @Override public void onReboot() { byte[] bytes = gbDeviceProtocol.encodeReboot(); sendToDevice(bytes); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleProtocol.java index 3c917d65..395b0122 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleProtocol.java @@ -115,6 +115,8 @@ public class PebbleProtocol extends GBDeviceProtocol { static final byte PUTBYTES_TYPE_FILE = 6; public static final byte PUTBYTES_TYPE_WORKER = 7; + public static final byte RESET_REBOOT = 0; + private final byte SYSTEMMESSAGE_FIRMWARESTART = 1; private final byte SYSTEMMESSAGE_FIRMWARECOMPLETE = 2; private final byte SYSTEMMESSAGE_FIRMWAREFAIL = 3; @@ -386,6 +388,13 @@ public class PebbleProtocol extends GBDeviceProtocol { return encodeMessage(ENDPOINT_APPMANAGER, APPMANAGER_GETUUIDS, 0, null); } + @Override + public byte[] encodeAppStart(UUID uuid) { + ArrayList> pairs = new ArrayList<>(); + pairs.add(new Pair<>(1, (Object) 1)); // launch + return encodeApplicationMessagePush(ENDPOINT_LAUNCHER, uuid, pairs); + } + @Override public byte[] encodeAppDelete(UUID uuid) { ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP); @@ -423,6 +432,11 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } + @Override + public byte[] encodeReboot() { + return encodeMessage(ENDPOINT_RESET, RESET_REBOOT, 0, null); + } + /* pebble specific install methods */ public byte[] encodeUploadStart(byte type, byte index, int size) { ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_UPLOADSTART); @@ -589,11 +603,6 @@ public class PebbleProtocol extends GBDeviceProtocol { return buf.array(); } - public byte[] encodeAppStart(UUID uuid) { - ArrayList> pairs = new ArrayList<>(); - pairs.add(new Pair<>(1, (Object) 1)); // launch - return encodeApplicationMessagePush(ENDPOINT_LAUNCHER, uuid, pairs); - } @Override public GBDeviceCommand decodeResponse(byte[] responseData) {