modbus-serial
Advanced tools
Comparing version 3.2.5 to 3.3.5
@@ -132,4 +132,29 @@ 'use strict'; | ||
} | ||
/** | ||
* Connect to a communication port, using Bufferd Serial port. | ||
* | ||
* @param {string} path the path to the Serial Port - required. | ||
* @param {object} options - the serial port options - optional. | ||
* @param {function} next the function to call next. | ||
*/ | ||
cl.connectRTUBuffered = function (path, options, next) { | ||
// check if we have options | ||
if (typeof(next) == 'undefined' && typeof(options) == 'function') { | ||
next = options; | ||
options = {}; | ||
} | ||
// create the SerialPort | ||
var SerialPort = require('../ports/rtubufferedport'); | ||
var serialPort = new SerialPort(path, options); | ||
// re-set the serial port to use | ||
this._port = serialPort; | ||
// open and call next | ||
this.open(next); | ||
} | ||
} | ||
module.exports = addConnctionAPI; |
@@ -7,3 +7,3 @@ // create an empty modbus client | ||
// open connection to a tcp line | ||
client.connectTCP("192.168.1.42"); | ||
client.connectTCP("192.168.1.115"); | ||
@@ -16,5 +16,5 @@ /* read 10 registers every one second | ||
setInterval(function() { | ||
client.writeFC4(1, 0, 10, function(err, data) { | ||
client.readInputRegisters(0, 10, function(err, data) { | ||
console.log(data.data); | ||
}); | ||
}, 1000); |
{ | ||
"name": "modbus-serial", | ||
"version": "3.2.5", | ||
"version": "3.3.5", | ||
"description": "A pure JavaScript implemetation of MODBUS-RTU (and TCP) for NodeJS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -86,3 +86,3 @@ 'use strict'; | ||
// check data length | ||
if (bufferLength.length < 6 || length < 6) return; | ||
if (bufferLength < 6 || length < 6) return; | ||
@@ -89,0 +89,0 @@ // loop and check length-sized buffer chunks |
@@ -68,5 +68,7 @@ # modbus-serial | ||
* Modbus-RTU: Over serial line [require node serialport]. | ||
* modbus-TCP: Over TCP/IP line. | ||
* modbus-RTU: Over Telnet server, TCP/IP serial bridge. | ||
* Modbus-RTU (modbus-rtu): Over serial line [require node serialport]. | ||
* modbus-TCP (modbus-tcp): Over TCP/IP line. | ||
* modbus-RTU (telnet): Over Telnet server, TCP/IP serial bridge. | ||
* modbus-RTU (buffered): Over buffered serial line [require node serialport]. | ||
* modbus-RTU (C701): Over C701 server, commercial UDP to serial bridge. | ||
@@ -478,2 +480,16 @@ #### Examples | ||
---- | ||
##### .connectRTUBuffered (path, options, callback) | ||
Connect using buffered serial port. | ||
Use when serial port has long delays inside packets. | ||
*path {string}:* | ||
The port path (e.g. "/dev/ttyS0") | ||
*options {object}:* (optional) | ||
The options for this connection. | ||
*callback {function}:* (optional) | ||
Called once the client is connected. | ||
---- | ||
##### .connectTCP (ip, options, callback) | ||
@@ -480,0 +496,0 @@ Connect using tcp/ip. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75323
25
1652
517