2023-03-09 11:46:13 +01:00
|
|
|
#include "PusTmRouteByFilterHelper.h"
|
|
|
|
|
|
|
|
#include <fsfw/ipc/MessageQueueIF.h>
|
|
|
|
|
|
|
|
PusTmRouteByFilterHelper::PusTmRouteByFilterHelper() = default;
|
|
|
|
|
|
|
|
bool PusTmRouteByFilterHelper::packetMatches(PusTmReader& reader, MessageQueueId_t& destination) {
|
2023-03-09 20:38:50 +01:00
|
|
|
for (const auto& filterAndDest : routerMap) {
|
2023-03-09 11:46:13 +01:00
|
|
|
if (filterAndDest.first.packetMatches(reader)) {
|
|
|
|
destination = filterAndDest.second;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PusTmRouteByFilterHelper::addRouting(PusPacketFilter filter, MessageQueueId_t destination) {
|
|
|
|
routerMap.emplace_back(std::move(filter), destination);
|
|
|
|
}
|