end-to-end file transfer working

This commit is contained in:
Robin Müller 2022-09-14 14:01:14 +02:00
parent c9383ca20b
commit 64a58c65dd
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 42 additions and 39 deletions

View File

@ -11,8 +11,7 @@ using namespace cfdp;
CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerCfg& cfdpCfg)
: SystemObject(fsfwParams.objectId),
UserBase(fsfwParams.vfs),
destHandler(DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, *this), *this,
destHandler(DestHandlerParams(LocalEntityCfg(cfdpCfg.id, cfdpCfg.indicCfg, *this), cfdpCfg.userHandler,
cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
cfdpCfg.lostSegmentsList),
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
@ -63,20 +62,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t operationCode) {
return status;
}
void CfdpHandler::transactionIndication(const cfdp::TransactionId& id) {}
void CfdpHandler::eofSentIndication(const cfdp::TransactionId& id) {}
void CfdpHandler::transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) {}
void CfdpHandler::metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) {}
void CfdpHandler::fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) {}
void CfdpHandler::reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) {}
void CfdpHandler::suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) {}
void CfdpHandler::resumedIndication(const cfdp::TransactionId& id, size_t progress) {}
void CfdpHandler::faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) {}
void CfdpHandler::abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) {}
void CfdpHandler::eofRecvIndication(const cfdp::TransactionId& id) {}
ReturnValue_t CfdpHandler::handleCfdpPacket(TmTcMessage& msg) {
auto accessorPair = tcStore->getData(msg.getStorageId());
if(accessorPair.first != OK) {

View File

@ -22,23 +22,26 @@ struct FsfwHandlerParams {
struct CfdpHandlerCfg {
CfdpHandlerCfg(cfdp::EntityId localId, cfdp::IndicationCfg indicationCfg,
cfdp::PacketInfoListBase& packetInfo, cfdp::LostSegmentsListBase& lostSegmentsList,
cfdp::UserBase &userHandler,
cfdp::PacketInfoListBase& packetInfo,
cfdp::LostSegmentsListBase& lostSegmentsList,
cfdp::RemoteConfigTableIF& remoteCfgProvider)
: id(std::move(localId)),
indicCfg(indicationCfg),
packetInfoList(packetInfo),
lostSegmentsList(lostSegmentsList),
remoteCfgProvider(remoteCfgProvider) {}
remoteCfgProvider(remoteCfgProvider),
userHandler(userHandler) {}
cfdp::EntityId id;
cfdp::IndicationCfg indicCfg;
cfdp::PacketInfoListBase& packetInfoList;
cfdp::LostSegmentsListBase& lostSegmentsList;
cfdp::RemoteConfigTableIF& remoteCfgProvider;
cfdp::UserBase& userHandler;
};
class CfdpHandler : public SystemObject,
public cfdp::UserBase,
public cfdp::FaultHandlerBase,
public ExecutableObjectIF,
public AcceptsTelecommandsIF {
@ -52,20 +55,6 @@ class CfdpHandler : public SystemObject,
ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode) override;
// CFDP user overrides
void transactionIndication(const cfdp::TransactionId& id) override;
void eofSentIndication(const cfdp::TransactionId& id) override;
void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override;
void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override;
void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override;
void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override;
void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override;
void resumedIndication(const cfdp::TransactionId& id, size_t progress) override;
void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) override;
void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) override;
void eofRecvIndication(const cfdp::TransactionId& id) override;
void noticeOfSuspensionCb(cfdp::ConditionCode code) override;
void noticeOfCancellationCb(cfdp::ConditionCode code) override;
void abandonCb(cfdp::ConditionCode code) override;

View File

@ -22,6 +22,31 @@
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
class CfdpExampleUserHandler: public cfdp::UserBase {
public:
explicit CfdpExampleUserHandler(HasFileSystemIF& vfs): cfdp::UserBase(vfs) {}
void transactionIndication(const cfdp::TransactionId& id) override {}
void eofSentIndication(const cfdp::TransactionId& id) override {}
void transactionFinishedIndication(const cfdp::TransactionFinishedParams& params) override {
sif::info << "File transaction finished for transaction with " << params.id << std::endl;
}
void metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) override {
sif::info << "Metadata received for transaction with " << params.id << std::endl;
}
void fileSegmentRecvdIndication(const cfdp::FileSegmentRecvdParams& params) override {}
void reportIndication(const cfdp::TransactionId& id, cfdp::StatusReportIF& report) override {}
void suspendedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code) override {}
void resumedIndication(const cfdp::TransactionId& id, size_t progress) override {}
void faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) override {}
void abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) override {}
void eofRecvIndication(const cfdp::TransactionId& id) override {
sif::info << "EOF PDU received for transaction with " << id << std::endl;
}
};
void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
StorageManagerIF* tcStore = nullptr;
@ -74,11 +99,15 @@ void ObjectFactory::produce(void* args) {
cfdp::IndicationCfg indicationCfg;
UnsignedByteField<uint16_t> apid(common::COMMON_CFDP_APID);
cfdp::EntityId localId(apid);
cfdp::RemoteEntityCfg remoteCfg;
cfdp::OneRemoteConfigProvider remoteCfgProvider(remoteCfg);
UnsignedByteField<uint16_t> remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID);
cfdp::EntityId remoteId(remoteEntityId);
cfdp::RemoteEntityCfg remoteCfg(remoteId);
remoteCfg.defaultChecksum = cfdp::ChecksumTypes::CRC_32;
auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg);
auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs);
cfdp::PacketInfoList<64> packetList;
cfdp::LostSegmentsList<128> lostSegments;
CfdpHandlerCfg cfg(localId, indicationCfg, packetList, lostSegments, remoteCfgProvider);
CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, packetList, lostSegments, *remoteCfgProvider);
auto* cfdpHandler = new CfdpHandler(params, cfg);
CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID,
cfdpHandler->getRequestQueue(), true);

@ -1 +1 @@
Subproject commit 22585773e7b31975a0335344036d3b6baa4d0fcb
Subproject commit 6b914a21fd52fe184784b90984bb4bc2db82544d

2
fsfw

@ -1 +1 @@
Subproject commit 382543fc5989c6608e0aa7550ace6aa70f7d78e3
Subproject commit 44615c150b7690a3beccf459e3203561f17edf0a

@ -1 +1 @@
Subproject commit 6ee3fa67dc1d34288192b512d4e7cc0927c51b7d
Subproject commit 0e1d4516519573fb33319eac7e9a56906a8db1a6