fsfw-example-hosted/bsp_hosted/core/CfdpHandler.cpp

59 lines
2.4 KiB
C++
Raw Normal View History

2022-09-07 18:21:16 +02:00
#include "CfdpHandler.h"
#include "fsfw/ipc/QueueFactory.h"
using namespace returnvalue;
2022-09-07 18:38:25 +02:00
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)) {
2022-09-07 18:40:10 +02:00
// TODO: Make queue params configurable, or better yet, expect it to be passed externally
2022-09-07 18:21:16 +02:00
msgQueue = QueueFactory::instance()->createMessageQueue();
destHandler.setMsgQueue(*msgQueue);
}
[[nodiscard]] const char* CfdpHandler::getName() const { return "CFDP Handler"; }
2022-09-07 18:38:25 +02:00
[[nodiscard]] uint32_t CfdpHandler::getIdentifier() const {
// TODO: Return local entity ID? Which will probably be equal to APID
2022-09-07 18:21:16 +02:00
return 0;
}
2022-09-07 18:38:25 +02:00
[[nodiscard]] MessageQueueId_t CfdpHandler::getRequestQueue() const { return msgQueue->getId(); }
2022-09-07 18:21:16 +02:00
ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = destHandler.initialize();
if (result != OK) {
return result;
}
return SystemObject::initialize();
}
2022-09-07 18:38:25 +02:00
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;
}