bthrm - Optionally use bonding for BLE sensor
parent
0f9a117149
commit
0a1226ad1e
|
|
@ -16,5 +16,6 @@
|
|||
"gracePeriodNotification": 0,
|
||||
"gracePeriodConnect": 0,
|
||||
"gracePeriodService": 0,
|
||||
"gracePeriodRequest": 0
|
||||
"gracePeriodRequest": 0,
|
||||
"bonding": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -439,18 +439,20 @@ exports.enable = () => {
|
|||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
|
||||
/* promise = promise.then(() => {
|
||||
log(JSON.stringify(gatt.getSecurityStatus()));
|
||||
if (gatt.getSecurityStatus()['bonded']) {
|
||||
log("Already bonded");
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
log("Start bonding");
|
||||
return gatt.startBonding()
|
||||
.then(() => console.log(gatt.getSecurityStatus()));
|
||||
}
|
||||
});*/
|
||||
|
||||
if (settings.bonding){
|
||||
promise = promise.then(() => {
|
||||
log(JSON.stringify(gatt.getSecurityStatus()));
|
||||
if (gatt.getSecurityStatus()['bonded']) {
|
||||
log("Already bonded");
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
log("Start bonding");
|
||||
return gatt.startBonding()
|
||||
.then(() => console.log(gatt.getSecurityStatus()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
promise = promise.then(()=>{
|
||||
if (!characteristics || characteristics.length === 0){
|
||||
|
|
|
|||
|
|
@ -96,6 +96,12 @@
|
|||
writeSettings("debuglog",v);
|
||||
}
|
||||
},
|
||||
'Use bonding': {
|
||||
value: !!settings.bonding,
|
||||
onchange: v => {
|
||||
writeSettings("bonding",v);
|
||||
}
|
||||
},
|
||||
'Grace periods': function() { E.showMenu(submenu_grace); }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue