Skip to content

Commit

Permalink
Merge branch 'master' into message_buzz_pattern_for_calls
Browse files Browse the repository at this point in the history
  • Loading branch information
myxor committed Jun 29, 2022
2 parents 4cf0430 + 828f982 commit 0f4fc04
Show file tree
Hide file tree
Showing 43 changed files with 652 additions and 1,041 deletions.
1 change: 1 addition & 0 deletions apps/agenda/ChangeLog
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
0.01: Basic agenda with events from GB
0.02: Added settings page to force calendar sync
3 changes: 2 additions & 1 deletion apps/android/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
0.08: Handling of alarms
0.09: Alarm vibration, repeat, and auto-snooze now handled by sched
0.10: Fix SMS bug
0.11: Use default Bangle formatter for booleans
0.12: Use default Bangle formatter for booleans
0.13: Added Bangle.http function (see Readme file for more info)
19 changes: 19 additions & 0 deletions apps/android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ Responses are sent back to Gadgetbridge simply as one line of JSON.

More info on message formats on http://www.espruino.com/Gadgetbridge

## Functions provided

The boot code also provides some useful functions:

* `Bangle.messageResponse = function(msg,response)` - send a yes/no response to a message. `msg` is a message object, and `response` is a boolean.
* `Bangle.musicControl = function(cmd)` - control music, cmd = `play/pause/next/previous/volumeup/volumedown`
* `Bangle.http = function(url,options)` - make an HTTPS request to a URL and return a promise with the data. Requires the [internet enabled `Bangle.js Gadgetbridge` app](http://www.espruino.com/Gadgetbridge#http-requests). `options` can contain:
* `id` - a custom (string) ID
* `timeout` - a timeout for the request in milliseconds (default 30000ms)
* `xpath` an xPath query to run on the request (but right now the URL requested must be XML - HTML is rarely XML compliant)

eg:

```
Bangle.http("https://pur3.co.uk/hello.txt").then(data=>{
console.log("Got ",data);
});
```

## Testing

Bangle.js can only hold one connection open at a time, so it's hard to see
Expand Down
39 changes: 39 additions & 0 deletions apps/android/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,50 @@
var cal = require("Storage").readJSON("android.calendar.json",true);
if (!cal || !Array.isArray(cal)) cal = [];
gbSend({t:"force_calendar_sync", ids: cal.map(e=>e.id)});
},
"http":function() {
//get the promise and call the promise resolve
if (Bangle.httpRequest === undefined) return;
var objID=Bangle.httpRequest[event.id];
if (objID === undefined) return; //already timedout or wrong id
delete Bangle.httpRequest[event.id];
clearInterval(objID.t); //t = timeout variable
if(event.err!==undefined) //if is error
objID.j(event.err); //r = reJect function
else
objID.r(event); //r = resolve function
}
};
var h = HANDLERS[event.t];
if (h) h(); else console.log("GB Unknown",event);
};
// HTTP request handling - see the readme
// options = {id,timeout,xpath}
Bangle.http = (url,options)=>{
options = options||{};
if (Bangle.httpRequest === undefined)
Bangle.httpRequest={};
if (options.id === undefined) {
// try and create a unique ID
do {
options.id = Math.random().toString().substr(2);
} while( Bangle.httpRequest[options.id]!==undefined);
}
//send the request
var req = {t: "http", url:url, id:options.id};
if (options.xpath) req.xpath = options.xpath;
gbSend(req);
//create the promise
var promise = new Promise(function(resolve,reject) {
//save the resolve function in the dictionary and create a timeout (30 seconds default)
Bangle.httpRequest[options.id]={r:resolve,j:reject,t:setTimeout(()=>{
//if after "timeoutMillisec" it still hasn't answered -> reject
delete Bangle.httpRequest[options.id];
reject("Timeout");
},options.timeout||30000)};
});
return promise;
}

