continue TM handling refactoring
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
37
mission/tmtc/PersistentSingleTmStoreTask.cpp
Normal file
37
mission/tmtc/PersistentSingleTmStoreTask.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <mission/tmtc/PersistentSingleTmStoreTask.h>
|
||||
|
||||
PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(object_id_t objectId,
|
||||
StorageManagerIF& ipcStore,
|
||||
PersistentTmStoreWithTmQueue& tmStore,
|
||||
VirtualChannel& channel)
|
||||
: SystemObject(objectId), ipcStore(ipcStore), storeWithQueue(tmStore), channel(channel) {}
|
||||
|
||||
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
||||
ReturnValue_t result;
|
||||
auto& store = storeWithQueue.getTmStore();
|
||||
bool noTmToStoreReceived = false;
|
||||
bool noTcRequestReceived = false;
|
||||
while (true) {
|
||||
// Store TM persistently
|
||||
result = storeWithQueue.handleNextTm();
|
||||
if (result == MessageQueueIF::NO_QUEUE) {
|
||||
noTmToStoreReceived = true;
|
||||
}
|
||||
// Handle TC requests, for example deletion or retrieval requests.
|
||||
result = store.handleCommandQueue(ipcStore);
|
||||
if (result == MessageQueueIF::NO_QUEUE) {
|
||||
noTcRequestReceived = true;
|
||||
}
|
||||
// Dump TMs when applicable
|
||||
if (store.getState() == PersistentTmStore::State::DUMPING) {
|
||||
size_t dumpedLen;
|
||||
// TODO: Maybe do a bit of a delay every 100-200 packets?
|
||||
// TODO: handle returnvalue?
|
||||
store.dumpNextPacket(channel, dumpedLen);
|
||||
} else if (noTcRequestReceived and noTmToStoreReceived) {
|
||||
// Nothng to do, so sleep for a bit.
|
||||
TaskFactory::delayTask(5);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user