source handler

This commit is contained in:
Robin Müller 2023-07-17 10:15:06 +02:00
parent 1b79713430
commit 35712070cf
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 28 additions and 3 deletions

View File

@ -9,7 +9,9 @@
using namespace returnvalue; using namespace returnvalue;
cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams) cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams)
: transactionParams(params.maxFilePathSize), sourceParams(std::move(params)) {} : transactionParams(params.maxFilePathSize),
sourceParams(std::move(params)),
fsfwParams(fsfwParams) {}
void cfdp::SourceHandler::fsmNacked() { void cfdp::SourceHandler::fsmNacked() {
if (step == TransactionStep::IDLE) { if (step == TransactionStep::IDLE) {
@ -79,3 +81,5 @@ ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
transactionParams.crc = crcCalc.value(); transactionParams.crc = crcCalc.value();
return OK; return OK;
} }
ReturnValue_t cfdp::SourceHandler::putRequest() { return 0; }

View File

@ -10,6 +10,7 @@
#include "fsfw/cfdp/handler/mib.h" #include "fsfw/cfdp/handler/mib.h"
#include "fsfw/events/EventReportingProxyIF.h" #include "fsfw/events/EventReportingProxyIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
namespace cfdp { namespace cfdp {
@ -21,18 +22,37 @@ struct SourceHandlerParams {
size_t maxFilePathSize = 256; size_t maxFilePathSize = 256;
}; };
// TODO: This class in identical to the ones used by the destination handler. Consider unifying
// them.
struct FsfwSourceParams { struct FsfwSourceParams {
FsfwSourceParams(EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore) FsfwSourceParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
: tcStore(&tcStore){}; EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore,
StorageManagerIF& tmStore)
: FsfwSourceParams(packetDest, msgQueue, eventReporter) {
this->tcStore = &tcStore;
this->tmStore = &tmStore;
}
FsfwSourceParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter)
: packetDest(packetDest), msgQueue(msgQueue), eventReporter(eventReporter) {}
AcceptsTelemetryIF& packetDest;
MessageQueueIF* msgQueue;
EventReportingProxyIF* eventReporter = nullptr; EventReportingProxyIF* eventReporter = nullptr;
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
}; };
class SourceHandler { class SourceHandler {
public: public:
SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams); SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams);
/**
* Pass a put request to the source handler, which might initiate a CFDP transaction and start
* the state machine
* @return
*/
ReturnValue_t putRequest();
void stateMachine(); void stateMachine();
private: private:
@ -60,6 +80,7 @@ class SourceHandler {
cfdp::CfdpState state = cfdp::CfdpState::IDLE; cfdp::CfdpState state = cfdp::CfdpState::IDLE;
TransactionStep step = TransactionStep::IDLE; TransactionStep step = TransactionStep::IDLE;
SourceHandlerParams sourceParams; SourceHandlerParams sourceParams;
FsfwSourceParams fsfwParams;
void fsmNacked(); void fsmNacked();
ReturnValue_t checksumGeneration(); ReturnValue_t checksumGeneration();