this works

This commit is contained in:
Robin Müller 2022-09-07 18:38:25 +02:00
parent b1e704cd11
commit dd866790f3
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 78 additions and 10 deletions

View File

@ -3,9 +3,14 @@
#include "fsfw/ipc/QueueFactory.h"
using namespace returnvalue;
CfdpHandler::CfdpHandler(object_id_t objectId, AcceptsTelemetryIF& packetDest,
const cfdp::DestHandlerParams& destParams)
: SystemObject(objectId), destHandler(destParams, cfdp::FsfwParams(packetDest, nullptr, this)) {
using namespace cfdp;
CfdpHandler::CfdpHandler(const HandlerCfg& cfg)
: SystemObject(cfg.objectId),
UserBase(cfg.vfs),
destHandler(
DestHandlerParams(cfg.cfg, *this, *this, cfg.packetInfoList, cfg.lostSegmentsList),
FsfwParams(cfg.packetDest, nullptr, this)) {
// TODO: Make configurable?
msgQueue = QueueFactory::instance()->createMessageQueue();
destHandler.setMsgQueue(*msgQueue);
@ -13,13 +18,13 @@ CfdpHandler::CfdpHandler(object_id_t objectId, AcceptsTelemetryIF& packetDest,
[[nodiscard]] const char* CfdpHandler::getName() const { return "CFDP Handler"; }
[[nodiscard]] uint32_t CfdpHandler::getIdentifier() const { return 0; }
[[nodiscard]] MessageQueueId_t CfdpHandler::getRequestQueue() const {
// TODO: return TC queue here
[[nodiscard]] uint32_t CfdpHandler::getIdentifier() const {
// TODO: Return local entity ID? Which will probably be equal to APID
return 0;
}
[[nodiscard]] MessageQueueId_t CfdpHandler::getRequestQueue() const { return msgQueue->getId(); }
ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = destHandler.initialize();
if (result != OK) {
@ -27,3 +32,27 @@ ReturnValue_t CfdpHandler::initialize() {
}
return SystemObject::initialize();
}
ReturnValue_t CfdpHandler::performOperation(uint8_t operationCode) {
// TODO: Receive TC packets and route them to source and dest handler, depending on which is
// correct or more appropriate
return OK;
}
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) {}
bool CfdpHandler::getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) {
return false;
}

View File

@ -1,19 +1,58 @@
#ifndef FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
#define FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
#include <utility>
#include "fsfw/cfdp/handler/DestHandler.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
class CfdpHandler : public SystemObject, public AcceptsTelecommandsIF {
struct HandlerCfg {
HandlerCfg(object_id_t objectId, cfdp::LocalEntityCfg cfg, HasFileSystemIF& vfs,
AcceptsTelemetryIF& packetDest, cfdp::PacketInfoListBase& packetInfo,
cfdp::LostSegmentsListBase& lostSegmentsList)
: objectId(objectId),
cfg(std::move(cfg)),
vfs(vfs),
packetInfoList(packetInfo),
lostSegmentsList(lostSegmentsList),
packetDest(packetDest) {}
object_id_t objectId{};
cfdp::LocalEntityCfg cfg;
HasFileSystemIF& vfs;
cfdp::PacketInfoListBase& packetInfoList;
cfdp::LostSegmentsListBase& lostSegmentsList;
AcceptsTelemetryIF& packetDest;
};
class CfdpHandler : public SystemObject,
public cfdp::UserBase,
public cfdp::RemoteConfigTableIF,
public ExecutableObjectIF,
public AcceptsTelecommandsIF {
public:
CfdpHandler(object_id_t objectId, AcceptsTelemetryIF& packetDest,
const cfdp::DestHandlerParams& destParams);
explicit CfdpHandler(const HandlerCfg& cfg);
bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) override;
[[nodiscard]] const char* getName() const override;
[[nodiscard]] uint32_t getIdentifier() const override;
[[nodiscard]] MessageQueueId_t getRequestQueue() const override;
ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode) override;
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;
private:
MessageQueueIF* msgQueue = nullptr;