mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-19 07:07:46 +01:00
Pebble: Fix crash when starting pebstyle
Also make code for "push" handlers more generic
This commit is contained in:
parent
4362f78028
commit
a89fea9c7d
@ -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)};
|
||||||
|
Loading…
Reference in New Issue
Block a user