mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Pebble: Fix crash when starting pebstyle
Also make code for "push" handlers more generic
This commit is contained in:
@@ -1722,7 +1722,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GBDeviceEvent decodeAppRunState(ByteBuffer buf) {
|
private GBDeviceEvent[] decodeAppRunState(ByteBuffer buf) {
|
||||||
byte command = buf.get();
|
byte command = buf.get();
|
||||||
long uuid_high = buf.getLong();
|
long uuid_high = buf.getLong();
|
||||||
long uuid_low = buf.getLong();
|
long uuid_low = buf.getLong();
|
||||||
@@ -1731,9 +1731,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
switch (command) {
|
switch (command) {
|
||||||
case APPRUNSTATE_START:
|
case APPRUNSTATE_START:
|
||||||
LOG.info(ENDPOINT_NAME + ": started " + uuid);
|
LOG.info(ENDPOINT_NAME + ": started " + uuid);
|
||||||
if (UUID_PEBSTYLE.equals(uuid)) {
|
|
||||||
AppMessageHandler handler = mAppMessageHandlers.get(uuid);
|
AppMessageHandler handler = mAppMessageHandlers.get(uuid);
|
||||||
return handler.pushMessage()[0];
|
if (handler != null) {
|
||||||
|
return handler.pushMessage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case APPRUNSTATE_STOP:
|
case APPRUNSTATE_STOP:
|
||||||
@@ -2091,7 +2092,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
devEvts = new GBDeviceEvent[]{decodeSystemMessage(buf)};
|
devEvts = new GBDeviceEvent[]{decodeSystemMessage(buf)};
|
||||||
break;
|
break;
|
||||||
case ENDPOINT_APPRUNSTATE:
|
case ENDPOINT_APPRUNSTATE:
|
||||||
devEvts = new GBDeviceEvent[]{decodeAppRunState(buf)};
|
devEvts = decodeAppRunState(buf);
|
||||||
break;
|
break;
|
||||||
case ENDPOINT_BLOBDB:
|
case ENDPOINT_BLOBDB:
|
||||||
devEvts = new GBDeviceEvent[]{decodeBlobDb(buf)};
|
devEvts = new GBDeviceEvent[]{decodeBlobDb(buf)};
|
||||||
|
Reference in New Issue
Block a user