From 4ff35f0787823090a7b408231d51e7f89ed57756 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 9 Aug 2023 09:16:33 +0100 Subject: [PATCH] minor tweaks after #2889 --- apps/android/boot.js | 7 +- apps/gbridge/PROTOCOL.md | 211 +-------------------------------------- 2 files changed, 4 insertions(+), 214 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 54b1cc8f4..a8027a67c 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -292,10 +292,9 @@ require("messages").clearAll(); }); setInterval(sendBattery, 10*60*1000); - // Health tracking - Bangle.on('health', health=>{ - if (actInterval===undefined) // if 'realtime' we do it differently - gbSend({ t: "act", stp: health.steps, hrm: health.bpm }); + // Health tracking - if 'realtime' data is sent with 'rt:1', but let's still send our activity log every 10 mins + Bangle.on('health', h=>{ + gbSend({ t: "act", stp: h.steps, hrm: h.bpm, mov: h.movement }); }); // Music control Bangle.musicControl = cmd => { diff --git a/apps/gbridge/PROTOCOL.md b/apps/gbridge/PROTOCOL.md index cb86a1314..2147dc049 100644 --- a/apps/gbridge/PROTOCOL.md +++ b/apps/gbridge/PROTOCOL.md @@ -1,210 +1 @@ -# Watch -> Phone - -## show toast - -``` -{ "t": "info", "msg": "message" } -``` - -t can be one of "info", "warn", "error" - -## report battery level - -``` -{ "t": "status", "bat": 30, "volt": 30, "chg": 0 } -``` - -* bat is in range 0 to 100 -* volt is optional and should be greater than 0 -* chg is optional and should be either 0 or 1 to indicate the watch is charging - -## find phone - -``` -{ "t": "findPhone", "n": true } -``` - -n is an boolean and toggles the find phone function - -## control music player - -``` -{ "t": "music", "n": "play" } -``` - -n can be one of "play", "pause", "playpause", "next", "previous", "volumeup", "volumedown", "forward", "rewind" - -## control phone call - -``` -{ "t": "call", "n": "accept"} -``` - -n can be one of "accept", "end", "incoming", "outcoming", "reject", "start", "ignore" - -## react to notifications - -Send a response to a notification from phone - -``` -{ - "t": "notify", - "n": "dismiss", - "id": 2, - "tel": "+491234", - "msg": "message", -} -``` - -* n can be one of "dismiss", "dismiss all", "open", "mute", "reply" -* id, tel and message are optional - -## activity data - -```json -{ - "t": "act", - "ts": 1692226800000, - "stp": 26, - "hrm": 70, - "mov": 10, - "rt": 1 -} -``` - -* `ts` is the sample timestamp, in milliseconds since the unix epoch -* `stp` is the number of steps -* `hrm` is heart rate, in bpm -* `mov` is the movement intensity (todo: range?) -* `rt` whether it is a real-time sample - - -# Phone -> Watch - -## show notification - -``` -{ - "t": "notify", - "id": 2, - "src": "app", - "title": "titel", - "subject": "subject", - "body": "message body", - "sender": "sender", - "tel": "+491234" - } -``` - -## notification deleted - -This event is send when the user skipped a notification - -``` -{ "t": "notify-", "id": 2 } -``` - -## set alarm - -``` -{ - "t": "alarm", - "d": [ - { "h": 13, "m": 37 }, - { "h": 8, "m": 0 } - ] -} -``` - -## call state changed - -``` -{ - "t": "call", - "cmd": "accept", - "name": "name", - "number": "+491234" -} -``` - -cmd can be one of "", "undefined", "accept", "incoming", "outgoing", "reject", "start", "end" - -## music state changed - -``` -{ - "t": "musicstate", - "state": "play", - "position": 40, - "shuffle": 0, - "repeat": 1 -} -``` - -## set music info - -``` -{ - "t": "musicinfo", - "artist": "artist", - "album": "album", - "track": "track", - "dur": 1, - "c": 2, - "n" 3 -} -``` - -* dur is the duration of the track -* c is the track count -* n is the track number - -## find device - -``` -{ - "t": "find", - "n": true -} -``` - -n toggles find device functionality - -## set constant vibration - -``` -{ - "t": "vibrate", - "n": 2 -} -``` - -n is the intensity - -## send weather - -``` -{ - "t": "weather", - "temp": 10, - "hum": 71, - "txt": "condition", - "wind": 13, - "loc": "location" -} -``` - -* hum is the humidity -* txt is the weather condition -* loc is the location - -## fetch activity data - -```json -{ - "t": "actfetch", - "ts": 1692226800000 -} -``` - -* `ts` is the start timestamp, in milliseconds since the unix epoch +For up to date protocol info, please see http://www.espruino.com/Gadgetbridge