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 14 additions and 8 deletions
Showing only changes of commit 5d67b896aa - Show all commits

View File

@ -19,6 +19,8 @@ PusTmFunnel::PusTmFunnel(object_id_t objectId, TimeReaderIF &timeReader, Storage
sdcMan(sdcMan) {
Clock::getClock_timeval(&currentTv);
Clock::getUptime(&lastTvUpdate);
hkStore.addApid(config::EIVE_PUS_APID);
hkStore.addService(3);
miscStore.addApid(config::EIVE_PUS_APID);
miscStore.addService(17);
miscStore.addService(200);
@ -88,12 +90,9 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
lastTvUpdate = currentUptime;
}
if (sdcMan.isSdCardUsable(std::nullopt)) {
if (not storesInitialized) {
miscStore.updateBaseDir();
okStore.updateBaseDir();
storesInitialized = true;
}
bool sdcUsable = sdcMan.isSdCardUsable(std::nullopt);
initStoresIfPossible(sdcUsable);
if (sdcUsable) {
miscStore.passPacket(packet);
okStore.passPacket(packet);
}
@ -131,11 +130,17 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
const char *PusTmFunnel::getName() const { return "PUS TM Funnel"; }
ReturnValue_t PusTmFunnel::initialize() {
if (not storesInitialized and sdcMan.isSdCardUsable(std::nullopt)) {
void PusTmFunnel::initStoresIfPossible(bool sdCardUsable) {
if (not storesInitialized and sdCardUsable) {
miscStore.updateBaseDir();
okStore.updateBaseDir();
hkStore.updateBaseDir();
notOkStore.updateBaseDir();
storesInitialized = true;
}
}
ReturnValue_t PusTmFunnel::initialize() {
initStoresIfPossible(sdcMan.isSdCardUsable(std::nullopt));
return returnvalue::OK;
}

View File

@ -45,6 +45,7 @@ class PusTmFunnel : public TmFunnelBase {
SdCardMountedIF &sdcMan;
ReturnValue_t handlePacket(TmTcMessage &message);
void initStoresIfPossible(bool sdCardUsable);
ReturnValue_t initialize() override;
};