njs-modbus 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -3
- package/dist/index.mjs +9 -3
- package/dist/test/master.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -545,6 +545,7 @@ function lrc(data) {
|
|
|
545
545
|
return (~data.reduce((sum, n) => sum + n, 0) + 1) & 0xff;
|
|
546
546
|
}
|
|
547
547
|
|
|
548
|
+
const MAX_FRAME_LENGTH = 256;
|
|
548
549
|
class RtuApplicationLayer extends AbstractApplicationLayer {
|
|
549
550
|
constructor(physicalLayer,
|
|
550
551
|
/**
|
|
@@ -609,11 +610,16 @@ class RtuApplicationLayer extends AbstractApplicationLayer {
|
|
|
609
610
|
}
|
|
610
611
|
});
|
|
611
612
|
};
|
|
612
|
-
if (
|
|
613
|
-
|
|
613
|
+
if (this._bufferRx.length >= MAX_FRAME_LENGTH) {
|
|
614
|
+
handleData();
|
|
614
615
|
}
|
|
615
616
|
else {
|
|
616
|
-
|
|
617
|
+
if (threePointFiveT) {
|
|
618
|
+
this._timerThreePointFive = setTimeout(handleData, threePointFiveT);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
handleData();
|
|
622
|
+
}
|
|
617
623
|
}
|
|
618
624
|
};
|
|
619
625
|
physicalLayer.on('data', handleData);
|
package/dist/index.mjs
CHANGED
|
@@ -543,6 +543,7 @@ function lrc(data) {
|
|
|
543
543
|
return (~data.reduce((sum, n) => sum + n, 0) + 1) & 0xff;
|
|
544
544
|
}
|
|
545
545
|
|
|
546
|
+
const MAX_FRAME_LENGTH = 256;
|
|
546
547
|
class RtuApplicationLayer extends AbstractApplicationLayer {
|
|
547
548
|
constructor(physicalLayer,
|
|
548
549
|
/**
|
|
@@ -607,11 +608,16 @@ class RtuApplicationLayer extends AbstractApplicationLayer {
|
|
|
607
608
|
}
|
|
608
609
|
});
|
|
609
610
|
};
|
|
610
|
-
if (
|
|
611
|
-
|
|
611
|
+
if (this._bufferRx.length >= MAX_FRAME_LENGTH) {
|
|
612
|
+
handleData();
|
|
612
613
|
}
|
|
613
614
|
else {
|
|
614
|
-
|
|
615
|
+
if (threePointFiveT) {
|
|
616
|
+
this._timerThreePointFive = setTimeout(handleData, threePointFiveT);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
handleData();
|
|
620
|
+
}
|
|
615
621
|
}
|
|
616
622
|
};
|
|
617
623
|
physicalLayer.on('data', handleData);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|