Persistent TM Store #320

Merged
muellerr merged 109 commits from mueller/pus-15-tm-storage into develop 2023-02-24 19:03:39 +01:00
3 changed files with 27 additions and 51 deletions
Showing only changes of commit d5867f104f - Show all commits

View File

@ -42,7 +42,7 @@
//! When using the newlib nano library, C99 support for stdio facilities
//! will not be provided. This define should be set to 1 if this is the case.
#define FSFW_NO_C99_IO 1
#define FSFW_NO_C99_IO 0
//! Specify whether a special mode store is used for Subsystem components.
#define FSFW_USE_MODESTORE 0

View File

@ -1,32 +1,14 @@
#include "TmStore.h"
#include <mission/memory/SdCardMountedIF.h>
using namespace returnvalue;
const char* TmStore::getName() const { return "TM Store Backend"; }
TmStore::TmStore(object_id_t objectId, SdCardMountedIF& sdcMan)
: SystemObject(objectId), sdcMan(sdcMan) {}
MessageQueueId_t TmStore::getReportReceptionQueue(uint8_t virtualChannel) const {
return MessageQueueIF::NO_QUEUE;
ReturnValue_t TmStore::passPacket(PusTmReader& reader) {
return returnvalue::OK;
}
MessageQueueId_t TmStore::getCommandQueue() const { return MessageQueueIF::NO_QUEUE; }
TmStoreBackendIF* TmStore::getBackend() const { return nullptr; }
ReturnValue_t TmStore::packetRetrieved(PusTmReader* packet, uint32_t address) { return OK; }
void TmStore::noMorePacketsInStore() {}
void TmStore::handleRetrievalFailed(ReturnValue_t errorCode, uint32_t parameter1,
uint32_t parameter2) {}
ReturnValue_t TmStore::fetchPackets(ApidSsc start, ApidSsc end) { return OK; }
ReturnValue_t TmStore::deletePackets(ApidSsc upTo) { return OK; }
ReturnValue_t TmStore::checkPacket(SpacePacketReader* tmPacket) { return OK; }
void TmStore::setEnabled(bool enabled) {}
void TmStore::resetDownlinkedPacketCount() {}
ReturnValue_t TmStore::setDumpTarget(object_id_t dumpTarget) { return OK; }
MessageQueueId_t TmStore::getCommandQueue() { return MessageQueueIF::NO_QUEUE; }

View File

@ -1,44 +1,38 @@
#ifndef MISSION_TMTC_TMSTOREBACKEND_H_
#define MISSION_TMTC_TMSTOREBACKEND_H_
#include <mission/memory/SdCardMountedIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tmstorage/TmStoreFrontendIF.h>
#include <fsfw/tmtcpacket/pus/tm/PusTmReader.h>
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
class TmStore : public TmStoreFrontendIF, public AcceptsTelemetryIF {
struct PacketFilter {
std::optional<uint16_t> apid;
std::optional<uint8_t> service;
std::optional<std::pair<uint8_t, uint8_t>> serviceSubservice;
};
class TmStore : public SystemObject {
public:
[[nodiscard]] const char* getName() const override;
[[nodiscard]] MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const override;
TmStore(object_id_t objectId, SdCardMountedIF& sdcMan);
ReturnValue_t passPacket(PusTmReader& reader);
private:
/**
* To get the queue where commands shall be sent.
* @return Id of command queue.
*/
MessageQueueId_t getCommandQueue() const override;
MessageQueueId_t getCommandQueue();
TmStoreBackendIF* getBackend() const override;
SdCardMountedIF& sdcMan;
/**
* Callback from the back-end to indicate a certain packet was received.
* front-end takes care of discarding/downloading the packet.
* @param packet Pointer to the newly received Space Packet.
* @param address Start address of the packet found
* @param isLastPacket Indicates if no more packets can be fetched.
* @return If more packets shall be fetched, returnvalue::OK must be returned.
* Any other code stops fetching packets.
*/
ReturnValue_t packetRetrieved(PusTmReader* packet, uint32_t address) override;
void noMorePacketsInStore() override;
void handleRetrievalFailed(ReturnValue_t errorCode, uint32_t parameter1 = 0,
uint32_t parameter2 = 0) override;
ReturnValue_t fetchPackets(ApidSsc start, ApidSsc end) override;
ReturnValue_t deletePackets(ApidSsc upTo) override;
ReturnValue_t checkPacket(SpacePacketReader* tmPacket) override;
bool isEnabled() const = 0;
void setEnabled(bool enabled) override;
void resetDownlinkedPacketCount() override;
ReturnValue_t setDumpTarget(object_id_t dumpTarget) override;
std::vector<uint16_t> apidToStore;
std::vector<uint8_t> servicesToStore;
std::vector<std::pair<uint8_t, uint8_t>> serviceSubserviceCombinationToStore;
};
#endif /* MISSION_TMTC_TMSTOREBACKEND_H_ */