introduce queue for put requests
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-08-30 11:47:39 +02:00
parent 2f6565621b
commit b6b342bf99
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 19 additions and 4 deletions

View File

@ -143,11 +143,22 @@ ReturnValue_t CfdpHandler::handlePduPacket(TmTcMessage& msg) {
ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) { ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
// TODO: Handle CFDP requests here, most importantly put requests. If a put request is received, // 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 // check whether one is pending. If none are, start a transaction with the put request,
// store for put request inside a FIFO for later processing. // otherwise store for put request inside a FIFO for later processing.
auto accessorPair = ipcStore.getData(CfdpMessage::getStoreId(&msg)); auto accessorPair = ipcStore.getData(CfdpMessage::getStoreId(&msg));
if (msg.getCommand() == CfdpMessage::PUT_REQUEST) {
sif::info << "received CFDP request" << std::endl; sif::info << "Received CFDP put request" << std::endl;
if (srcHandler.getState() != CfdpState::IDLE) {
if (putRequestQueue.full()) {
// TODO: Trigger event and discard request. Queue is full, too many requests.
return FAILED;
}
putRequestQueue.push(CfdpMessage::getStoreId(&msg));
} else {
// TODO: Retrieve put request and remote configuration.
// srcHandler.transactionStart()
}
}
return OK; return OK;
} }
@ -159,6 +170,7 @@ ReturnValue_t CfdpHandler::handlePduPacketMessages() {
status = pduQueue.receiveMessage(&pduMsg)) { status = pduQueue.receiveMessage(&pduMsg)) {
result = handlePduPacket(pduMsg); result = handlePduPacket(pduMsg);
if (result != OK) { if (result != OK) {
// TODO: Maybe add printout with context specific information?
status = result; status = result;
} }
} }
@ -173,6 +185,7 @@ ReturnValue_t CfdpHandler::handleCfdpMessages() {
status = cfdpRequestQueue.receiveMessage(&cfdpMsg)) { status = cfdpRequestQueue.receiveMessage(&cfdpMsg)) {
result = handleCfdpRequest(cfdpMsg); result = handleCfdpRequest(cfdpMsg);
if (result != OK) { if (result != OK) {
// TODO: Maybe add printout with context specific information?
status = result; status = result;
} }
} }

View File

@ -1,6 +1,7 @@
#ifndef FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H #ifndef FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
#define FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H #define FSFW_EXAMPLE_HOSTED_CFDPHANDLER_H
#include <etl/queue.h>
#include <fsfw/cfdp/handler/SourceHandler.h> #include <fsfw/cfdp/handler/SourceHandler.h>
#include <fsfw/ipc/CommandMessage.h> #include <fsfw/ipc/CommandMessage.h>
@ -77,6 +78,7 @@ class CfdpHandler : public SystemObject, public ExecutableObjectIF, public Accep
SeqCountProviderU16 seqCntProvider; SeqCountProviderU16 seqCntProvider;
cfdp::DestHandler destHandler; cfdp::DestHandler destHandler;
cfdp::SourceHandler srcHandler; cfdp::SourceHandler srcHandler;
etl::queue<store_address_t, 16> putRequestQueue;
StorageManagerIF& ipcStore; StorageManagerIF& ipcStore;
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;