From d82810d5e7aad212dd90181aa03782dd006d714d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Feb 2023 15:22:01 +0100 Subject: [PATCH] add dumpFrom method --- mission/tmtc/PersistentTmStore.cpp | 12 ++++++++++-- mission/tmtc/PersistentTmStore.h | 1 + tmtc | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mission/tmtc/PersistentTmStore.cpp b/mission/tmtc/PersistentTmStore.cpp index d1bf054e..8b0c4ee4 100644 --- a/mission/tmtc/PersistentTmStore.cpp +++ b/mission/tmtc/PersistentTmStore.cpp @@ -57,6 +57,10 @@ ReturnValue_t TmStore::passPacket(PusTmReader& reader) { return returnvalue::OK; } +void TmStore::dumpFrom(uint32_t fromUnixSeconds, TmFunnelBase &tmFunnel) { + return dumpFromUpTo(fromUnixSeconds, currentTv.tv_sec, tmFunnel); +} + ReturnValue_t TmStore::storePacket(PusTmReader& reader) { using namespace std::filesystem; if (baseDirUninitialized) { @@ -208,8 +212,12 @@ void TmStore::dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds, TmFunnelBase& funnel) { using namespace std::filesystem; for (auto const& file : directory_iterator(basePath)) { - if (file.is_directory() or - (mostRecentFile.has_value() and (mostRecentFile.value() == file.path()))) { + if (file.is_directory()) { + continue; + } + if (mostRecentFile.has_value() and mostRecentTv.has_value() and + (file.path() == mostRecentFile.value()) and + (upToUnixSeconds < static_cast(mostRecentTv.value().tv_sec))) { continue; } Clock::TimeOfDay_t tod; diff --git a/mission/tmtc/PersistentTmStore.h b/mission/tmtc/PersistentTmStore.h index 91acb3a1..8575f35f 100644 --- a/mission/tmtc/PersistentTmStore.h +++ b/mission/tmtc/PersistentTmStore.h @@ -39,6 +39,7 @@ class TmStore : public SystemObject { void addServiceSubservice(uint8_t service, uint8_t subservice); void deleteUpTo(uint32_t unixSeconds); + void dumpFrom(uint32_t fromUnixSeconds, TmFunnelBase& tmFunnel); void dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds, TmFunnelBase& tmFunnel); void updateBaseDir(); diff --git a/tmtc b/tmtc index d6445d38..2bd6caa3 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d6445d38a8eb644a5e1bd27f0fc56d29e93c030d +Subproject commit 2bd6caa3c21255f2ab5a2773eb83d2fca78c2234