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;
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() {
if (step == TransactionStep::IDLE) {
@ -79,3 +81,5 @@ ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
transactionParams.crc = crcCalc.value();
return OK;
}
ReturnValue_t cfdp::SourceHandler::putRequest() { return 0; }

View File

@ -10,6 +10,7 @@
#include "fsfw/cfdp/handler/mib.h"
#include "fsfw/events/EventReportingProxyIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
namespace cfdp {
@ -21,18 +22,37 @@ struct SourceHandlerParams {
size_t maxFilePathSize = 256;
};
// TODO: This class in identical to the ones used by the destination handler. Consider unifying
// them.
struct FsfwSourceParams {
FsfwSourceParams(EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore)
: tcStore(&tcStore){};
FsfwSourceParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
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;
StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
};
class SourceHandler {
public:
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();
private:
@ -60,6 +80,7 @@ class SourceHandler {
cfdp::CfdpState state = cfdp::CfdpState::IDLE;
TransactionStep step = TransactionStep::IDLE;
SourceHandlerParams sourceParams;
FsfwSourceParams fsfwParams;
void fsmNacked();
ReturnValue_t checksumGeneration();