eive-obsw/mission/tmtc/PersistentTmStoreWithTmQueue.cpp
Robin Mueller b2fd2f5d83
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
now only scheduling is left
2023-03-09 19:42:20 +01:00

34 lines
1.1 KiB
C++

#include "PersistentTmStoreWithTmQueue.h"
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/tmtcservices/TmTcMessage.h>
PersistentTmStoreWithTmQueue::PersistentTmStoreWithTmQueue(PersistentTmStoreArgs args,
const char* storeName,
uint32_t tmQueueDepth)
: PersistentTmStore(args), storeName(storeName) {
tmQueue = QueueFactory::instance()->createMessageQueue(tmQueueDepth);
}
ReturnValue_t PersistentTmStoreWithTmQueue::handleNextTm() {
TmTcMessage msg;
ReturnValue_t result = tmQueue->receiveMessage(&msg);
if (result == MessageQueueIF::EMPTY) {
return result;
}
auto accessor = tmStore.getData(msg.getStorageId());
if (accessor.first != returnvalue::OK) {
return result;
}
PusTmReader reader(accessor.second.data(), accessor.second.size());
storePacket(reader);
return returnvalue::OK;
}
const char* PersistentTmStoreWithTmQueue::getName() const { return storeName; }
MessageQueueId_t PersistentTmStoreWithTmQueue::getReportReceptionQueue(
uint8_t virtualChannel) const {
return tmQueue->getId();
}