1
0
Fork 0

Initial commit of BLE GATT Battery Service

master
jonathan 2020-08-07 00:18:05 +01:00
parent c4e62a3819
commit 3830289a5e
5 changed files with 49 additions and 0 deletions

View File

@ -2129,5 +2129,18 @@
{"name": "counter.app.js", "url": "counter.js"},
{"name": "counter.img", "url": "counter-icon.js", "evaluate": true}
]
},
{ "id": "widgattbat",
"name": "BLE GATT Battery Service",
"shortName":"BLE Battery Service",
"icon": "widget.png",
"version":"0.01",
"description": "Adds the GATT Battery Service to advertise the percentage of battery currently remaining over Bluetooth.\n",
"tags": "ble,bluetooth,gatt,widget",
"type": "widget",
"readme": "README.md",
"storage": [
{"name":"gattbat.wid.js","url":"widget.js"}
]
}
]

View File

@ -0,0 +1 @@
0.01: Initial release.

19
apps/widgattbat/README.md Normal file
View File

@ -0,0 +1,19 @@
# BLE GATT Battery Service
Adds the GATT Battery Service to advertise the percentage of battery currently remaining over Bluetooth.
## Usage
Describe how to use it
## Features
Name the function
## Requests
Name who should be contacted for support/update requests
## Creator
Jonathan Jefferies

16
apps/widgattbat/widget.js Normal file
View File

@ -0,0 +1,16 @@
(() => {
function advertiseBattery() {
Bangle.bleAdvert[0x180F] = [E.getBattery()];
NRF.setAdvertising(Bangle.bleAdvert);
}
if (!Bangle.bleAdvert) Bangle.bleAdvert = {};
setInterval(advertiseBattery, 60 * 1000);
advertiseBattery();
WIDGETS["blebat"]={
area:"tl",
width:0,
draw:function() {}
};
})()

BIN
apps/widgattbat/widget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB