mirror of https://github.com/espruino/BangleApps
Merge branch 'master' into apps/pparrot
commit
834b4d8485
10
apps.json
10
apps.json
|
@ -348,6 +348,16 @@
|
||||||
{"name":"+pparrot","url":"party-parrot.json"},
|
{"name":"+pparrot","url":"party-parrot.json"},
|
||||||
{"name":"-pparrot","url":"party-parrot.js"},
|
{"name":"-pparrot","url":"party-parrot.js"},
|
||||||
{"name":"*pparrot","url":"party-parrot-icon.js","evaluate":true}
|
{"name":"*pparrot","url":"party-parrot-icon.js","evaluate":true}
|
||||||
|
{
|
||||||
|
"id": "blescan",
|
||||||
|
"name": "BLE Scanner",
|
||||||
|
"icon": "blescan.png",
|
||||||
|
"description": "Scan for advertising BLE devices",
|
||||||
|
"tags" : "bluetooth",
|
||||||
|
"storage" : [
|
||||||
|
{"name":"+blescan","url":"blescan.json"},
|
||||||
|
{"name":"-blescan","url":"blescan.js"},
|
||||||
|
{"name":"*blescan","url":"blescan-icon.js", "evaluate":true}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwxH+AH4A/AH4ATmIABrdbAgQrmAAYvEAAYtkF5QxcEZAvLGDAhJF5oxWFhYAFCBFaFzQsHAAk3CQmE1wwRFxiPFMY4uBwiSRI4uEQo4GIAAIVBxTCRFwoABJITvNrYTHRqIuCAAIvPxQSBBQwvQL6aMCBQ7sQVIQuGdIjqIGCIOEm4XHForqFIAYHBm4vTFxYMDAQKeHDIwvVRAoEDdRAvPE5QcHAoTqJDQ5eZAwS7DIZovWAodaRQLqGF6bhDABouCXYIAQF+6PUrQUQd7oMKF6wbLApYaIF45gSAgxeUF5olDBIICECJIvTm4wLAAoPHm4vTC4OK12EGJYLFI5IvJGAuE1wABGAycIBRQuKF4ouCAAIvPIgOFF6QwEL6c3IRAuMGA+EWw4GIwuusAuTeQzqGF4r0LF6AwIm4mEAA03FzAwJLAxbKFygwLd5IuaMRwthGBYvKFzQxJF5AtdGZAvEFcYA/AH4AvA=="))
|
|
@ -0,0 +1,52 @@
|
||||||
|
// ble-scanner
|
||||||
|
// Scan the airwaves every three seconds (which seems safe for a large number of devices)
|
||||||
|
// Using the menu feature, display a scrollable list of BLE devices on the watch
|
||||||
|
|
||||||
|
// Dummy menu item to display until we find something
|
||||||
|
const NODEVICE = 'No devices found';
|
||||||
|
|
||||||
|
const SCAN_INTERVAL = 3000;
|
||||||
|
|
||||||
|
const menu = {
|
||||||
|
};
|
||||||
|
|
||||||
|
menu[NODEVICE] = {
|
||||||
|
value : "",
|
||||||
|
onchange : () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
Bangle.menu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function scan() {
|
||||||
|
NRF.findDevices(devices => {
|
||||||
|
for (let device of devices) {
|
||||||
|
|
||||||
|
// Only display devices that advertise a name
|
||||||
|
|
||||||
|
if (device.name) {
|
||||||
|
// Remove no devices found message if it is present
|
||||||
|
if (menu[NODEVICE]) {
|
||||||
|
delete menu[NODEVICE];
|
||||||
|
}
|
||||||
|
menu[device.name] = {
|
||||||
|
value : device.rssi,
|
||||||
|
onchange : () => {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
draw();
|
||||||
|
}, { active: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function waitMessage() {
|
||||||
|
E.showMessage('scanning');
|
||||||
|
}
|
||||||
|
|
||||||
|
scan();
|
||||||
|
waitMessage();
|
||||||
|
|
||||||
|
setInterval(scan, SCAN_INTERVAL);
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "BLE Scanner",
|
||||||
|
"type":"app",
|
||||||
|
"icon": "*blescan",
|
||||||
|
"src": "-blescan"
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in New Issue