Socket
Socket
Sign inDemoInstall

modbus-serial

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modbus-serial - npm Package Compare versions

Comparing version 3.6.2 to 3.6.9

42

index.js

@@ -298,2 +298,9 @@ 'use strict';

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -344,2 +351,9 @@ this._nextAddress = address;

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -377,2 +391,9 @@ this._nextAddress = address;

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -415,2 +436,9 @@ this._nextAddress = address;

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -449,2 +477,9 @@ this._nextAddress = address;

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -497,2 +532,9 @@ this._nextAddress = address;

// check port is actually open before attempting write
if( this._port.isOpen() === false) {
var error = "Port Not Open";
if (next) next(error);
return;
}
// set state variables

@@ -499,0 +541,0 @@ this._nextAddress = address;

2

package.json
{
"name": "modbus-serial",
"version": "3.6.2",
"version": "3.6.9",
"description": "A pure JavaScript implemetation of MODBUS-RTU (and TCP) for NodeJS.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -179,4 +179,11 @@ 'use strict';

/**
* Send data to a modbus slave via telnet server
* Check if port is open
*/
AsciiPort.prototype.isOpen = function() {
return this._client.isOpen();
};
/**
* Send data to a modbus slave
*/
AsciiPort.prototype.write = function (data) {

@@ -183,0 +190,0 @@ // check data length

@@ -37,2 +37,3 @@ 'use strict';

this.ip = ip;
this.openFlag = false;

@@ -77,2 +78,10 @@ // options

this._client.on('listening', function() {
this.openFlag = true;
});
this._client.on('close', function(had_error) {
this.openFlag = false;
});
events.call(this);

@@ -100,2 +109,9 @@ };

/**
* Check if port is open
*/
UdpPort.prototype.isOpen = function() {
return this.openFlag;
};
/**
* Send data to a modbus-tcp slave

@@ -102,0 +118,0 @@ */

@@ -102,4 +102,11 @@ 'use strict';

/**
* Send data to a modbus slave via telnet server
* Check if port is open
*/
RTUBufferedPort.prototype.isOpen = function() {
return this._client.isOpen();
};
/**
* Send data to a modbus slave
*/
RTUBufferedPort.prototype.write = function (data) {

@@ -106,0 +113,0 @@ // check data length

@@ -16,7 +16,8 @@ 'use strict';

this.ip = ip;
this.openFlag = false;
// options
if (typeof(options) == 'undefined') options = {};
this.port = options.port || MODBUS_PORT; // modbus port
// create a socket

@@ -27,6 +28,6 @@ this._client = new net.Socket();

var crc;
// check data length
if (data.length < 6) return;
// cut 6 bytes of mbap, copy pdu and add crc

@@ -37,3 +38,3 @@ buffer = new Buffer(data.length - 6 + 2);

buffer.writeUInt16LE(crc, buffer.length - 2);
// emit a data signal

@@ -43,2 +44,10 @@ _tcpport.emit('data', buffer);

this._client.on('connect', function() {
this.openFlag = true;
});
this._client.on('close', function(had_error) {
this.openFlag = false;
});
events.call(this);

@@ -65,2 +74,9 @@ };

/**
* Check if port is open
*/
TcpPort.prototype.isOpen = function() {
return this.openFlag;
};
/**
* Send data to a modbus-tcp slave

@@ -75,3 +91,3 @@ */

data.copy(buffer, 6);
// send buffer to slave

@@ -78,0 +94,0 @@ this._client.write(buffer);

@@ -37,2 +37,3 @@ 'use strict';

this.ip = ip;
this.openFlag = false;

@@ -88,2 +89,10 @@ // options

this._client.on('connect', function() {
this.openFlag = true;
});
this._client.on('close', function(had_error) {
this.openFlag = false;
});
events.call(this);

@@ -110,2 +119,9 @@ };

/**
* Check if port is open
*/
TelnetPort.prototype.isOpen = function() {
return this.openFlag;
};
/**
* Send data to a modbus slave via telnet server

@@ -112,0 +128,0 @@ */

@@ -48,2 +48,9 @@ 'use strict';

/**
* Check if port is open
*/
TestPort.prototype.isOpen = function() {
return true;
};
/**
* Simulate successful/failure port requests and replays

@@ -184,3 +191,3 @@ */

var state = buf.readBit(i, 7);
if (state) {

@@ -187,0 +194,0 @@ this._coils |= (1 << (address + i));

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc