mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
jsHint passing versions of BBB, scanBLE and wemo nodes.
Also fixe and in vs out issue on wemo... no way it could have been working previously..
This commit is contained in:
@@ -37,29 +37,30 @@ function BleScan(n) {
|
||||
this.ble_name = n.ble_name;
|
||||
this.ble_uuid = n.ble_uuid;
|
||||
|
||||
this.on("input", function(msg){
|
||||
noble.startScanning();
|
||||
});
|
||||
noble.on('scanStart', function(msg) {
|
||||
var msg = {};
|
||||
this.on("input", function(msg){
|
||||
noble.startScanning();
|
||||
});
|
||||
|
||||
noble.on('scanStart', function(msg) {
|
||||
msg = {};
|
||||
msg.topic = node.topic;
|
||||
msg.payload = "Scanning initiated..." //debugging
|
||||
//console.log('scanning initiated...');
|
||||
node.send(msg);
|
||||
});
|
||||
|
||||
noble.on('discover', function(peripheral) {
|
||||
//console.log('scanning initiated...');
|
||||
node.send(msg);
|
||||
});
|
||||
|
||||
noble.on('discover', function(peripheral) {
|
||||
var msg = {};
|
||||
msg.topic = node.topic;
|
||||
msg.topic = node.topic;
|
||||
msg.payload = "not found";
|
||||
|
||||
//check for the device name and the UUID (first one from the UUID list)
|
||||
if(peripheral.advertisement.localName==node.ble_name && peripheral.advertisement.serviceUuids[0]==node.ble_uuid) {
|
||||
msg.payload=peripheral.advertisement.localName;
|
||||
noble.stopScanning(); }
|
||||
noble.stopScanning();
|
||||
}
|
||||
node.send(msg);
|
||||
});
|
||||
});
|
||||
|
||||
this.on("close", function() {
|
||||
try { noble.stopScanning(); }
|
||||
|
Reference in New Issue
Block a user