eive-obsw/mission/tmtc/TmStore.h
Robin Mueller 293082a7e8
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
this logic should work
2022-12-12 18:17:59 +01:00

48 lines
1.4 KiB
C++

#ifndef MISSION_TMTC_TMSTOREBACKEND_H_
#define MISSION_TMTC_TMSTOREBACKEND_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tmstorage/TmStoreFrontendIF.h>
#include <fsfw/tmtcpacket/pus/tm/PusTmReader.h>
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
#include <mission/memory/SdCardMountedIF.h>
#include <filesystem>
struct PacketFilter {
std::optional<std::vector<uint16_t>> apid;
std::optional<std::vector<uint8_t>> services;
std::optional<std::vector<std::pair<uint8_t, uint8_t>>> serviceSubservices;
};
enum class RolloverInterval { HOURLY, DAILY };
class TmStore : public SystemObject {
public:
TmStore(object_id_t objectId, std::string baseName, RolloverInterval interval,
uint8_t intervalFactor, PacketFilter filter, SdCardMountedIF& sdcMan);
ReturnValue_t passPacket(PusTmReader& reader);
ReturnValue_t storePacket(PusTmReader& reader);
private:
static constexpr size_t MAX_FILESIZE = 8192;
/**
* To get the queue where commands shall be sent.
* @return Id of command queue.
*/
MessageQueueId_t getCommandQueue();
PacketFilter filter;
std::string baseName;
RolloverInterval interval;
uint8_t intervalFactor;
char NAME_BUF[524] = {};
std::array<uint8_t, 8192> fileBuf{};
std::optional<timeval> mostRecentTv;
std::optional<std::filesystem::path> mostRecentFile;
SdCardMountedIF& sdcMan;
};
#endif /* MISSION_TMTC_TMSTOREBACKEND_H_ */