mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-14 14:09:28 +01:00
Add notification responses
This commit is contained in:
parent
3c16b246a7
commit
b5a5f020a0
32
Banglejs.md
32
Banglejs.md
@ -11,24 +11,26 @@ Messages sent to Bangle.js from Phone
|
||||
|
||||
wrapped in `GB(json)\n`
|
||||
|
||||
`t:"notify", id:id, src,title,subject,body,sender,tel` - new notification
|
||||
`t:"notify-", id:id` - delete notification
|
||||
`t:"alarm", d:[{h,m},...]` - set alarms
|
||||
`t:"find", n:bool` - findDevice
|
||||
`t:"vibrate", n:int` - vibrate
|
||||
`t:"weather", temp,hum,txt,wind,loc` - weather report
|
||||
`t:"musicstate", state,position,shuffle,repeat`
|
||||
`t:"musicinfo", artist,album,track,dur,c(track count),n(track num)`
|
||||
* `t:"notify", id:int, src,title,subject,body,sender,tel:string` - new notification
|
||||
* `t:"notify-", id:int` - delete notification
|
||||
* `t:"alarm", d:[{h,m},...]` - set alarms
|
||||
* `t:"find", n:bool` - findDevice
|
||||
* `t:"vibrate", n:int` - vibrate
|
||||
* `t:"weather", temp,hum,txt,wind,loc` - weather report
|
||||
* `t:"musicstate", state,position,shuffle,repeat`
|
||||
* `t:"musicinfo", artist,album,track,dur,c(track count),n(track num)`
|
||||
|
||||
Messages from Bangle.js to Phone
|
||||
--------------------------------
|
||||
|
||||
Just raw newline-terminated JSON lines:
|
||||
|
||||
`t:"info", msg:"..."`
|
||||
`t:"warn", msg:"..."`
|
||||
`t:"error", msg:"..."`
|
||||
`t:"status", bat:0..100, volt:float(voltage)` - status update
|
||||
`t:"findPhone", n:bool`
|
||||
`t:"music", n:"play/pause/next/previous/volumeup/volumedown"`
|
||||
`t:"call", n:"ACCEPT/END/INCOMING/OUTGOING/REJECT/START/IGNORE"`
|
||||
* `t:"info", msg:"..."`
|
||||
* `t:"warn", msg:"..."`
|
||||
* `t:"error", msg:"..."`
|
||||
* `t:"status", bat:0..100, volt:float(voltage)` - status update
|
||||
* `t:"findPhone", n:bool`
|
||||
* `t:"music", n:"play/pause/next/previous/volumeup/volumedown"`
|
||||
* `t:"call", n:"ACCEPT/END/INCOMING/OUTGOING/REJECT/START/IGNORE"`
|
||||
* `t:"notify", id:int, n:"DISMISS,DISMISS_ALL/OPEN/MUTE/REPLY", `
|
||||
* if `REPLY` can use `tel:string(optional), msg:string`
|
||||
|
@ -33,6 +33,7 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInf
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventNotificationControl;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.banglejs.BangleJSConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.no1f1.No1F1Constants;
|
||||
@ -184,6 +185,18 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
deviceEventCallControl.event = GBDeviceEventCallControl.Event.valueOf(json.getString("n").toUpperCase());
|
||||
evaluateGBDeviceEvent(deviceEventCallControl);
|
||||
} break;
|
||||
case "notify" : {
|
||||
GBDeviceEventNotificationControl deviceEvtNotificationControl = new GBDeviceEventNotificationControl();
|
||||
// .title appears unused
|
||||
deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.valueOf(json.getString("n").toUpperCase());
|
||||
if (json.has("id"))
|
||||
deviceEvtNotificationControl.handle = json.getInt("id");
|
||||
if (json.has("tel"))
|
||||
deviceEvtNotificationControl.phoneNumber = json.getString("tel");
|
||||
if (json.has("msg"))
|
||||
deviceEvtNotificationControl.reply = json.getString("msg");
|
||||
evaluateGBDeviceEvent(deviceEvtNotificationControl);
|
||||
} break;
|
||||
/*case "activity": {
|
||||
BangleJSActivitySample sample = new BangleJSActivitySample();
|
||||
sample.setTimestamp((int) (GregorianCalendar.getInstance().getTimeInMillis() / 1000L));
|
||||
|
Loading…
Reference in New Issue
Block a user