add gadgetbridge app, plus ad versions

pull/66/head
Gordon Williams 2019-12-05 14:48:36 +00:00
parent 24269067b9
commit bcf0f80d29
6 changed files with 213 additions and 12 deletions

View File

@ -1,18 +1,8 @@
[ [
{ "id": "clck3x2",
"name": "3x2 Pixel Clock",
"icon": "clock3x2.png",
"description": "This is a simple clock using minimalistic 3x2 pixel numerical digits",
"tags": "clock",
"storage": [
{"name":"+clck3x2","url":"clock3x2.json"},
{"name":"-clck3x2","url":"clock3x2.js"},
{"name":"*clck3x2","url":"clock3x2-icon.js","evaluate":true}
]
},
{ "id": "boot", { "id": "boot",
"name": "Bootloader", "name": "Bootloader",
"icon": "bootloader.png", "icon": "bootloader.png",
"version":"0.01",
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
"tags": "tool,system", "tags": "tool,system",
"storage": [ "storage": [
@ -20,9 +10,23 @@
], ],
"sortorder" : -10 "sortorder" : -10
}, },
{ "id": "gbridge",
"name": "Gadgetbridge",
"icon": "app.png",
"version":"0.01",
"description": "The default notification handler for Gadgetbridge notifications from Android",
"tags": "tool,system,android",
"storage": [
{"name":"+gbridge","url":"app.json"},
{"name":"-gbridge","url":"app.js"},
{"name":"*gbridge","url":"app-icon.js","evaluate":true},
{"name":"=gbridge","url":"widget.js"}
]
},
{ "id": "mclock", { "id": "mclock",
"name": "Morphing Clock", "name": "Morphing Clock",
"icon": "clock-morphing.png", "icon": "clock-morphing.png",
"version":"0.01",
"description": "7 segment clock that morphs between minutes and hours", "description": "7 segment clock that morphs between minutes and hours",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",
@ -37,6 +41,7 @@
{ "id": "setting", { "id": "setting",
"name": "Settings", "name": "Settings",
"icon": "settings.png", "icon": "settings.png",
"version":"0.01",
"description": "A menu for setting up Bangle.js - by default this disables Bluetooth unless you enable 'BLE' AND 'Dev'", "description": "A menu for setting up Bangle.js - by default this disables Bluetooth unless you enable 'BLE' AND 'Dev'",
"tags": "tool,system", "tags": "tool,system",
"storage": [ "storage": [
@ -51,6 +56,7 @@
{ "id": "wclock", { "id": "wclock",
"name": "Word Clock", "name": "Word Clock",
"icon": "clock-word.png", "icon": "clock-word.png",
"version":"0.01",
"description": "Display Time as Text", "description": "Display Time as Text",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",
@ -64,6 +70,7 @@
{ "id": "aclock", { "id": "aclock",
"name": "Analog Clock", "name": "Analog Clock",
"icon": "clock-analog.png", "icon": "clock-analog.png",
"version":"0.01",
"description": "An Analog Clock", "description": "An Analog Clock",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",
@ -74,9 +81,22 @@
{"name":"*aclock","url":"clock-analog-icon.js","evaluate":true} {"name":"*aclock","url":"clock-analog-icon.js","evaluate":true}
] ]
}, },
{ "id": "clck3x2",
"name": "3x2 Pixel Clock",
"icon": "clock3x2.png",
"version":"0.01",
"description": "This is a simple clock using minimalistic 3x2 pixel numerical digits",
"tags": "clock",
"storage": [
{"name":"+clck3x2","url":"clock3x2.json"},
{"name":"-clck3x2","url":"clock3x2.js"},
{"name":"*clck3x2","url":"clock3x2-icon.js","evaluate":true}
]
},
{ "id": "trex", { "id": "trex",
"name": "T-Rex", "name": "T-Rex",
"icon": "trex.png", "icon": "trex.png",
"version":"0.01",
"description": "T-Rex game in the style of Chrome's offline game", "description": "T-Rex game in the style of Chrome's offline game",
"tags": "game", "tags": "game",
"allow_emulator":true, "allow_emulator":true,
@ -89,6 +109,7 @@
{ "id": "astroid", { "id": "astroid",
"name": "Asteroids!", "name": "Asteroids!",
"icon": "asteroids.png", "icon": "asteroids.png",
"version":"0.01",
"description": "Retro asteroids game", "description": "Retro asteroids game",
"tags": "game", "tags": "game",
"allow_emulator":true, "allow_emulator":true,
@ -101,6 +122,7 @@
{ "id": "clickms", { "id": "clickms",
"name": "Click Master", "name": "Click Master",
"icon": "click-master.png", "icon": "click-master.png",
"version":"0.01",
"description": "Get several friends to start the game, then compete to see who can press BTN1 the most!", "description": "Get several friends to start the game, then compete to see who can press BTN1 the most!",
"tags": "game", "tags": "game",
"storage": [ "storage": [
@ -112,6 +134,7 @@
{ "id": "horsey", { "id": "horsey",
"name": "Horse Race!", "name": "Horse Race!",
"icon": "horse-race.png", "icon": "horse-race.png",
"version":"0.01",
"description": "Get several friends to start the game, then compete to see who can press BTN1 the most!", "description": "Get several friends to start the game, then compete to see who can press BTN1 the most!",
"tags": "game", "tags": "game",
"storage": [ "storage": [
@ -123,6 +146,7 @@
{ "id": "compass", { "id": "compass",
"name": "Compass", "name": "Compass",
"icon": "compass.png", "icon": "compass.png",
"version":"0.01",
"description": "Simple compass that points North", "description": "Simple compass that points North",
"tags": "tool,outdoors", "tags": "tool,outdoors",
"storage": [ "storage": [
@ -134,6 +158,7 @@
{ "id": "gpstime", { "id": "gpstime",
"name": "GPS Time", "name": "GPS Time",
"icon": "gpstime.png", "icon": "gpstime.png",
"version":"0.01",
"description": "Update the Bangle.js's clock based on the time from the GPS receiver", "description": "Update the Bangle.js's clock based on the time from the GPS receiver",
"tags": "tool", "tags": "tool",
"storage": [ "storage": [
@ -145,6 +170,7 @@
{ "id": "openloc", { "id": "openloc",
"name": "Open Location / Plus Codes", "name": "Open Location / Plus Codes",
"icon": "openlocation.png", "icon": "openlocation.png",
"version":"0.01",
"description": "Convert your current GPS location to a series of characters", "description": "Convert your current GPS location to a series of characters",
"tags": "tool,outdoors", "tags": "tool,outdoors",
"storage": [ "storage": [
@ -155,6 +181,7 @@
{ "id": "speedo", { "id": "speedo",
"name": "Speedo", "name": "Speedo",
"icon": "speedo.png", "icon": "speedo.png",
"version":"0.01",
"description": "Show the current speed according to the GPS", "description": "Show the current speed according to the GPS",
"tags": "tool,outdoors", "tags": "tool,outdoors",
"storage": [ "storage": [
@ -166,6 +193,7 @@
{ "id": "slevel", { "id": "slevel",
"name": "Spirit Level", "name": "Spirit Level",
"icon": "spiritlevel.png", "icon": "spiritlevel.png",
"version":"0.01",
"description": "Show the current angle of the watch, so you can use it to make sure something is absolutely flat", "description": "Show the current angle of the watch, so you can use it to make sure something is absolutely flat",
"tags": "tool", "tags": "tool",
"storage": [ "storage": [
@ -177,6 +205,7 @@
{ "id": "files", { "id": "files",
"name": "App Manager", "name": "App Manager",
"icon": "files.png", "icon": "files.png",
"version":"0.01",
"description": "Show currently installed apps, free space, and allow their deletion from the watch", "description": "Show currently installed apps, free space, and allow their deletion from the watch",
"tags": "tool,system", "tags": "tool,system",
"storage": [ "storage": [
@ -188,6 +217,7 @@
{ "id": "sbat", { "id": "sbat",
"name": "Battery Level Widget", "name": "Battery Level Widget",
"icon": "widget-battery.png", "icon": "widget-battery.png",
"version":"0.01",
"description": "Show the current battery level and charging status in the top right of the clock", "description": "Show the current battery level and charging status in the top right of the clock",
"tags": "widget,battery", "tags": "widget,battery",
"type":"widget", "type":"widget",
@ -199,6 +229,7 @@
{ "id": "sbt", { "id": "sbt",
"name": "Bluetooth Widget", "name": "Bluetooth Widget",
"icon": "widget-bluetooth.png", "icon": "widget-bluetooth.png",
"version":"0.01",
"description": "Show the current Bluetooth connection status in the top right of the clock", "description": "Show the current Bluetooth connection status in the top right of the clock",
"tags": "widget,bluetooth", "tags": "widget,bluetooth",
"type":"widget", "type":"widget",
@ -210,6 +241,7 @@
{ "id": "hrm", { "id": "hrm",
"name": "Heart Rate Monitor", "name": "Heart Rate Monitor",
"icon": "heartrate.png", "icon": "heartrate.png",
"version":"0.01",
"description": "Measure your current heart rate", "description": "Measure your current heart rate",
"tags": "health", "tags": "health",
"storage": [ "storage": [
@ -221,6 +253,7 @@
{ "id": "swatch", { "id": "swatch",
"name": "Stopwatch", "name": "Stopwatch",
"icon": "stopwatch.png", "icon": "stopwatch.png",
"version":"0.01",
"description": "Simple stopwatch with Lap Time recording", "description": "Simple stopwatch with Lap Time recording",
"tags": "health", "tags": "health",
"allow_emulator":true, "allow_emulator":true,
@ -233,6 +266,7 @@
{ "id": "hidmsic", { "id": "hidmsic",
"name": "Bluetooth Music Controls", "name": "Bluetooth Music Controls",
"icon": "hid-music.png", "icon": "hid-music.png",
"version":"0.01",
"description": "Enable HID in settings, pair with your phone, then use this app to control music from your watch!", "description": "Enable HID in settings, pair with your phone, then use this app to control music from your watch!",
"tags": "bluetooth", "tags": "bluetooth",
"storage": [ "storage": [
@ -244,6 +278,7 @@
{ "id": "hidkbd", { "id": "hidkbd",
"name": "Bluetooth Keyboard", "name": "Bluetooth Keyboard",
"icon": "hid-keyboard.png", "icon": "hid-keyboard.png",
"version":"0.01",
"description": "Enable HID in settings, pair with your phone/PC, then use this app to control other apps", "description": "Enable HID in settings, pair with your phone/PC, then use this app to control other apps",
"tags": "bluetooth", "tags": "bluetooth",
"storage": [ "storage": [
@ -255,6 +290,7 @@
{ "id": "hidbkbd", { "id": "hidbkbd",
"name": "Binary Bluetooth Keyboard", "name": "Binary Bluetooth Keyboard",
"icon": "hid-binary-keyboard.png", "icon": "hid-binary-keyboard.png",
"version":"0.01",
"description": "Enable HID in settings, pair with your phone/PC, then type messages using the onscreen keyboard by tapping repeatedly on the key you want", "description": "Enable HID in settings, pair with your phone/PC, then type messages using the onscreen keyboard by tapping repeatedly on the key you want",
"tags": "bluetooth", "tags": "bluetooth",
"storage": [ "storage": [
@ -266,6 +302,7 @@
{ "id": "animals", { "id": "animals",
"name": "Animals Game", "name": "Animals Game",
"icon": "animals.png", "icon": "animals.png",
"version":"0.01",
"description": "Simple toddler's game - displays a different number of animals each time the screen is pressed", "description": "Simple toddler's game - displays a different number of animals each time the screen is pressed",
"tags": "game", "tags": "game",
"storage": [ "storage": [
@ -286,6 +323,7 @@
{ "id": "qrcode", { "id": "qrcode",
"name": "Custom QR Code", "name": "Custom QR Code",
"icon": "qrcode.png", "icon": "qrcode.png",
"version":"0.01",
"description": "Use this to upload a customised QR code to Bangle.js", "description": "Use this to upload a customised QR code to Bangle.js",
"tags": "", "tags": "",
"custom": "qrcode.html", "custom": "qrcode.html",
@ -298,6 +336,7 @@
{ "id": "beer", { "id": "beer",
"name": "Beer Compass", "name": "Beer Compass",
"icon": "beercompass.png", "icon": "beercompass.png",
"version":"0.01",
"description": "Uploads all the pubs in an area onto your watch, so it can always point you at the nearest one", "description": "Uploads all the pubs in an area onto your watch, so it can always point you at the nearest one",
"tags": "", "tags": "",
"custom": "beercompass.html", "custom": "beercompass.html",
@ -310,6 +349,7 @@
{ "id": "route", { "id": "route",
"name": "Route Viewer", "name": "Route Viewer",
"icon": "route.png", "icon": "route.png",
"version":"0.01",
"description": "Upload a KML file of a route, and have your watch display a map with how far around it you are", "description": "Upload a KML file of a route, and have your watch display a map with how far around it you are",
"tags": "", "tags": "",
"custom": "route.html", "custom": "route.html",
@ -319,11 +359,11 @@
{"name":"=route"} {"name":"=route"}
] ]
}, },
{ {
"id": "start", "id": "start",
"name": "NCEU Startup", "name": "NCEU Startup",
"icon": "start.png", "icon": "start.png",
"version":"0.01",
"description": "NodeConfEU 2019 Startup Sequence", "description": "NodeConfEU 2019 Startup Sequence",
"tags": "start", "tags": "start",
"storage": [ "storage": [
@ -341,6 +381,7 @@
{ "id": "funrun5", { "id": "funrun5",
"name": "NCEU 5K Fun Run", "name": "NCEU 5K Fun Run",
"icon": "nceu-funrun.png", "icon": "nceu-funrun.png",
"version":"0.01",
"description": "Display a map of the NodeConf EU 2019 5K Fun Run route and your location on it", "description": "Display a map of the NodeConf EU 2019 5K Fun Run route and your location on it",
"tags": "health", "tags": "health",
"storage": [ "storage": [
@ -353,6 +394,7 @@
{ "id": "nceuwid", { "id": "nceuwid",
"name": "NCEU Logo Widget", "name": "NCEU Logo Widget",
"icon": "nceu-widget.png", "icon": "nceu-widget.png",
"version":"0.01",
"description": "Show the NodeConf EU logo in the top left", "description": "Show the NodeConf EU logo in the top left",
"tags": "widget", "tags": "widget",
"type":"widget", "type":"widget",
@ -365,6 +407,7 @@
{ "id": "sclock", { "id": "sclock",
"name": "Simple Clock", "name": "Simple Clock",
"icon": "clock-simple.png", "icon": "clock-simple.png",
"version":"0.01",
"description": "Simple Digital Clock", "description": "Simple Digital Clock",
"tags": "sclock", "tags": "sclock",
"type":"clock", "type":"clock",
@ -378,6 +421,7 @@
{ "id": "gesture", { "id": "gesture",
"name": "Gesture Test", "name": "Gesture Test",
"icon": "gesture.png", "icon": "gesture.png",
"version":"0.01",
"description": "BETA! Uploads a basic Tensorflow Gesture model, and then outputs each gesture as a message", "description": "BETA! Uploads a basic Tensorflow Gesture model, and then outputs each gesture as a message",
"tags": "gesture,ai", "tags": "gesture,ai",
"type":"app", "type":"app",
@ -392,6 +436,7 @@
{ "id": "pparrot", { "id": "pparrot",
"name": "Party Parrot", "name": "Party Parrot",
"icon": "party-parrot.png", "icon": "party-parrot.png",
"version":"0.01",
"description": "Party with a parrot on your wrist", "description": "Party with a parrot on your wrist",
"tags": "party,parrot,lol", "tags": "party,parrot,lol",
"type":"app", "type":"app",
@ -405,6 +450,7 @@
{ "id": "hrings", { "id": "hrings",
"name": "Hypno Rings", "name": "Hypno Rings",
"icon": "hypno-rings.png", "icon": "hypno-rings.png",
"version":"0.01",
"description": "Experiment with trippy rings, press buttons for change", "description": "Experiment with trippy rings, press buttons for change",
"tags": "rings,hypnosis,psychadelic", "tags": "rings,hypnosis,psychadelic",
"type":"app", "type":"app",
@ -418,6 +464,7 @@
{ "id": "morse", { "id": "morse",
"name": "Morse Code", "name": "Morse Code",
"icon": "morse-code.png", "icon": "morse-code.png",
"version":"0.01",
"description": "Learn morse code by hearing/seeing/feeling the code. Tap to toggle buzz!", "description": "Learn morse code by hearing/seeing/feeling the code. Tap to toggle buzz!",
"tags": "morse,sound,visual,input", "tags": "morse,sound,visual,input",
"type":"app", "type":"app",
@ -431,6 +478,7 @@
"id": "blescan", "id": "blescan",
"name": "BLE Scanner", "name": "BLE Scanner",
"icon": "blescan.png", "icon": "blescan.png",
"version":"0.01",
"description": "Scan for advertising BLE devices", "description": "Scan for advertising BLE devices",
"tags" : "bluetooth", "tags" : "bluetooth",
"storage" : [ "storage" : [
@ -442,6 +490,7 @@
{ "id": "mmonday", { "id": "mmonday",
"name": "Manic Monday Tone", "name": "Manic Monday Tone",
"icon": "manic-monday-icon.png", "icon": "manic-monday-icon.png",
"version":"0.01",
"description": "The Bangles make a comeback", "description": "The Bangles make a comeback",
"tags": "sound", "tags": "sound",
"storage": [ "storage": [
@ -453,6 +502,7 @@
{ "id": "jbells", { "id": "jbells",
"name": "Jingle Bells", "name": "Jingle Bells",
"icon": "jbells.png", "icon": "jbells.png",
"version":"0.01",
"description": "Play Jingle Bells", "description": "Play Jingle Bells",
"tags": "sound", "tags": "sound",
"type":"app", "type":"app",
@ -465,6 +515,7 @@
{ "id": "scolor", { "id": "scolor",
"name": "Show Color", "name": "Show Color",
"icon": "show-color.png", "icon": "show-color.png",
"version":"0.01",
"description": "Display all available Colors and Names", "description": "Display all available Colors and Names",
"tags": "tool", "tags": "tool",
"type":"app", "type":"app",
@ -478,6 +529,7 @@
{ "id": "miclock", { "id": "miclock",
"name": "Mixed Clock", "name": "Mixed Clock",
"icon": "clock-mixed.png", "icon": "clock-mixed.png",
"version":"0.01",
"description": "A mix of analog and digital Clock", "description": "A mix of analog and digital Clock",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",
@ -491,6 +543,7 @@
{ "id": "bclock", { "id": "bclock",
"name": "Binary Clock", "name": "Binary Clock",
"icon": "clock-binary.png", "icon": "clock-binary.png",
"version":"0.01",
"description": "A simple binary clock watch face", "description": "A simple binary clock watch face",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",
@ -504,6 +557,7 @@
{ "id": "clotris", { "id": "clotris",
"name": "Clock-Tris", "name": "Clock-Tris",
"icon": "clock-tris.png", "icon": "clock-tris.png",
"version":"0.01",
"description": "A fully functional clone of a classic game of falling blocks", "description": "A fully functional clone of a classic game of falling blocks",
"tags": "game", "tags": "game",
"allow_emulator":true, "allow_emulator":true,
@ -517,6 +571,7 @@
{ "id": "flappy", { "id": "flappy",
"name": "Flappy Bird", "name": "Flappy Bird",
"icon": "app.png", "icon": "app.png",
"version":"0.01",
"description": "A Flappy Bird game clone", "description": "A Flappy Bird game clone",
"tags": "game", "tags": "game",
"allow_emulator":true, "allow_emulator":true,
@ -530,6 +585,7 @@
"id": "gpsinfo", "id": "gpsinfo",
"name": "GPS Info", "name": "GPS Info",
"icon": "gps-info.png", "icon": "gps-info.png",
"version":"0.01",
"description": "An application that displays information about altitude, lat/lon, satellites and time", "description": "An application that displays information about altitude, lat/lon, satellites and time",
"tags": "gps", "tags": "gps",
"type": "app", "type": "app",
@ -543,6 +599,7 @@
"id": "pomodo", "id": "pomodo",
"name":"Pomodoro", "name":"Pomodoro",
"icon":"pomodoro.png", "icon":"pomodoro.png",
"version":"0.01",
"description": "A simple pomodoro timer.", "description": "A simple pomodoro timer.",
"tags": "pomodoro,cooking,tools", "tags": "pomodoro,cooking,tools",
"type": "app", "type": "app",
@ -556,6 +613,7 @@
{ "id": "blobclk", { "id": "blobclk",
"name": "Large Digit Clock", "name": "Large Digit Clock",
"icon": "clock-blob.png", "icon": "clock-blob.png",
"version":"0.01",
"description": "A clock with big digits", "description": "A clock with big digits",
"tags": "clock", "tags": "clock",
"type":"clock", "type":"clock",

1
apps/gbridge/app-icon.js Normal file
View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwg96xAACCqMICwYABwAsSAAoWWDBhEGJSAWLGBQuMGBQWNGBAuH/84GBoNGx///AwMFxH/mQYHGAgXHn//GIIXLIo84nAxBwZIKFo4YBMAM/PQwXJCwIABn8y//zC5BeFwYXDmaSCGApgCC4oRBAAQ0CwYwFC5BeB/GCkY0B+YHBC452H+YqBSYRgJUw7tCAYIZCC6ApBU4TZHC44rCJAJgCR4wXLIgMzC4MzF55ICSYUzC6bZDPgIXOJAYACLwwXCa4oXHBgzvIJAzVGC7ZgHwXdAAXSLxAXIpvUkUilvdC6Pd7ADBwndlAXJMAwXLLwYXI6Wq1RHBC5RIGCYIAC6hGJGA6nKFwp5IABAWGbRDUKGCYWIGBouJGBoWKDBYWMJRBELGRQVRAE4A=="))

19
apps/gbridge/app.js Normal file
View File

@ -0,0 +1,19 @@
function gb(j) {
Bluetooth.println(JSON.stringify(j));
}
var mainmenu = {
"" : { "title" : "Gadgetbridge" },
"Connected" : { value : NRF.getSecurityStatus().connected },
"Find Phone" : function() { E.showMenu(findPhone); },
"Exit" : load,
};
var findPhone = {
"" : { "title" : "-- Find Phone --" },
"On" : _=>gb({t:"findPhone",n:true}),
"Off" : _=>gb({t:"findPhone",n:false}),
"< Back" : function() { E.showMenu(mainmenu); },
};
E.showMenu(mainmenu);

5
apps/gbridge/app.json Normal file
View File

@ -0,0 +1,5 @@
{
"name":"Gadgetbridge",
"icon":"*gbridge",
"src":"-gbridge"
}

BIN
apps/gbridge/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

118
apps/gbridge/widget.js Normal file
View File

@ -0,0 +1,118 @@
(function() {
var musicState = "stop";
var musicInfo = {"artist":"","album":"","track":""};
var scrollPos = 0;
function gb(j) {
Bluetooth.println(JSON.stringify(j));
}
function show(size,render) {
var oldMode = Bangle.getLCDMode();
Bangle.setLCDMode("direct");
g.setClipRect(0,240,239,319);
g.setColor("#404040");
g.fillRect(1,241,238,318);
render(320-size);
g.setColor("#ffffff");
g.fillRect(0,240,1,319);
g.fillRect(238,240,239,319);
g.fillRect(2,318,238,319);
Bangle.setLCDPower(1); // light up
Bangle.setLCDMode(oldMode); // clears cliprect
function anim() {
scrollPos-=2;
if (scrollPos<-size) scrollPos=-size;
Bangle.setLCDOffset(scrollPos);
if (scrollPos>-size) setTimeout(anim,10);
}
anim();
}
function hide() {
function anim() {
scrollPos+=4;
if (scrollPos>0) scrollPos=0;
Bangle.setLCDOffset(scrollPos);
if (scrollPos<0) setTimeout(anim,10);
}
anim();
}
Bangle.on('touch',function() {
if (scrollPos) hide();
});
Bangle.on('swipe',function(dir) {
if (musicState=="play") {
gb({t:"music",n:dir>0?"next":"previous"});
}
});
gb({t:"status",bat:E.getBattery()});
global.GB = function(j) {
switch (j.t) {
case "notify":
show(80,function(y) {
// TODO: icon based on src?
var x = 120;
g.setFontAlign(0,0);
g.setFont("6x8",1);
g.setColor("#40d040");
g.drawString(j.src,x,y+7);
g.setColor("#ffffff");
g.setFont("6x8",2);
g.drawString(j.title,x,y+25);
g.setFont("6x8",1);
g.setColor("#b0b0b0");
// split text up a word boundaries
var txt = j.body.split("\n");
var MAXCHARS = 38;
for (var i=0;i<txt.length;i++) {
txt[i] = txt[i].trim();
var l = txt[i];
if (l.length>MAXCHARS) {
var p = MAXCHARS;
while (p>MAXCHARS-8 && !" \t-_".includes(l[p]))
p--;
if (p==MAXCHARS-8) p=MAXCHARS;
txt[i] = l.substr(0,p);
txt.splice(i+1,0,l.substr(p));
}
}
g.setFontAlign(-1,-1);
g.drawString(txt.join("\n"),10,y+40);
Bangle.buzz();
});
break;
case "musicinfo":
musicInfo = j;
break;
case "musicstate":
musicState = j.state;
if (musicState=="play")
show(40,function(y) {
g.setColor("#ffffff");
g.drawImage( require("heatshrink").decompress(atob("jEYwILI/EAv/8gP/ARcMgOAASN8h+A/kfwP8n4CD/E/gHgjg/HA=")),8,y+8);
g.setFontAlign(-1,-1);
g.setFont("6x8",1);
var x = 40;
g.setFont("4x6",2);
g.setColor("#ffffff");
g.drawString(musicInfo.artist,x,y+8);
g.setFont("6x8",1);
g.setColor("#c0c0c0");
g.drawString(musicInfo.track,x,y+22);
});
if (musicState=="pause")
hide();
break;
}
};
var xpos = WIDGETPOS.tl;
WIDGETPOS.tl+=24;
WIDGETS["gbridgew"]={draw:function() {
g.drawImage(require("heatshrink").decompress(atob("i0WwgHExAABCIwJCBYwJEBYkIBQ2ACgvzCwoECx/z/AKDD4WD+YLBEIYKCx//+cvnAKCBwU/mc4/8/HYv//Ev+Y4EEAePn43DBQkzn4rCEIoABBIwKHO4cjmczK42I6mqlqEEBQeIBQaDED4IgDUhi6KaBbmIA==")),xpos+1,1);
g.setColor(1,1,1);
}};
})();