Socket
Socket
Sign inDemoInstall

node-modbus

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-modbus - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

1

node-modbus/modbus-client-core.js

@@ -140,3 +140,2 @@ /**

// handle pdu
var handler = responseHandler[currentRequest.fc]

@@ -143,0 +142,0 @@ if (!handler) {

33

node-modbus/modbus-serial-client.js

@@ -18,2 +18,7 @@ /**

var receiveBuffer = Buffer.alloc(256)
var receivedBytes
var expectedBytes
var exeptionMessageLength = 5
if (!this.connectionDelay) {

@@ -108,6 +113,28 @@ if (process.platform === 'win32') {

var onData = function (pdu) {
this.log.debug('received data ' + JSON.stringify(pdu))
if (pdu.length !== 0) { // at least one byte has been received
this.log.debug('received data ' + JSON.stringify(pdu))
if (crc.crc16modbus(pdu) === 0) { /* PDU is valid if CRC across whole PDU equals 0, else ignore and do nothing */
this.emit('data', pdu.slice(1))
if ((pdu.length + receivedBytes) <= receiveBuffer.length) {
pdu.copy(receiveBuffer, receivedBytes, 0)
receivedBytes += pdu.length
if (receivedBytes >= exeptionMessageLength) {
if (receivedBytes === exeptionMessageLength) {
if (receiveBuffer[1] >= 128 &&
crc.crc16modbus(receiveBuffer.slice(0, receivedBytes)) === 0) {
this.emit('data', receiveBuffer.slice(1, receivedBytes - 1))
}
} else {
if (receivedBytes === expectedBytes) {
if (crc.crc16modbus(receiveBuffer.slice(0, receivedBytes)) === 0) {
this.emit('data', receiveBuffer.slice(1, receivedBytes - 1))
}
} else {
this.log.debug('received bytes ' + expectedBytes + ' differ from expected bytes ' + receivedBytes)
}
}
} else {
this.log.debug('received bytes to less to do more -> receivedBytes:' + receivedBytes)
}
}
}

@@ -114,0 +141,0 @@ }.bind(this)

@@ -8,4 +8,6 @@ /**

var stampit = require('stampit')
var ModbusCore = require('./modbus-client-core.js')
module.exports = stampit()
.compose(ModbusCore)
.init(function () {

@@ -12,0 +14,0 @@ var reqId = 0

@@ -7,4 +7,6 @@ /**

var stampit = require('stampit')
var log = require('stampit-log')
module.exports = stampit()
.compose(log)
.init(function () {

@@ -11,0 +13,0 @@ let buffer = Buffer.alloc(0)

{
"name": "node-modbus",
"version": "3.0.1",
"version": "3.0.2",
"description": "Sum of implementations for the Serial/TCP Modbus protocol.",

@@ -5,0 +5,0 @@ "author": "Klaus Landsdorf <klaus.landsdorf@bianco-royal.de>",

[![NPM download](https://img.shields.io/npm/dm/node-modbus.svg)](http://www.npm-stats.com/~packages/node-modbus) [![NPM version](https://badge.fury.io/js/node-modbus.png)](http://badge.fury.io/js/node-modbus)
**NOT ready - just for development with node-red-contrib-modbus for now!**
**Please help with your contribution to the package!**
**You can help with your contribution to the package!**
[![nodemodbus64](images/modbus-icon64.png)](https://www.npmjs.com/package/node-red-contrib-modbus)

@@ -7,0 +8,0 @@

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