From 58a535401a38a522a7707dcbc578d3393def73e6 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 22 Nov 2021 12:37:28 +0100 Subject: [PATCH] Grabbing first data from header --- handler/textPacketHandler.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/handler/textPacketHandler.hpp b/handler/textPacketHandler.hpp index 0d26562..7bb7015 100644 --- a/handler/textPacketHandler.hpp +++ b/handler/textPacketHandler.hpp @@ -9,6 +9,7 @@ #include #include "../helper/split.hpp" #include "../helper/timestampConvert.hpp" +#include "../helper/find.hpp" void textPacketHandler(std::vector textPacket){ /// Here we have to parse the packet @@ -22,6 +23,18 @@ void textPacketHandler(std::vector textPacket){ std::string textTimestamp = headerData[0]; uint64_t timestamp = convertStringToTimestampMicros(textTimestamp); + // Find remaining data based on keys in/around fields + int linkSpeedIndex = findIs(headerData, "Mb/s", 1, 1); + packet.dataRate = std::stoi(headerData[linkSpeedIndex]); + + int frequencyIndex = findIs(headerData, "MHz", 1, 1); + packet.frequency = std::stoi(headerData[frequencyIndex]); + + int signalIndex = findIs(headerData, "signal", 1, 1); + std::string signalText = headerData[signalIndex].substr(0, 3); + packet.signal = std::stoi(signalText); + + // Addresses seem complicated at first, but just have many fields which might be available. } #endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */