diff --git a/lib/mHub.js b/lib/mHub.js index dce028a..afea9f8 100644 --- a/lib/mHub.js +++ b/lib/mHub.js @@ -365,17 +365,10 @@ function mHub(cli_config) { //TODO: the following simplistic check makes version-control in engines // harder than it should be. engineConfig = me.engines[eng].self_description; - //TODO: THIS IS TEMPORARY AS WELL. NEED A BETTER WAY OF DETERMINING... - //if (name === engineConfig.identity) { if (name === engineConfig.identity) { // Pass the factory method into the session so it can instance it. - - // TESTING - if(name === Deacon){ name = "DeaconMgmt.js" } - me.log('mHub is about to assign engine '+name+' to session '+adjunctID); me.interface_spec.adjuncts[adjunctID].instance.assignEngine(me.engines[eng]); - break;; } } return false; // don't emit @@ -415,23 +408,32 @@ function mHub(cli_config) { } } - // this.interface_spec.taps.names["bluetooth"] = { - // "scanResult": function(me, msg, adjunctID){ - // if (me.interface_spec.hasOwnProperty(genEngine)) { - // me.mH.sendToAdjunct(genEngine, {target: ["scanResult", "metaSchema"], data: msg.data}) - // } - // return true; - // } - // } - - // this.interface_spec.taps.names["tcp"] = { - // "connected": function(me, msg, adjunctID){ - // me.buildNewSession(msg.data, 'NewUnnumbered'); - // me.log(msg.target.toString(), 'Got a connected broadcast from '+adjunctID, 7); - // me.emit('input', {target: ["assignEngine"], data: [genEngine, 'Deacon.js']}); - // return true; - // } - // } + this.interface_spec.taps.names["bluetooth"] = { + "scanResult": function(me, msg, adjunctID){ + if (me.interface_spec.hasOwnProperty(genEngine)) { + me.log(msg.target.toString(), 'Got a BT MAC ID '+adjunctID, 7); + me.mH.sendToAdjunct(genEngine, {target: ["scanResult", "metaSchema"], data: msg.data}) + } + return true; + } + } + + this.interface_spec.taps.names["tcp"] = { + "connected": function(me, msg, adjunctID){ + + if(me.interface_spec.adjuncts.hasOwnProperty(genEngine)){ + + me.removeAdjunct(genEngine) + } + me.buildNewSession(msg.data, genEngine); + me.log(msg.target.toString(), 'Got a connected broadcast from ' + adjunctID, 7); + me.emit('input', {target: ["assignEngine"], data: [genEngine, 'Deacon.js']}); + // setTimeout(function() { + // me.emit('input', {target: ["selfDescribe", "metaSchema", genEngine], data: []}); + // }, 2000); + return true; + } + } diff --git a/package.json b/package.json index bb4fe33..fcf4993 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,14 @@ "lodash.merge": "^4.3.1", "machina": "^1.1.2", "noble": "^1.3.0", + "npm": "^6.7.0", "prompt": "^0.2.14", "request": "^2.69.0", "serialport": "^2.0.5", "socket.io": "^1.3.7", "socket.io-client": "^1.3.7", - "telehash": "*", - "stream-browserify": "^2.0.1" + "stream-browserify": "^2.0.1", + "telehash": "*" }, "devDependencies": { "eslint": "^2.0.0"