further tweaks for both CFDP handlers

This commit is contained in:
Robin Müller 2023-08-14 20:47:27 +02:00
parent b39e1c7e07
commit 60dcacf432
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
4 changed files with 13 additions and 6 deletions

View File

@ -23,7 +23,7 @@ cfdp::DestHandler::DestHandler(DestHandlerParams params, FsfwParams fsfwParams)
transactionParams.pduConf.direction = cfdp::Direction::TOWARDS_SENDER; transactionParams.pduConf.direction = cfdp::Direction::TOWARDS_SENDER;
} }
const cfdp::DestHandler::FsmResult& cfdp::DestHandler::performStateMachine() { const cfdp::DestHandler::FsmResult& cfdp::DestHandler::stateMachine() {
ReturnValue_t result; ReturnValue_t result;
uint8_t errorIdx = 0; uint8_t errorIdx = 0;
fsmRes.resetOfIteration(); fsmRes.resetOfIteration();

View File

@ -92,7 +92,7 @@ class DestHandler {
* - @c returnvalue::OK State machine OK for this execution cycle * - @c returnvalue::OK State machine OK for this execution cycle
* - @c CALL_FSM_AGAIN State machine should be called again. * - @c CALL_FSM_AGAIN State machine should be called again.
*/ */
const FsmResult& performStateMachine(); const FsmResult& stateMachine();
void setMsgQueue(MessageQueueIF& queue); void setMsgQueue(MessageQueueIF& queue);
void setEventReporter(EventReportingProxyIF& reporter); void setEventReporter(EventReportingProxyIF& reporter);

View File

@ -63,6 +63,7 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
if (result != OK) { if (result != OK) {
// TODO: Error handling // TODO: Error handling
} }
fsmResult.callStatus = CallStatus::CALL_AGAIN;
return fsmResult; return fsmResult;
} }
if (step == TransactionStep::SENDING_FILE_DATA) { if (step == TransactionStep::SENDING_FILE_DATA) {
@ -72,6 +73,7 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
// TODO: Error handling // TODO: Error handling
} }
if (!noFdPdu) { if (!noFdPdu) {
fsmResult.callStatus = CallStatus::CALL_AGAIN;
return fsmResult; return fsmResult;
} }
} }
@ -85,9 +87,12 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
} }
if (transactionParams.closureRequested) { if (transactionParams.closureRequested) {
step = TransactionStep::WAIT_FOR_FINISH; step = TransactionStep::WAIT_FOR_FINISH;
return fsmResult; fsmResult.callStatus = CallStatus::CALL_AFTER_DELAY;
} } else {
step = TransactionStep::NOTICE_OF_COMPLETION; step = TransactionStep::NOTICE_OF_COMPLETION;
fsmResult.callStatus = CallStatus::CALL_AGAIN;
}
return fsmResult;
} }
if (step == TransactionStep::WAIT_FOR_FINISH) { if (step == TransactionStep::WAIT_FOR_FINISH) {
// TODO: In case this is a request with closure, wait for finish. // TODO: In case this is a request with closure, wait for finish.
@ -101,9 +106,10 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
return fsmResult; return fsmResult;
} }
cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::stateMachine() { const cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::stateMachine() {
fsmResult.packetsSent = 0; fsmResult.packetsSent = 0;
fsmResult.errors = 0; fsmResult.errors = 0;
fsmResult.callStatus = CallStatus::DONE;
if (state == cfdp::CfdpState::IDLE) { if (state == cfdp::CfdpState::IDLE) {
return fsmResult; return fsmResult;
} }
@ -346,6 +352,7 @@ ReturnValue_t cfdp::SourceHandler::noticeOfCompletion() {
ReturnValue_t cfdp::SourceHandler::reset() { ReturnValue_t cfdp::SourceHandler::reset() {
step = TransactionStep::IDLE; step = TransactionStep::IDLE;
state = cfdp::CfdpState::IDLE; state = cfdp::CfdpState::IDLE;
fsmResult.callStatus = CallStatus::DONE;
transactionParams.reset(); transactionParams.reset();
return OK; return OK;
} }

View File

@ -59,7 +59,7 @@ class SourceHandler {
* @return * @return
*/ */
ReturnValue_t transactionStart(PutRequest& putRequest, RemoteEntityCfg& cfg); ReturnValue_t transactionStart(PutRequest& putRequest, RemoteEntityCfg& cfg);
FsmResult& stateMachine(); const FsmResult& stateMachine();
ReturnValue_t initialize(); ReturnValue_t initialize();