mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-02 20:45:23 +02:00
Pebble: implement reboot
This commit is contained in:
parent
c4f7fc1531
commit
50c7206cf6
@ -125,6 +125,7 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||||||
sendToDevice(bytes);
|
sendToDevice(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onReboot() {
|
public void onReboot() {
|
||||||
byte[] bytes = gbDeviceProtocol.encodeReboot();
|
byte[] bytes = gbDeviceProtocol.encodeReboot();
|
||||||
sendToDevice(bytes);
|
sendToDevice(bytes);
|
||||||
|
@ -115,6 +115,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
static final byte PUTBYTES_TYPE_FILE = 6;
|
static final byte PUTBYTES_TYPE_FILE = 6;
|
||||||
public static final byte PUTBYTES_TYPE_WORKER = 7;
|
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_FIRMWARESTART = 1;
|
||||||
private final byte SYSTEMMESSAGE_FIRMWARECOMPLETE = 2;
|
private final byte SYSTEMMESSAGE_FIRMWARECOMPLETE = 2;
|
||||||
private final byte SYSTEMMESSAGE_FIRMWAREFAIL = 3;
|
private final byte SYSTEMMESSAGE_FIRMWAREFAIL = 3;
|
||||||
@ -386,6 +388,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
return encodeMessage(ENDPOINT_APPMANAGER, APPMANAGER_GETUUIDS, 0, null);
|
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
|
@Override
|
||||||
public byte[] encodeAppDelete(UUID uuid) {
|
public byte[] encodeAppDelete(UUID uuid) {
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP);
|
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP);
|
||||||
@ -423,6 +432,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] encodeReboot() {
|
||||||
|
return encodeMessage(ENDPOINT_RESET, RESET_REBOOT, 0, null);
|
||||||
|
}
|
||||||
|
|
||||||
/* pebble specific install methods */
|
/* pebble specific install methods */
|
||||||
public byte[] encodeUploadStart(byte type, byte index, int size) {
|
public byte[] encodeUploadStart(byte type, byte index, int size) {
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_UPLOADSTART);
|
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_UPLOADSTART);
|
||||||
@ -589,11 +603,6 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
return buf.array();
|
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
|
@Override
|
||||||
public GBDeviceCommand decodeResponse(byte[] responseData) {
|
public GBDeviceCommand decodeResponse(byte[] responseData) {
|
||||||
|
Loading…
Reference in New Issue
Block a user