1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Pebble: Propagate watch apps launches outside of PebbleProtocol

This does not do anything yet.
This commit is contained in:
Andreas Shimokawa 2016-12-11 20:25:46 +01:00
parent daf6d12c62
commit 31122f0b09
3 changed files with 24 additions and 4 deletions

View File

@ -12,12 +12,14 @@ public class GBDeviceEventAppManagement extends GBDeviceEvent {
UNKNOWN, UNKNOWN,
INSTALL, INSTALL,
DELETE, DELETE,
START,
STOP,
} }
public enum Event { public enum Event {
UNKNOWN, UNKNOWN,
SUCCESS, SUCCESS,
ACKNOLEDGE, ACKNOWLEDGE,
FAILURE, FAILURE,
REQUEST, REQUEST,
} }

View File

@ -562,6 +562,9 @@ class PebbleIoThread extends GBDeviceIoThread {
break; break;
} }
break; break;
case START:
LOG.info("got GBDeviceEventAppManagement START event for uuid: " + appMgmt.uuid);
break;
default: default:
break; break;
} }

View File

@ -1915,7 +1915,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
if (handler != null) { if (handler != null) {
return handler.pushMessage(); return handler.pushMessage();
} }
break; else {
GBDeviceEventAppManagement gbDeviceEventAppManagement = new GBDeviceEventAppManagement();
gbDeviceEventAppManagement.uuid = uuid;
gbDeviceEventAppManagement.type = GBDeviceEventAppManagement.EventType.START;
gbDeviceEventAppManagement.event = GBDeviceEventAppManagement.Event.SUCCESS;
return new GBDeviceEvent[] {gbDeviceEventAppManagement};
}
case APPRUNSTATE_STOP: case APPRUNSTATE_STOP:
LOG.info(ENDPOINT_NAME + ": stopped " + uuid); LOG.info(ENDPOINT_NAME + ": stopped " + uuid);
break; break;
@ -2246,9 +2252,18 @@ public class PebbleProtocol extends GBDeviceProtocol {
} }
} else { } else {
try { try {
if (endpoint == ENDPOINT_APPLICATIONMESSAGE) {
devEvts = decodeDictToJSONAppMessage(uuid, buf); devEvts = decodeDictToJSONAppMessage(uuid, buf);
}
else {
GBDeviceEventAppManagement gbDeviceEventAppManagement = new GBDeviceEventAppManagement();
gbDeviceEventAppManagement.uuid = uuid;
gbDeviceEventAppManagement.type = GBDeviceEventAppManagement.EventType.START;
gbDeviceEventAppManagement.event = GBDeviceEventAppManagement.Event.SUCCESS;
devEvts = new GBDeviceEvent[] {gbDeviceEventAppManagement};
}
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); LOG.error(e.getMessage());
return null; return null;
} }
} }