From c2210dfb5968bb48b92c3f9630951f179a407d44 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Wed, 24 Nov 2021 21:11:19 +0100 Subject: [PATCH] Added isRetry field --- src/dto/Packet.js | 1 + src/streamHandler/PacketStreamFactory.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/dto/Packet.js b/src/dto/Packet.js index e908c52..0b4fda5 100644 --- a/src/dto/Packet.js +++ b/src/dto/Packet.js @@ -14,6 +14,7 @@ const PacketType = { class Packet{ timestampMicros; + isRetry; srcMac; dstMac; diff --git a/src/streamHandler/PacketStreamFactory.js b/src/streamHandler/PacketStreamFactory.js index dffb102..01795da 100644 --- a/src/streamHandler/PacketStreamFactory.js +++ b/src/streamHandler/PacketStreamFactory.js @@ -48,6 +48,8 @@ class PacketStreamFactory extends Transform{ // Convert time to epoch-micros Unfortunately luxon doesnt use micros, but millis as smallest time-unit requiring some "hacks" packet.timestampMicros = DateTime.fromISO(data.slice(0, 12)).toSeconds() + data.slice(12, 15)/1000000; + packet.isRetry = data.match(/(^| )Retry($| )/i)? true: false; + packet.dataRate = Number(data.match(/(^| )([0-9]+(\.[0-9]+)?) Mb\/s($| )/i)?.[2]) || null; packet.frequency = Number(data.match(/(^| )([0-9]{4}) MHz($| )/i)?.[2]) || null;