modbus-serial
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -6,2 +6,3 @@ declare namespace ModbusRTU { | ||
open(callback: Function): void; | ||
close(callback: Function): void; | ||
@@ -8,0 +9,0 @@ writeFC1(address: number, dataAddress: number, length: number, next: NodeStyleCallback<ReadCoilResult>): void; |
11
index.js
@@ -275,2 +275,13 @@ 'use strict'; | ||
/** | ||
* Close the serial port | ||
* | ||
* @param {Function} callback the function to call next on close success | ||
* or failure. | ||
*/ | ||
ModbusRTU.prototype.close = function (callback) { | ||
// close the serial port | ||
this._port.close(callback); | ||
}; | ||
/** | ||
* Write a Modbus "Read Coil Status" (FC=01) to serial port. | ||
@@ -277,0 +288,0 @@ * |
{ | ||
"name": "modbus-serial", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "A pure JavaScript implemetation of MODBUS-RTU (and TCP) for NodeJS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,12 @@ 'use strict'; | ||
describe('#close() - close serial port.', function () { | ||
it('should close the port without errors', function (done) { | ||
modbusRTU.close(function(err) { | ||
expect(err).to.be.a('null'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('#writeFC3() - read holding registers.', function () { | ||
@@ -23,0 +33,0 @@ it('should read 3 registers [0xa12b, 0xffff, 0xb21a] without errors', function (done) { |
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
2782
113510
38