some sort of filter handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
f60a80f308
commit
c599714aea
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 046dbe1deb8053f64d7ef85992dec22aea9a3a10
|
Subproject commit 2b6a33e718f896300ca08345a9211c2ae974d014
|
@ -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)
|
||||||
|
@ -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; }
|
||||||
|
@ -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_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user