Skip to content

Commit 683399c

Browse files
committed
fix mbap payload length
Even though it's not copied to the payload, data already includes the CRC. This leads to an invalid payload length in the MBAP header.
1 parent 863401c commit 683399c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tcpport.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ TcpPort.prototype.write = function (data) {
8383
var buffer = new Buffer(data.length + 6 - 2);
8484
buffer.writeUInt16BE(1, 0);
8585
buffer.writeUInt16BE(0, 2);
86-
buffer.writeUInt16BE(data.length, 4);
86+
// subtract crc bytes
87+
buffer.writeUInt16BE(data.length - 2, 4);
8788
data.copy(buffer, 6);
8889

8990
// send buffer to slave

0 commit comments

Comments
 (0)