// Battery monitor
function sendBattery() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); }
Expand Down
2 changes: 1 addition & 1 deletion apps/android/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "android",
"name": "Android Integration",
"shortName": "Android",
"version": "0.12",
"version": "0.13",
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
"icon": "app.png",
"tags": "tool,system,messages,notifications,gadgetbridge",
Expand Down
3 changes: 2 additions & 1 deletion apps/bwclk/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
0.07: Improved positioning.
0.08: Select the color of widgets correctly. Additional settings to hide colon.
0.09: Larger font size if colon is hidden to improve readability further.
0.10: HomeAssistant integration if HomeAssistant is installed.
0.10: HomeAssistant integration if HomeAssistant is installed.
0.11: Performance improvements.
33 changes: 18 additions & 15 deletions apps/bwclk/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/bwclk/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "bwclk",
"name": "BW Clock",
"version": "0.10",
"version": "0.11",
"description": "BW Clock.",
"readme": "README.md",
"icon": "app.png",
Expand Down
6 changes: 2 additions & 4 deletions apps/circlesclock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ function getWeatherIconByCode(code) {
default:
return weatherRainy;
}
break;
case 6:
return weatherSnowy;
case 7:
Expand All @@ -607,9 +606,8 @@ function getWeatherIconByCode(code) {
default:
return weatherCloudy;
}
break;
default:
return undefined;
default:
return undefined;
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/football/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "football",
"name": "football",
"shortName": "football",
"version": "1.00",
"version": "1.01",
"type": "app",
"description": "Classic football game of the CASIO chronometer",
"icon": "app.png",
Expand Down
3 changes: 2 additions & 1 deletion apps/info/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: Release
0.02: Recfactoring and show weather data.
0.02: Recfactoring and show weather data
0.03: Show sizes for used, free and trash through storage.getStats
17 changes: 13 additions & 4 deletions apps/info/info.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,22 @@ var screens = [
name: "Software",
items: [
{name: "Firmw.", fun: () => ENV.VERSION},
{name: "Git", fun: () => ENV.GIT_COMMIT},
{name: "Boot.", fun: () => getVersion("boot.info")},
{name: "Settings.", fun: () => getVersion("setting.info")},
{name: "Storage.", fun: () => ""},
{name: " Total", fun: () => ENV.STORAGE>>10},
{name: " Free", fun: () => require("Storage").getFree()>>10},
]
}
},
{
name: "Storage [kB]",
items: [
{name: "Total", fun: () => storage.getStats().totalBytes>>10},
{name: "Free", fun: () => storage.getStats().freeBytes>>10},
{name: "Trash", fun: () => storage.getStats().trashBytes>>10},
{name: "", fun: () => ""},
{name: "#File", fun: () => storage.getStats().fileCount},
{name: "#Trash", fun: () => storage.getStats().trashCount},
]
},
];


Expand Down
5 changes: 3 additions & 2 deletions apps/info/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "info",
"name": "Info",
"version": "0.02",
"version": "0.03",
"description": "An application that displays information such as battery level, steps etc.",
"icon": "info.png",
"type": "app",
Expand All @@ -11,7 +11,8 @@
"screenshots": [
{"url":"screenshot_1.png"},
{"url":"screenshot_2.png"},
{"url":"screenshot_3.png"}],
{"url":"screenshot_3.png"},
{"url":"screenshot_4.png"}],
"storage": [
{"name":"info.app.js","url":"info.app.js"},
{"name":"info.img","url":"info.icon.js","evaluate":true}
Expand Down
Binary file modified apps/info/screenshot_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/info/screenshot_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/info/screenshot_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/info/screenshot_4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/invader/ChangeLog
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
0.01: New App!
0.11: Changes...
2 changes: 2 additions & 0 deletions apps/kanawatch/ChangeLog
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
0.01: First release
0.02: Improve battery life, sprite resolution, fix launcher issue and unaligned text bug
0.03: Reduce code size, refresh once a minute and faster refresh

0 comments on commit 0f4fc04

Please sign in to comment.