CFDP source handler #776

Merged
muellerr merged 96 commits from cfdp-source-handler into main 2023-10-19 11:11:31 +02:00
7 changed files with 112 additions and 70 deletions
Showing only changes of commit 952e1c16e5 - Show all commits

View File

@ -1 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE CfdpHandler.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE CfdpHandler.cpp CfdpUser.cpp)

View File

@ -0,0 +1,31 @@
#ifndef MISSION_CFDP_CFDPFAULTHANDLER_H_
#define MISSION_CFDP_CFDPFAULTHANDLER_H_
#include "fsfw/cfdp.h"
namespace cfdp {
class EiveFaultHandler : public cfdp::FaultHandlerBase {
Review

should these maybe trigger an event or are they purely for ground debugging?

should these maybe trigger an event or are they purely for ground debugging?
Review

It might make sense to trigger events for some of these callbacks.. or even all of them.

It might make sense to trigger events for some of these callbacks.. or even all of them.
public:
void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Notice of suspension detected for transaction " << id
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Notice of suspension detected for transaction " << id
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Transaction " << id
<< " was abandoned, condition code : " << cfdp::getConditionCodeString(code)
<< std::endl;
}
void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Fault ignored for transaction " << id
<< ", condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
};
} // namespace cfdp
#endif /* MISSION_CFDP_CFDPFAULTHANDLER_H_ */

42
mission/cfdp/CfdpUser.cpp Normal file
View File

@ -0,0 +1,42 @@
#include "CfdpUser.h"
#include <fsfw/ipc/QueueFactory.h>
namespace cfdp {
EiveUserHandler::EiveUserHandler(HasFileSystemIF& vfs, MessageQueueId_t cfdpRequestId)
: cfdp::UserBase(vfs) {
userQueue = QueueFactory::instance()->createMessageQueue(10);
userQueue->setDefaultDestination(cfdpRequestId);
}
EiveUserHandler::~EiveUserHandler() {
QueueFactory::instance()->deleteMessageQueue(userQueue);
}
void EiveUserHandler::transactionIndication(const cfdp::TransactionId& id) {}
void EiveUserHandler::eofSentIndication(const cfdp::TransactionId& id) {}
void EiveUserHandler::transactionFinishedIndication(
const cfdp::TransactionFinishedParams& params) {
sif::info << "File transaction finished for transaction with " << params.id << std::endl;
}
void EiveUserHandler::metadataRecvdIndication(const cfdp::MetadataRecvdParams& params) {
// TODO: Parse user messages and convert them into put requests where applicable.
sif::info << "Metadata received for transaction with " << params.id << std::endl;
}
void EiveUserHandler::fileSegmentRecvdIndication(
const cfdp::FileSegmentRecvdParams& params) {}
void EiveUserHandler::reportIndication(const cfdp::TransactionId& id,
cfdp::StatusReportIF& report) {}
void EiveUserHandler::suspendedIndication(const cfdp::TransactionId& id,
cfdp::ConditionCode code) {}
void EiveUserHandler::resumedIndication(const cfdp::TransactionId& id, size_t progress) {}
void EiveUserHandler::faultIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) {}
void EiveUserHandler::abandonedIndication(const cfdp::TransactionId& id, cfdp::ConditionCode code,
size_t progress) {}
void EiveUserHandler::eofRecvIndication(const cfdp::TransactionId& id) {
sif::info << "EOF PDU received for transaction with " << id << std::endl;
}
} // namespace cfdp

34
mission/cfdp/CfdpUser.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef MISSION_CFDP_CFDPUSER_H_
#define MISSION_CFDP_CFDPUSER_H_
#include <fsfw/cfdp/handler/UserBase.h>
namespace cfdp {
class EiveUserHandler : public cfdp::UserBase {
public:
explicit EiveUserHandler(HasFileSystemIF& vfs, MessageQueueId_t cfdpRequestId);
virtual ~EiveUserHandler();
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);
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;
private:
MessageQueueIF* userQueue;
};
} // namespace cfdp
#endif /* MISSION_CFDP_CFDPUSER_H_ */

View File

@ -1,66 +0,0 @@
#ifndef MISSION_CFDP_CONFIG_H_
#define MISSION_CFDP_CONFIG_H_
#include "fsfw/cfdp.h"
namespace cfdp {
class EiveUserHandler : public cfdp::UserBase {
public:
explicit EiveUserHandler(HasFileSystemIF& vfs, MessageQueueId_t cfdpRequestId)
: cfdp::UserBase(vfs) {
userQueue = QueueFactory::instance()->createMessageQueue(10);
userQueue->setDefaultDestination(cfdpRequestId);
}
virtual ~EiveUserHandler() { QueueFactory::instance()->deleteMessageQueue(userQueue); }
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 {
// TODO: Parse user messages and convert them into put requests where applicable.
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;
}
private:
MessageQueueIF* userQueue;
};
class EiveFaultHandler : public cfdp::FaultHandlerBase {
public:
void noticeOfSuspensionCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Notice of suspension detected for transaction " << id
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
void noticeOfCancellationCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Notice of suspension detected for transaction " << id
<< " with condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
void abandonCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Transaction " << id
<< " was abandoned, condition code : " << cfdp::getConditionCodeString(code)
<< std::endl;
}
void ignoreCb(cfdp::TransactionId& id, cfdp::ConditionCode code) override {
sif::warning << "Fault ignored for transaction " << id
<< ", condition code: " << cfdp::getConditionCodeString(code) << std::endl;
}
};
} // namespace cfdp
#endif /* MISSION_CFDP_CONFIG_H_ */

View File

@ -22,7 +22,9 @@
#include <fsfw/tcdistribution/PusDistributor.h>
#include <fsfw/timemanager/CdsShortTimeStamper.h>
#include <fsfw_hal/host/HostFilesystem.h>
#include <mission/cfdp/CfdpFaultHandler.h>
#include <mission/cfdp/CfdpHandler.h>
#include <mission/cfdp/CfdpUser.h>
#include <mission/controller/ThermalController.h>
#include <mission/genericFactory.h>
#include <mission/persistentTmStoreDefs.h>
@ -44,7 +46,6 @@
#include "devices/gpioIds.h"
#include "eive/definitions.h"
#include "fsfw/pus/Service11TelecommandScheduling.h"
#include "mission/cfdp/Config.h"
#include "mission/system/acs/RwAssembly.h"
#include "mission/system/acs/acsModeTree.h"
#include "mission/system/tcs/tcsModeTree.h"
@ -276,7 +277,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
auto* tmtcQueue = QueueFactory::instance()->createMessageQueue(32);
auto* cfdpQueue = QueueFactory::instance()->createMessageQueue(16);
auto eiveUserHandler = new EiveUserHandler(HOST_FS, cfdpQueue->getId());
auto eiveUserHandler = new cfdp::EiveUserHandler(HOST_FS, cfdpQueue->getId());
FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, **cfdpFunnel, *tcStore, **tmStore,
*tmtcQueue, *cfdpQueue);
cfdp::IndicationCfg indicationCfg;

2
tmtc

@ -1 +1 @@
Subproject commit fd3a799019f6910cbbb4447cc9605340d66c2703
Subproject commit b50c75c13cdbbc3d34d2f072d2bf1cb2fbe734b5