From 025edf8465b170c17711a3e2ad62f080409c6183 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Wed, 24 Nov 2021 20:42:10 +0100 Subject: [PATCH] Implemented getting payloadData and calculating to bytes --- src/streamHandler/PacketStreamFactory.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/streamHandler/PacketStreamFactory.js b/src/streamHandler/PacketStreamFactory.js index 32193b0..668683d 100644 --- a/src/streamHandler/PacketStreamFactory.js +++ b/src/streamHandler/PacketStreamFactory.js @@ -75,7 +75,9 @@ class PacketStreamFactory extends Transform{ } _handlePayload(packet, data){ - + // Get payload-Hex-Data. If there is no data: empty + let payloadData = data.join('').match(/(?<=\s)([A-F0-9]{1,4}(?!(\.|x)))/igm)?.join('') ?? ''; + packet.payloadSize = payloadData.length/2; // 2 hex-chars = 1 byte } }