2022-09-07 18:21:16 +02:00
|
|
|
#ifndef FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
|
|
|
|
#define FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
|
|
|
|
|
2022-09-07 18:38:25 +02:00
|
|
|
#include <utility>
|
|
|
|
|
2022-09-07 18:21:16 +02:00
|
|
|
#include "fsfw/cfdp/handler/DestHandler.h"
|
|
|
|
#include "fsfw/objectmanager/SystemObject.h"
|
2022-09-07 18:38:25 +02:00
|
|
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
2022-09-07 18:21:16 +02:00
|
|
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
2022-09-08 11:26:29 +02:00
|
|
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
2022-09-07 18:21:16 +02:00
|
|
|
|
2022-09-08 11:26:29 +02:00
|
|
|
struct FsfwHandlerParams {
|
|
|
|
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
|
|
|
|
StorageManagerIF& tcStore, StorageManagerIF& tmStore)
|
|
|
|
: objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore) {}
|
2022-09-07 18:38:25 +02:00
|
|
|
object_id_t objectId{};
|
|
|
|
HasFileSystemIF& vfs;
|
2022-09-08 11:26:29 +02:00
|
|
|
AcceptsTelemetryIF& packetDest;
|
|
|
|
StorageManagerIF& tcStore;
|
|
|
|
StorageManagerIF& tmStore;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CfdpHandlerCfg {
|
2022-09-08 16:26:47 +02:00
|
|
|
CfdpHandlerCfg(cfdp::EntityId localId, cfdp::IndicationCfg indicationCfg,
|
|
|
|
cfdp::PacketInfoListBase& packetInfo, cfdp::LostSegmentsListBase& lostSegmentsList,
|
2022-09-08 15:49:18 +02:00
|
|
|
cfdp::RemoteConfigTableIF& remoteCfgProvider)
|
2022-09-08 16:26:47 +02:00
|
|
|
: id(std::move(localId)),
|
|
|
|
indicCfg(indicationCfg),
|
2022-09-08 15:49:18 +02:00
|
|
|
packetInfoList(packetInfo),
|
|
|
|
lostSegmentsList(lostSegmentsList),
|
|
|
|
remoteCfgProvider(remoteCfgProvider) {}
|
2022-09-08 11:26:29 +02:00
|
|
|
|
2022-09-08 16:26:47 +02:00
|
|
|
cfdp::EntityId id;
|
|
|
|
cfdp::IndicationCfg indicCfg;
|
2022-09-07 18:38:25 +02:00
|
|
|
cfdp::PacketInfoListBase& packetInfoList;
|
|
|
|
cfdp::LostSegmentsListBase& lostSegmentsList;
|
2022-09-08 15:49:18 +02:00
|
|
|
cfdp::RemoteConfigTableIF& remoteCfgProvider;
|
2022-09-07 18:38:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CfdpHandler : public SystemObject,
|
|
|
|
public cfdp::UserBase,
|
2022-09-08 16:26:47 +02:00
|
|
|
public cfdp::FaultHandlerBase,
|
2022-09-07 18:38:25 +02:00
|
|
|
public ExecutableObjectIF,
|
|
|
|
public AcceptsTelecommandsIF {
|
2022-09-07 18:21:16 +02:00
|
|
|
public:
|
2022-09-08 11:26:29 +02:00
|
|
|
explicit CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerCfg& cfdpCfg);
|
2022-09-07 18:40:10 +02:00
|
|
|
|
2022-09-07 18:21:16 +02:00
|
|
|
[[nodiscard]] const char* getName() const override;
|
|
|
|
[[nodiscard]] uint32_t getIdentifier() const override;
|
|
|
|
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
|
|
|
|
|
|
|
|
ReturnValue_t initialize() override;
|
2022-09-07 18:38:25 +02:00
|
|
|
ReturnValue_t performOperation(uint8_t operationCode) override;
|
2022-09-07 18:40:10 +02:00
|
|
|
|
|
|
|
// CFDP user overrides
|
2022-09-07 18:38:25 +02:00
|
|
|
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;
|
2022-09-08 17:39:59 +02:00
|
|
|
void noticeOfSuspensionCb(cfdp::ConditionCode code) override;
|
|
|
|
void noticeOfCancellationCb(cfdp::ConditionCode code) override;
|
|
|
|
void abandonCb(cfdp::ConditionCode code) override;
|
|
|
|
void ignoreCb(cfdp::ConditionCode code) override;
|
2022-09-07 18:21:16 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
MessageQueueIF* msgQueue = nullptr;
|
|
|
|
cfdp::DestHandler destHandler;
|
2022-09-08 11:26:29 +02:00
|
|
|
StorageManagerIF* tcStore = nullptr;
|
|
|
|
StorageManagerIF* tmStore = nullptr;
|
|
|
|
|
|
|
|
ReturnValue_t handleCfdpPacket(TmTcMessage& msg);
|
2022-09-07 18:21:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
|