diff --git a/src/dto/Packet.js b/src/dto/Packet.js index 66b7f80..2162779 100644 --- a/src/dto/Packet.js +++ b/src/dto/Packet.js @@ -24,7 +24,10 @@ class Packet{ frequency; dataRate; - payloadSize; + payloadData; + get payloadSize(){ + return payloadData.length/2; + } packetType; } diff --git a/src/streamHandler/PacketStreamFactory.js b/src/streamHandler/PacketStreamFactory.js index 668683d..3770075 100644 --- a/src/streamHandler/PacketStreamFactory.js +++ b/src/streamHandler/PacketStreamFactory.js @@ -76,8 +76,7 @@ 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 + packet.payloadData = data.join('').match(/(?<=\s)([A-F0-9]{1,4}(?!(\.|x)))/igm)?.join('') ?? ''; } }