1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Added a Bluetooth Logo to the library and linmk to it here. Renamed scan function to blescan (just in case). Added a close function to stop discovery, just to try to be clean.

This commit is contained in:
Dave C-J 2013-10-12 14:48:49 +01:00
parent cedc7a462a
commit 8b6dd4271b
2 changed files with 15 additions and 19 deletions

View File

@ -50,7 +50,7 @@
},
inputs:1, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
icon: "arrow-in.png", // set the icon (held in public/icons)
icon: "bluetooth.png", // set the icon (held in public/icons)
label: function() { // sets the default label contents
return this.name||this.topic||"scanBLE";
},

View File

@ -18,7 +18,6 @@
* limitations under the License.
**/
//might need to modify accordingly
var RED = require("../../red/red");
@ -26,7 +25,7 @@ var RED = require("../../red/red");
var noble = require('noble');
// The main node definition - most things happen in here
function Scan(n) {
function BleScan(n) {
// Create a RED node
RED.nodes.createNode(this,n);
@ -62,15 +61,12 @@ function Scan(n) {
node.send(msg);
});
this.on("close", function() {
try { noble.stopScanning(); }
catch (err) { console.log(err); }
});
}
// Register the node by name. This must be called before overriding any of the
// Node functions.
RED.nodes.registerType("scanBLE", Scan);
Scan.prototype.close = function() {
}
RED.nodes.registerType("scanBLE", BleScan);