eive-obsw/mission/tmtc/PersistentSingleTmStoreTask.cpp
Robin Mueller 4257e1d918
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
events when dump is done
2023-03-10 19:01:31 +01:00

32 lines
990 B
C++

#include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <mission/tmtc/PersistentSingleTmStoreTask.h>
PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(
object_id_t objectId, StorageManagerIF& ipcStore, PersistentTmStoreWithTmQueue& tmStore,
VirtualChannel& channel, Event eventIfDumpDone, SdCardMountedIF& sdcMan)
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan),
storeWithQueue(tmStore),
eventIfDumpDone(eventIfDumpDone) {}
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
while (true) {
// Delay done by the check
if (not cyclicStoreCheck()) {
continue;
}
bool busy = handleOneStore(storeWithQueue, eventIfDumpDone);
if (not busy) {
TaskFactory::delayTask(40);
}
}
}
bool PersistentSingleTmStoreTask::initStoresIfPossible() {
if (sdcMan.isSdCardUsable(std::nullopt)) {
storeWithQueue.initializeTmStore();
return true;
}
return false;
}