forked from FOSS/BangleApps
Initial commit of BLE GATT Battery Service
parent
c4e62a3819
commit
3830289a5e
13
apps.json
13
apps.json
|
@ -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"}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
0.01: Initial release.
|
|
@ -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
|
|
@ -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() {}
|
||||
};
|
||||
})()
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue