mirror of https://github.com/espruino/BangleApps
Settings 0.21: Add passkey pairing option (BETA), Add whitelist option (fix #78)
parent
529c2403b3
commit
cb0b228f0e
|
@ -152,7 +152,7 @@
|
||||||
{ "id": "setting",
|
{ "id": "setting",
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"icon": "settings.png",
|
"icon": "settings.png",
|
||||||
"version":"0.20",
|
"version":"0.21",
|
||||||
"description": "A menu for setting up Bangle.js",
|
"description": "A menu for setting up Bangle.js",
|
||||||
"tags": "tool,system",
|
"tags": "tool,system",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
|
|
|
@ -22,3 +22,5 @@
|
||||||
0.18: Don't overwrite existing settings on app update
|
0.18: Don't overwrite existing settings on app update
|
||||||
0.19: Allow BLE HID settings, add README.md
|
0.19: Allow BLE HID settings, add README.md
|
||||||
0.20: Fix set time menu, allow dates to roll over
|
0.20: Fix set time menu, allow dates to roll over
|
||||||
|
0.21: Add passkey pairing option (BETA)
|
||||||
|
Add whitelist option (fix #78)
|
||||||
|
|
|
@ -4,8 +4,7 @@ This is Bangle.js's settings menu
|
||||||
|
|
||||||
* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
|
* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
|
||||||
* **App/Widget Settings** settings specific to installed applications
|
* **App/Widget Settings** settings specific to installed applications
|
||||||
* **BLE** is Bluetooth LE enabled and the watch connectable?
|
* **BLE** Bluetooth Settings menu - see below.
|
||||||
* **Programmable** if BLE is on, can the watch be connected to in order to program/upload apps?
|
|
||||||
* **Debug Info** should debug info be shown on the watch's screen or not?
|
* **Debug Info** should debug info be shown on the watch's screen or not?
|
||||||
* **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected
|
* **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected
|
||||||
* **Vibration** enable/disable the vibration motor
|
* **Vibration** enable/disable the vibration motor
|
||||||
|
@ -13,6 +12,20 @@ This is Bangle.js's settings menu
|
||||||
* **Select Clock** if you have more than one clock face, select the default one
|
* **Select Clock** if you have more than one clock face, select the default one
|
||||||
* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device. **Note:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
|
* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device. **Note:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
|
||||||
* **Set Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader
|
* **Set Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader
|
||||||
* **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on.
|
* **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on - see below.
|
||||||
* **Reset Settings** Reset the settings to defaults
|
* **Reset Settings** Reset the settings to defaults
|
||||||
* **Turn Off** Turn Bangle.js off
|
* **Turn Off** Turn Bangle.js off
|
||||||
|
|
||||||
|
## BLE - Bluetooth Settings
|
||||||
|
|
||||||
|
* **BLE** is Bluetooth LE enabled and the watch connectable?
|
||||||
|
* **Programmable** if BLE is on, can the watch be connected to in order to program/upload apps? As long as your watch firmware is up to date, Gadgetbridge will work even with `Programmable` set to `Off`.
|
||||||
|
* **Passkey BETA** allows you to set a passkey that is required to connect and pair to Bangle.js. **Note:** This is Beta and you will almost certainly encounter issues connecting with Web Bluetooth using this option.
|
||||||
|
* **Whitelist** allows you to specify only specific devices that you will let connect to your Bangle.js. Simply choose the menu item, then `Add Device`, and then connect to Bangle.js with the device you want to add. If you are already connected you will have to disconnect first. Changes will take effect when you exit the `Settings` app.
|
||||||
|
|
||||||
|
## LCD
|
||||||
|
|
||||||
|
* **LCD Brightness** set how bright the LCD is. Due to hardware limitations in the LCD backlight, you may notice flicker if the LCD is not at 100% brightness.
|
||||||
|
* **LCD Timeout** how long should the LCD stay on for if no activity is detected. 0=stay on forever
|
||||||
|
* **Wake on X** should the given activity wake up the Bangle.js LCD?
|
||||||
|
* **Twist X** these options adjust the sensitivity of `Wake on Twist` to ensure Bangle.js wakes up with just the right amount of wrist movement.
|
||||||
|
|
|
@ -4,4 +4,6 @@
|
||||||
if (settings.options) Bangle.setOptions(settings.options);
|
if (settings.options) Bangle.setOptions(settings.options);
|
||||||
if (settings.brightness && settings.brightness!=1) Bangle.setLCDBrightness(settings.brightness);
|
if (settings.brightness && settings.brightness!=1) Bangle.setLCDBrightness(settings.brightness);
|
||||||
if (settings.passkey!==undefined && settings.passkey.length==6) NRF.setSecurity({passkey:settings.passkey, mitm:1, display:1});
|
if (settings.passkey!==undefined && settings.passkey.length==6) NRF.setSecurity({passkey:settings.passkey, mitm:1, display:1});
|
||||||
|
if (settings.whitelist) NRF.on('connect', function(addr) { if (!settings.whitelist.includes(addr)) NRF.disconnect(); });
|
||||||
|
delete settings;
|
||||||
})()
|
})()
|
||||||
|
|
|
@ -137,10 +137,14 @@ function showBLEMenu() {
|
||||||
updateSettings();
|
updateSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Passkey': {
|
'Passkey BETA': {
|
||||||
value: settings.passkey?settings.passkey:"none",
|
value: settings.passkey?settings.passkey:"none",
|
||||||
onchange: () => setTimeout(showPasskeyMenu) // graphical_menu redraws after the call
|
onchange: () => setTimeout(showPasskeyMenu) // graphical_menu redraws after the call
|
||||||
},
|
},
|
||||||
|
'Whitelist': {
|
||||||
|
value: settings.whitelist?(settings.whitelist.length+" devs"):"off",
|
||||||
|
onchange: () => setTimeout(showWhitelistMenu) // graphical_menu redraws after the call
|
||||||
|
},
|
||||||
'< Back': ()=>showMainMenu()
|
'< Back': ()=>showMainMenu()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -171,6 +175,43 @@ function showPasskeyMenu() {
|
||||||
E.showMenu(menu);
|
E.showMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showWhitelistMenu() {
|
||||||
|
var menu = {
|
||||||
|
"Disable" : () => {
|
||||||
|
settings.whitelist = undefined;
|
||||||
|
updateSettings();
|
||||||
|
showBLEMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (settings.whitelist) settings.whitelist.forEach(function(d){
|
||||||
|
menu[d.substr(0,17)] = function() {
|
||||||
|
E.showPrompt('Remove\n'+d).then((v) => {
|
||||||
|
if (v) {
|
||||||
|
settings.whitelist.splice(settings.whitelist.indexOf(d),1);
|
||||||
|
updateSettings();
|
||||||
|
}
|
||||||
|
setTimeout(showWhitelistMenu, 50);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu['Add Device']=function() {
|
||||||
|
E.showAlert("Connect device\nto add to\nwhitelist","Whitelist").then(function() {
|
||||||
|
NRF.removeAllListeners('connect');
|
||||||
|
showWhitelistMenu();
|
||||||
|
});
|
||||||
|
NRF.removeAllListeners('connect');
|
||||||
|
NRF.on('connect', function(addr) {
|
||||||
|
if (!settings.whitelist) settings.whitelist=[];
|
||||||
|
settings.whitelist.push(addr);
|
||||||
|
updateSettings();
|
||||||
|
NRF.removeAllListeners('connect');
|
||||||
|
showWhitelistMenu();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
menu['< Back']=()=>showBLEMenu();
|
||||||
|
E.showMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
function showLCDMenu() {
|
function showLCDMenu() {
|
||||||
const lcdMenu = {
|
const lcdMenu = {
|
||||||
'': { 'title': 'LCD' },
|
'': { 'title': 'LCD' },
|
||||||
|
|
Loading…
Reference in New Issue