diff --git a/io/serialport/25-serial.html b/io/serialport/25-serial.html index ea7d7842..e176fdd6 100644 --- a/io/serialport/25-serial.html +++ b/io/serialport/25-serial.html @@ -16,6 +16,7 @@
It then outputs msg.payload
as either a UTF8 ascii string or a binary Buffer object.
msg.port
is set to the name of the port selected.
If no split character is specified, or a timeout or buffer size of 0, then a stream of single characters is sent - again either as ascii chars or size 1 binary buffers.
diff --git a/io/serialport/25-serial.js b/io/serialport/25-serial.js index 07b3fd8d..e6fcf10d 100644 --- a/io/serialport/25-serial.js +++ b/io/serialport/25-serial.js @@ -117,8 +117,8 @@ module.exports = function(RED) { this.port.on('data', function(msg) { // single char buffer if ((node.serialConfig.newline === 0)||(node.serialConfig.newline === "")) { - if (node.serialConfig.bin !== "bin") { node.send({"payload": String.fromCharCode(msg)}); } - else { node.send({"payload": new Buffer([msg])}); } + if (node.serialConfig.bin !== "bin") { node.send({"payload": String.fromCharCode(msg), port:node.serialConfig.serialport}); } + else { node.send({"payload": new Buffer([msg]), port:node.serialConfig.serialport}); } } else { // do the timer thing @@ -133,7 +133,7 @@ module.exports = function(RED) { var m = new Buffer(i+1); buf.copy(m,0,0,i+1); if (node.serialConfig.bin !== "bin") { m = m.toString(); } - node.send({"payload": m}); + node.send({"payload": m, port:node.serialConfig.serialport}); m = null; }, node.serialConfig.newline); i = 0; @@ -148,7 +148,7 @@ module.exports = function(RED) { var m = new Buffer(i); buf.copy(m,0,0,i); if (node.serialConfig.bin !== "bin") { m = m.toString(); } - node.send({"payload":m}); + node.send({"payload":m, port:node.serialConfig.serialport}); m = null; i = 0; } @@ -161,7 +161,7 @@ module.exports = function(RED) { var n = new Buffer(i); buf.copy(n,0,0,i); if (node.serialConfig.bin !== "bin") { n = n.toString(); } - node.send({"payload":n}); + node.send({"payload":n, port:node.serialConfig.serialport}); n = null; i = 0; } diff --git a/io/serialport/package.json b/io/serialport/package.json index ccf56099..ee68d2af 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-serialport", - "version" : "0.6.4", + "version" : "0.6.5", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { - "serialport" : "^6.0.5" + "serialport" : "^6.1.1" }, "repository" : { "type":"git",