clean up handler a bit
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-08-14 21:22:01 +02:00
parent d2ae8e9362
commit c09c0ee947
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
3 changed files with 50 additions and 12 deletions

2
fsfw

@ -1 +1 @@
Subproject commit cb1aaea6cd10f34bf46adf8f91f86af1fb42041a
Subproject commit 8c1168524049ef0e5b2144b6c04aeb01538053c2

View File

@ -1,5 +1,7 @@
#include "CfdpHandler.h"
#include <fsfw/ipc/CommandMessage.h>
#include "fsfw/cfdp/pdu/AckPduReader.h"
#include "fsfw/cfdp/pdu/PduHeaderReader.h"
#include "fsfw/globalfunctions/arrayprinter.h"
@ -42,17 +44,14 @@ ReturnValue_t CfdpHandler::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
ReturnValue_t status;
ReturnValue_t result = OK;
TmTcMessage tmtcMsg;
for (status = pduQueue.receiveMessage(&tmtcMsg); status == returnvalue::OK;
status = pduQueue.receiveMessage(&tmtcMsg)) {
result = handlePduPacket(tmtcMsg);
ReturnValue_t status = OK;
ReturnValue_t result = handlePduPacketMessages();
if (result != OK) {
status = result;
}
result = handleCfdpMessages();
if (result != OK) {
status = result;
}
const DestHandler::FsmResult& destResult = destHandler.stateMachine();
// TODO: Error handling?
@ -139,3 +138,38 @@ ReturnValue_t CfdpHandler::handlePduPacket(TmTcMessage& msg) {
}
return result;
}
ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
// TODO: Handle CFDP requests here, most importantly put requests. If a put request is received,
// check whether one is pending. If none are, start a transaction with the put request, otherwise
// store for put request inside a FIFO for later processing.
return OK;
}
ReturnValue_t CfdpHandler::handlePduPacketMessages() {
ReturnValue_t status;
ReturnValue_t result = OK;
TmTcMessage pduMsg;
for (status = pduQueue.receiveMessage(&pduMsg); status == returnvalue::OK;
status = pduQueue.receiveMessage(&pduMsg)) {
result = handlePduPacket(pduMsg);
if (result != OK) {
status = result;
}
}
return status;
}
ReturnValue_t CfdpHandler::handleCfdpMessages() {
ReturnValue_t status;
ReturnValue_t result;
CommandMessage cfdpMsg;
for (status = cfdpRequestQueue.receiveMessage(&cfdpMsg); status == returnvalue::OK;
status = cfdpRequestQueue.receiveMessage(&cfdpMsg)) {
result = handleCfdpRequest(cfdpMsg);
if (result != OK) {
status = result;
}
}
return status;
}

View File

@ -2,6 +2,7 @@
#define FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
#include <fsfw/cfdp/handler/SourceHandler.h>
#include <fsfw/ipc/CommandMessage.h>
#include <utility>
@ -77,7 +78,10 @@ class CfdpHandler : public SystemObject, public ExecutableObjectIF, public Accep
StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
ReturnValue_t handlePduPacketMessages();
ReturnValue_t handlePduPacket(TmTcMessage& msg);
ReturnValue_t handleCfdpRequest(CommandMessage& msg);
ReturnValue_t handleCfdpMessages();
};
#endif // FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H