some sort of filter handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-11-11 15:39:27 +01:00
parent f60a80f308
commit c599714aea
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 57 additions and 21 deletions

View File

@ -574,7 +574,7 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
auto* syrlinksUartCookie = auto* syrlinksUartCookie =
new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven(); syrlinksUartCookie->setParityEven();
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER); auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
@ -603,7 +603,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC"); gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC");
auto mpsocCookie = auto mpsocCookie =
new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
mpsocCookie->setNoFixedSizeReply(); mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
auto* mpsocHandler = new PlocMPSoCHandler( auto* mpsocHandler = new PlocMPSoCHandler(
@ -620,7 +620,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
gpioComIF->addGpios(supvGpioCookie); gpioComIF->addGpios(supvGpioCookie);
auto supervisorCookie = auto supervisorCookie =
new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV,
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply(); supervisorCookie->setNoFixedSizeReply();
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER); auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
auto* supvHandler = new PlocSupervisorHandler( auto* supvHandler = new PlocSupervisorHandler(
@ -907,7 +907,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) { void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
auto* starTrackerCookie = auto* starTrackerCookie =
new SerialCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, new SerialCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD,
startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL);
starTrackerCookie->setNoFixedSizeReply(); starTrackerCookie->setNoFixedSizeReply();
StrHelper* strHelper = new StrHelper(objects::STR_HELPER); StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
auto starTracker = auto starTracker =

2
fsfw

@ -1 +1 @@
Subproject commit 046dbe1deb8053f64d7ef85992dec22aea9a3a10 Subproject commit 2b6a33e718f896300ca08345a9211c2ae974d014

View File

@ -1,4 +1,10 @@
target_sources( target_sources(
${LIB_EIVE_MISSION} ${LIB_EIVE_MISSION}
PRIVATE CcsdsIpCoreHandler.cpp VirtualChannel.cpp TmFunnelHandler.cpp PRIVATE CcsdsIpCoreHandler.cpp
TmFunnelBase.cpp CfdpTmFunnel.cpp Service15TmStorage.cpp TmStore.cpp PusTmFunnel.cpp) VirtualChannel.cpp
TmFunnelHandler.cpp
TmFunnelBase.cpp
CfdpTmFunnel.cpp
Service15TmStorage.cpp
TmStore.cpp
PusTmFunnel.cpp)

View File

@ -1,14 +1,49 @@
#include "TmStore.h" #include "TmStore.h"
#include <mission/memory/SdCardMountedIF.h> #include <mission/memory/SdCardMountedIF.h>
#include <algorithm>
using namespace returnvalue; using namespace returnvalue;
TmStore::TmStore(object_id_t objectId, SdCardMountedIF& sdcMan) TmStore::TmStore(object_id_t objectId, std::string baseName, PacketFilter filter, SdCardMountedIF& sdcMan)
: SystemObject(objectId), sdcMan(sdcMan) {} : SystemObject(objectId), filter(filter), sdcMan(sdcMan) {}
ReturnValue_t TmStore::passPacket(PusTmReader& reader) { ReturnValue_t TmStore::passPacket(PusTmReader& reader) {
bool inApidList = false;
if (filter.apid) {
auto& apidFilter = filter.apid.value();
if (std::find(apidFilter.begin(), apidFilter.end(), reader.getApid()) != apidFilter.end()) {
if (not filter.serviceSubservices and not filter.services) {
return storePacket(reader);
}
inApidList = true;
}
}
std::pair<uint8_t, uint8_t> serviceSubservice;
serviceSubservice.first = reader.getService();
serviceSubservice.second = reader.getSubService();
if (filter.services) {
auto& serviceFilter = filter.services.value();
if (std::find(serviceFilter.begin(), serviceFilter.end(), serviceSubservice.first) !=
serviceFilter.end()) {
if (filter.apid and inApidList) {
return storePacket(reader);
}
}
}
if (filter.serviceSubservices) {
auto& serviceSubserviceFilter = filter.serviceSubservices.value();
if (std::find(serviceSubserviceFilter.begin(), serviceSubserviceFilter.end(),
serviceSubservice) != serviceSubserviceFilter.end()) {
if (filter.apid and inApidList) {
return storePacket(reader);
}
}
}
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t TmStore::storePacket(PusTmReader& reader) { return returnvalue::OK; }
MessageQueueId_t TmStore::getCommandQueue() { return MessageQueueIF::NO_QUEUE; } MessageQueueId_t TmStore::getCommandQueue() { return MessageQueueIF::NO_QUEUE; }

View File

@ -1,24 +1,24 @@
#ifndef MISSION_TMTC_TMSTOREBACKEND_H_ #ifndef MISSION_TMTC_TMSTOREBACKEND_H_
#define MISSION_TMTC_TMSTOREBACKEND_H_ #define MISSION_TMTC_TMSTOREBACKEND_H_
#include <mission/memory/SdCardMountedIF.h>
#include <fsfw/objectmanager/SystemObject.h> #include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tmstorage/TmStoreFrontendIF.h> #include <fsfw/tmstorage/TmStoreFrontendIF.h>
#include <fsfw/tmtcpacket/pus/tm/PusTmReader.h> #include <fsfw/tmtcpacket/pus/tm/PusTmReader.h>
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h> #include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
#include <mission/memory/SdCardMountedIF.h>
struct PacketFilter { struct PacketFilter {
std::optional<uint16_t> apid; std::optional<std::vector<uint16_t>> apid;
std::optional<uint8_t> service; std::optional<std::vector<uint8_t>> services;
std::optional<std::pair<uint8_t, uint8_t>> serviceSubservice; std::optional<std::vector<std::pair<uint8_t, uint8_t>>> serviceSubservices;
}; };
class TmStore : public SystemObject { class TmStore : public SystemObject {
public: public:
TmStore(object_id_t objectId, SdCardMountedIF& sdcMan); TmStore(object_id_t objectId, std::string baseName, PacketFilter filter, SdCardMountedIF& sdcMan);
ReturnValue_t passPacket(PusTmReader& reader); ReturnValue_t passPacket(PusTmReader& reader);
ReturnValue_t storePacket(PusTmReader& reader);
private: private:
/** /**
@ -26,13 +26,8 @@ class TmStore : public SystemObject {
* @return Id of command queue. * @return Id of command queue.
*/ */
MessageQueueId_t getCommandQueue(); MessageQueueId_t getCommandQueue();
PacketFilter filter;
SdCardMountedIF& sdcMan; SdCardMountedIF& sdcMan;
std::vector<uint16_t> apidToStore;
std::vector<uint8_t> servicesToStore;
std::vector<std::pair<uint8_t, uint8_t>> serviceSubserviceCombinationToStore;
}; };
#endif /* MISSION_TMTC_TMSTOREBACKEND_H_ */ #endif /* MISSION_TMTC_TMSTOREBACKEND_H_ */