debugging

This commit is contained in:
Robin Müller 2023-09-06 10:11:09 +02:00
parent 448fbd0d38
commit c143198494
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 15 additions and 6 deletions

View File

@ -11,6 +11,7 @@
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/objectmanager.h" #include "fsfw/objectmanager.h"
#include "fsfw/serviceinterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/tmtcservices/TmTcMessage.h"
using namespace returnvalue; using namespace returnvalue;
@ -69,13 +70,10 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
if (step == TransactionStep::SENDING_FILE_DATA) { if (step == TransactionStep::SENDING_FILE_DATA) {
bool noFdPdu = false; bool noFdPdu = false;
result = prepareAndSendNextFileDataPdu(noFdPdu); result = prepareAndSendNextFileDataPdu(noFdPdu);
if (result != OK) { if (result == OK and !noFdPdu) {
// TODO: Error handling
}
if (!noFdPdu) {
fsmResult.callStatus = CallStatus::CALL_AGAIN; fsmResult.callStatus = CallStatus::CALL_AGAIN;
return fsmResult;
} }
return fsmResult;
} }
if (step == TransactionStep::SENDING_EOF) { if (step == TransactionStep::SENDING_EOF) {
result = prepareAndSendEofPdu(); result = prepareAndSendEofPdu();
@ -269,16 +267,20 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu(bool& noFileDat
addError(result); addError(result);
return result; return result;
} }
sif::debug << "sending next fd pdu, offset " << offset.value() << "" << std::endl;
auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), readLen); auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), readLen);
auto fileDataPdu = FileDataCreator(transactionParams.pduConf, fileDataInfo); auto fileDataPdu = FileDataCreator(transactionParams.pduConf, fileDataInfo);
result = sendGenericPdu(fileDataPdu); result = sendGenericPdu(fileDataPdu);
if (result != OK) { if (result != OK) {
sif::debug << "SENDING generic PDU failed" << std::endl;
return result; return result;
} }
transactionParams.progress += readLen; transactionParams.progress += readLen;
if (transactionParams.progress >= fileSize) { if (transactionParams.progress >= fileSize) {
// Advance FSM after all file data PDUs were sent. // Advance FSM after all file data PDUs were sent.
step = TransactionStep::SENDING_EOF; step = TransactionStep::SENDING_EOF;
sif::debug << "done" << std::endl;
TaskFactory::delayTask(10000);
} }
return OK; return OK;
} }
@ -322,6 +324,10 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) {
fsfwParams.tmStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr); fsfwParams.tmStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
if (result != OK) { if (result != OK) {
addError(result); addError(result);
fsmResult.callStatus = CallStatus::CALL_AFTER_DELAY;
if(result == StorageManagerIF::DATA_STORAGE_FULL) {
return TM_STORE_FULL;
}
return result; return result;
} }
size_t serializedLen = 0; size_t serializedLen = 0;
@ -333,8 +339,10 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) {
TmTcMessage tmMsg(storeId); TmTcMessage tmMsg(storeId);
result = result =
fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tmMsg); fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tmMsg);
if (result == MessageQueueIF::FULL) { if(result != OK) {
fsmResult.callStatus = CallStatus::CALL_AFTER_DELAY; fsmResult.callStatus = CallStatus::CALL_AFTER_DELAY;
}
if (result == MessageQueueIF::FULL) {
return TARGET_MSG_QUEUE_FULL; return TARGET_MSG_QUEUE_FULL;
} else if (result == OK) { } else if (result == OK) {
fsmResult.packetsSent += 1; fsmResult.packetsSent += 1;

View File

@ -70,6 +70,7 @@ static constexpr ReturnValue_t SOURCE_NAME_EMPTY = returnvalue::makeCode(CID, 3)
static constexpr ReturnValue_t DEST_NAME_EMPTY = returnvalue::makeCode(CID, 4); static constexpr ReturnValue_t DEST_NAME_EMPTY = returnvalue::makeCode(CID, 4);
static constexpr ReturnValue_t WRONG_REMOTE_CFG_ENTITY_ID = returnvalue::makeCode(CID, 5); static constexpr ReturnValue_t WRONG_REMOTE_CFG_ENTITY_ID = returnvalue::makeCode(CID, 5);
static constexpr ReturnValue_t TARGET_MSG_QUEUE_FULL = returnvalue::makeCode(CID, 6); static constexpr ReturnValue_t TARGET_MSG_QUEUE_FULL = returnvalue::makeCode(CID, 6);
static constexpr ReturnValue_t TM_STORE_FULL = returnvalue::makeCode(CID, 7);
} // namespace cfdp } // namespace cfdp
#endif // FSFW_CFDP_HANDLER_DEFS_H #endif // FSFW_CFDP_HANDLER_DEFS_H