modbus-serial
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -35,3 +35,3 @@ /* eslint-disable no-console, spaced-comment */ | ||
// if client already open, just run | ||
if (client.isOpen()) { | ||
if (client.isOpen) { | ||
run(); | ||
@@ -38,0 +38,0 @@ } |
@@ -32,3 +32,3 @@ /* eslint-disable no-console, spaced-comment */ | ||
// if client already open, just run | ||
if (client.isOpen()) { | ||
if (client.isOpen) { | ||
run(); | ||
@@ -35,0 +35,0 @@ } |
37
index.js
@@ -337,2 +337,16 @@ "use strict"; | ||
}); | ||
/** | ||
* Check if port is open | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
if (this._port) { | ||
return this._port.isOpen; | ||
} | ||
return false; | ||
} | ||
}); | ||
}; | ||
@@ -355,13 +369,2 @@ | ||
/** | ||
* Check if port is open | ||
*/ | ||
ModbusRTU.prototype.isOpen = function() { | ||
if (this._port) { | ||
return this._port.isOpen(); | ||
} | ||
return false; | ||
}; | ||
/** | ||
* Write a Modbus "Read Coil Status" (FC=01) to serial port. | ||
@@ -388,3 +391,3 @@ * | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -448,3 +451,3 @@ return; | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -496,3 +499,3 @@ return; | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -548,3 +551,3 @@ return; | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -596,3 +599,3 @@ return; | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -659,3 +662,3 @@ return; | ||
// check port is actually open before attempting write | ||
if (this.isOpen() !== true) { | ||
if (this.isOpen !== true) { | ||
if (next) next(new PortNotOpenError()); | ||
@@ -662,0 +665,0 @@ return; |
{ | ||
"name": "modbus-serial", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "A pure JavaScript implemetation of MODBUS-RTU (Serial and TCP) for NodeJS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -172,2 +172,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this._client.isOpen; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -196,11 +208,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
AsciiPort.prototype.isOpen = function() { | ||
return this._client.isOpen(); | ||
}; | ||
/** | ||
* Send data to a modbus slave. | ||
@@ -207,0 +210,0 @@ * |
@@ -107,2 +107,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this.openFlag; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -134,11 +146,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
UdpPort.prototype.isOpen = function() { | ||
return this.openFlag; | ||
}; | ||
/** | ||
* Send data to a modbus-tcp slave. | ||
@@ -145,0 +148,0 @@ * |
@@ -80,2 +80,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this._client.isOpen; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -120,11 +132,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
RTUBufferedPort.prototype.isOpen = function() { | ||
return this._client.isOpen(); | ||
}; | ||
/** | ||
* Send data to a modbus slave. | ||
@@ -131,0 +134,0 @@ * |
@@ -97,2 +97,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this.openFlag; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -123,11 +135,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
TcpPort.prototype.isOpen = function() { | ||
return this.openFlag; | ||
}; | ||
/** | ||
* Send data to a modbus-tcp slave. | ||
@@ -134,0 +137,0 @@ * |
@@ -114,2 +114,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this.openFlag; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -171,11 +183,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
TcpRTUBufferedPort.prototype.isOpen = function() { | ||
return this.openFlag; | ||
}; | ||
/** | ||
* Send data to a modbus slave via telnet server. | ||
@@ -182,0 +185,0 @@ * |
@@ -102,2 +102,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this.openFlag; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -145,11 +157,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
TelnetPort.prototype.isOpen = function() { | ||
return this.openFlag; | ||
}; | ||
/** | ||
* Send data to a modbus slave via telnet server. | ||
@@ -156,0 +159,0 @@ * |
@@ -34,2 +34,14 @@ "use strict"; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return true; | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
@@ -60,11 +72,2 @@ }; | ||
/** | ||
* Check if port is open. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
TestPort.prototype.isOpen = function() { | ||
return true; | ||
}; | ||
/** | ||
* Simulate successful/failure port requests and replays. | ||
@@ -71,0 +74,0 @@ * |
@@ -16,2 +16,9 @@ "use strict"; | ||
} | ||
Object.defineProperty(this, "isOpen", { | ||
enumerable: true, | ||
get: function() { | ||
return this._openFlag; | ||
} | ||
}); | ||
}; | ||
@@ -28,6 +35,2 @@ util.inherits(SerialPortMock, EventEmitter); | ||
SerialPortMock.prototype.isOpen = function() { | ||
return this._openFlag; | ||
}; | ||
SerialPortMock.prototype.write = function(buffer, callback) { | ||
@@ -34,0 +37,0 @@ this._data = buffer; |
@@ -34,3 +34,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -40,3 +40,3 @@ | ||
port.open(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -49,3 +49,3 @@ }); | ||
port.close(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -52,0 +52,0 @@ }); |
@@ -29,3 +29,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -36,3 +36,3 @@ | ||
setTimeout(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -46,3 +46,3 @@ }); | ||
port.close(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -49,0 +49,0 @@ }); |
@@ -34,3 +34,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -40,3 +40,3 @@ | ||
port.open(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -49,3 +49,3 @@ }); | ||
port.close(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -52,0 +52,0 @@ }); |
@@ -29,3 +29,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -35,3 +35,3 @@ | ||
port.open(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -45,3 +45,3 @@ }); | ||
setTimeout(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -48,0 +48,0 @@ }); |
@@ -34,3 +34,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -40,3 +40,3 @@ | ||
port.open(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -49,3 +49,3 @@ }); | ||
port.close(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -52,0 +52,0 @@ }); |
@@ -34,3 +34,3 @@ "use strict"; | ||
it("should not be open before #open", function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
}); | ||
@@ -40,3 +40,3 @@ | ||
port.open(function() { | ||
expect(port.isOpen()).to.be.true; | ||
expect(port.isOpen).to.be.true; | ||
done(); | ||
@@ -49,3 +49,3 @@ }); | ||
port.close(function() { | ||
expect(port.isOpen()).to.be.false; | ||
expect(port.isOpen).to.be.false; | ||
done(); | ||
@@ -52,0 +52,0 @@ }); |
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
191393
49
5034