From 5d3e861fc9f6c8741cf5574f5a7b195adeeaefd8 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 22 Nov 2021 10:34:16 +0100 Subject: [PATCH] Gathering first data from textPacket --- handler/textPacketHandler.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/handler/textPacketHandler.hpp b/handler/textPacketHandler.hpp index 5f80210..244a29e 100644 --- a/handler/textPacketHandler.hpp +++ b/handler/textPacketHandler.hpp @@ -2,10 +2,32 @@ #define EE781A91_6D07_47AC_B3C4_F99E29F3731F #include +#include "../DTO/packet.hpp" #include +#include + +std::vector split(const std::string& s, char delimiter) +{ + std::vector tokens; + std::string token; + std::istringstream tokenStream(s); + while (std::getline(tokenStream, token, delimiter)) + { + tokens.push_back(token); + } + return tokens; +} void textPacketHandler(std::vector textPacket){ /// Here we have to parse the packet + // Create empty packet + Packet packet; + + const std::string textHeader = textPacket[0]; + + const std::vector headerData = split(textHeader, ' '); + + std::string textTimestamp = headerData[0]; } #endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */