Persistent TM Store #320

Merged
muellerr merged 109 commits from mueller/pus-15-tm-storage into develop 2023-02-24 19:03:39 +01:00
2 changed files with 15 additions and 6 deletions
Showing only changes of commit 130a3ce727 - Show all commits

View File

@ -56,7 +56,12 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT; sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
packet.updateErrorControl(); packet.updateErrorControl();
if(sdcMan.isSdCardUsable(std::nullopt)) { if (sdcMan.isSdCardUsable(std::nullopt)) {
if (not storesInitialized) {
miscStore.updateBaseDir();
miscStore.updateCurrentTimestamp();
storesInitialized = true;
}
miscStore.passPacket(packet); miscStore.passPacket(packet);
} }
@ -94,7 +99,10 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
const char *PusTmFunnel::getName() const { return "PUS TM Funnel"; } const char *PusTmFunnel::getName() const { return "PUS TM Funnel"; }
ReturnValue_t PusTmFunnel::initialize() { ReturnValue_t PusTmFunnel::initialize() {
if (not storesInitialized and sdcMan.isSdCardUsable(std::nullopt)) {
miscStore.updateBaseDir(); miscStore.updateBaseDir();
miscStore.updateCurrentTimestamp(); miscStore.updateCurrentTimestamp();
storesInitialized = true;
}
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -36,8 +36,9 @@ class PusTmFunnel : public TmFunnelBase {
private: private:
uint16_t sourceSequenceCount = 0; uint16_t sourceSequenceCount = 0;
TimeReaderIF &timeReader; TimeReaderIF &timeReader;
bool storesInitialized = false;
TmStore miscStore; TmStore miscStore;
SdCardMountedIF& sdcMan; SdCardMountedIF &sdcMan;
ReturnValue_t handlePacket(TmTcMessage &message); ReturnValue_t handlePacket(TmTcMessage &message);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;