Pebble: implement reboot
This commit is contained in:
parent
c4f7fc1531
commit
50c7206cf6
|
@ -125,6 +125,7 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReboot() {
|
||||
byte[] bytes = gbDeviceProtocol.encodeReboot();
|
||||
sendToDevice(bytes);
|
||||
|
|
|
@ -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<Pair<Integer, Object>> 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<Pair<Integer, Object>> pairs = new ArrayList<>();
|
||||
pairs.add(new Pair<>(1, (Object) 1)); // launch
|
||||
return encodeApplicationMessagePush(ENDPOINT_LAUNCHER, uuid, pairs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GBDeviceCommand decodeResponse(byte[] responseData) {
|
||||
|
|
Loading…
Reference in New Issue