From e86b5fca9a895aa02917238544ae65bfc34f0f0f Mon Sep 17 00:00:00 2001 From: Ruakij Date: Wed, 24 Nov 2021 22:35:59 +0100 Subject: [PATCH] Added durationMicros --- src/dto/Packet.js | 2 ++ src/streamHandler/PacketStreamFactory.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/dto/Packet.js b/src/dto/Packet.js index 3da3015..699dbe0 100644 --- a/src/dto/Packet.js +++ b/src/dto/Packet.js @@ -28,6 +28,8 @@ class Packet{ frequency; dataRate; + durationMicros; + payloadData; get payloadSize(){ return payloadData.length/2; diff --git a/src/streamHandler/PacketStreamFactory.js b/src/streamHandler/PacketStreamFactory.js index 262341f..43e4fa5 100644 --- a/src/streamHandler/PacketStreamFactory.js +++ b/src/streamHandler/PacketStreamFactory.js @@ -62,6 +62,8 @@ class PacketStreamFactory extends Transform{ 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; + packet.durationMicros = Number(data.match(/(^| )([0-9]{,4})us($| )/i)?.[2] ?? 0); + packet.signal = Number(data.match(/(^| )(-[0-9]{2})dBm Signal($| )/i)?.[2]) || null; let packetTypeStr = data.match(new RegExp(`(^|.{80} )(${PACKET_TYPES_REGEX})($| )`, 'i'))?.[2];