share the FSFW Param block

This commit is contained in:
Robin Müller 2023-07-17 10:25:09 +02:00
parent 35712070cf
commit f44110a7f5
Signed by: muellerr
GPG Key ID: A649FB78196E3849
6 changed files with 28 additions and 47 deletions

View File

@ -14,7 +14,7 @@
using namespace returnvalue; using namespace returnvalue;
cfdp::DestHandler::DestHandler(DestHandlerParams params, FsfwDestParams fsfwParams) cfdp::DestHandler::DestHandler(DestHandlerParams params, FsfwParams fsfwParams)
: tlvVec(params.maxTlvsInOnePdu), : tlvVec(params.maxTlvsInOnePdu),
userTlvVec(params.maxTlvsInOnePdu), userTlvVec(params.maxTlvsInOnePdu),
destParams(std::move(params)), destParams(std::move(params)),

View File

@ -47,25 +47,6 @@ struct DestHandlerParams {
size_t maxFilenameLen = 255; size_t maxFilenameLen = 255;
}; };
struct FsfwDestParams {
FsfwDestParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore,
StorageManagerIF& tmStore)
: FsfwDestParams(packetDest, msgQueue, eventReporter) {
this->tcStore = &tcStore;
this->tmStore = &tmStore;
}
FsfwDestParams(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;
};
enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN }; enum class CallStatus { DONE, CALL_AFTER_DELAY, CALL_AGAIN };
class DestHandler { class DestHandler {
@ -101,7 +82,7 @@ class DestHandler {
*/ */
ReturnValue_t PARTIAL_SUCCESS = returnvalue::makeCode(0, 2); ReturnValue_t PARTIAL_SUCCESS = returnvalue::makeCode(0, 2);
ReturnValue_t FAILURE = returnvalue::makeCode(0, 3); ReturnValue_t FAILURE = returnvalue::makeCode(0, 3);
explicit DestHandler(DestHandlerParams handlerParams, FsfwDestParams fsfwParams); explicit DestHandler(DestHandlerParams handlerParams, FsfwParams fsfwParams);
/** /**
* *
@ -166,7 +147,7 @@ class DestHandler {
std::vector<cfdp::Tlv> tlvVec; std::vector<cfdp::Tlv> tlvVec;
std::vector<cfdp::Tlv> userTlvVec; std::vector<cfdp::Tlv> userTlvVec;
DestHandlerParams destParams; DestHandlerParams destParams;
FsfwDestParams fsfwParams; cfdp::FsfwParams fsfwParams;
TransactionParams transactionParams; TransactionParams transactionParams;
FsmResult fsmRes; FsmResult fsmRes;

View File

@ -8,7 +8,7 @@
using namespace returnvalue; using namespace returnvalue;
cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams) cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwParams)
: transactionParams(params.maxFilePathSize), : transactionParams(params.maxFilePathSize),
sourceParams(std::move(params)), sourceParams(std::move(params)),
fsfwParams(fsfwParams) {} fsfwParams(fsfwParams) {}

View File

@ -22,30 +22,9 @@ 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 {
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 { class SourceHandler {
public: public:
SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams); SourceHandler(SourceHandlerParams params, FsfwParams fsfwParams);
/** /**
* Pass a put request to the source handler, which might initiate a CFDP transaction and start * Pass a put request to the source handler, which might initiate a CFDP transaction and start
@ -80,7 +59,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; cfdp::FsfwParams fsfwParams;
void fsmNacked(); void fsmNacked();
ReturnValue_t checksumGeneration(); ReturnValue_t checksumGeneration();

View File

@ -3,7 +3,9 @@
#include <etl/list.h> #include <etl/list.h>
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/storagemanager/storeAddress.h" #include "fsfw/storagemanager/storeAddress.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
namespace cfdp { namespace cfdp {
@ -22,6 +24,25 @@ struct PacketInfo {
PacketInfo() = default; PacketInfo() = default;
}; };
struct FsfwParams {
FsfwParams(AcceptsTelemetryIF& packetDest, MessageQueueIF* msgQueue,
EventReportingProxyIF* eventReporter, StorageManagerIF& tcStore,
StorageManagerIF& tmStore)
: FsfwParams(packetDest, msgQueue, eventReporter) {
this->tcStore = &tcStore;
this->tmStore = &tmStore;
}
FsfwParams(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;
};
template <size_t SIZE> template <size_t SIZE>
using PacketInfoList = etl::list<PacketInfo, SIZE>; using PacketInfoList = etl::list<PacketInfo, SIZE>;
using PacketInfoListBase = etl::ilist<PacketInfo>; using PacketInfoListBase = etl::ilist<PacketInfo>;

View File

@ -38,7 +38,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}}; LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}};
StorageManagerMock tcStore(2, storeCfg); StorageManagerMock tcStore(2, storeCfg);
StorageManagerMock tmStore(3, storeCfg); StorageManagerMock tmStore(3, storeCfg);
FsfwDestParams fp(tmReceiver, &mqMock, &eventReporterMock); FsfwParams fp(tmReceiver, &mqMock, &eventReporterMock);
RemoteEntityCfg cfg(remoteId); RemoteEntityCfg cfg(remoteId);
remoteCfgTableMock.addRemoteConfig(cfg); remoteCfgTableMock.addRemoteConfig(cfg);
fp.tcStore = &tcStore; fp.tcStore = &tcStore;