CFDP SOURCE handler #157

Merged
muellerr merged 107 commits from cfdp-source-handler into develop 2023-10-19 10:59:55 +02:00
2 changed files with 41 additions and 4 deletions
Showing only changes of commit 4dc6398fd5 - Show all commits

View File

@ -14,6 +14,7 @@ cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwPa
fsfwParams(fsfwParams) {}
void cfdp::SourceHandler::fsmNacked() {
ReturnValue_t result;
if (step == TransactionStep::IDLE) {
step = TransactionStep::TRANSACTION_START;
}
@ -22,26 +23,41 @@ void cfdp::SourceHandler::fsmNacked() {
step = TransactionStep::CRC_PROCEDURE;
}
if (step == TransactionStep::CRC_PROCEDURE) {
ReturnValue_t result = checksumGeneration();
result = checksumGeneration();
if (result != OK) {
// TODO: Some error handling
}
step = TransactionStep::SENDING_METADATA;
}
if (step == TransactionStep::SENDING_METADATA) {
// TODO: Prepare and send metadata PDU
result = prepareAndSendMetadataPdu();
if (result != OK) {
// TODO: Error handling
}
}
if (step == TransactionStep::SENDING_FILE_DATA) {
// TODO: Prepare and send file data PDUs
result = prepareNextFileDataPdu();
if (result != OK) {
// TODO: Error handling
}
}
if (step == TransactionStep::SENDING_EOF) {
// TODO: Send EOF PDU
result = prepareEofPdu();
if (result != OK) {
// TODO: Error handling
}
}
if (step == TransactionStep::WAIT_FOR_FINISH) {
// TODO: In case this is a request with closure, wait for finish.
// Done, issue notice of completion
step = TransactionStep::NOTICE_OF_COMPLETION;
}
if (step == TransactionStep::NOTICE_OF_COMPLETION) {
// TODO: Notice of completion
// We are done, go back to idle state.
// TODO: Possible reset state?

boop

boop
step = TransactionStep::IDLE;
state = CfdpState::IDLE;
}
}
void cfdp::SourceHandler::stateMachine() {
@ -110,3 +126,21 @@ ReturnValue_t cfdp::SourceHandler::putRequest(PutRequestFull& putRequest, Remote
currentRemoteCfg = cfg;
return OK;
}
ReturnValue_t cfdp::SourceHandler::prepareAndSendMetadataPdu() {
// TODO: Implement
// Advance FSM if everythings works
step = TransactionStep::SENDING_FILE_DATA;
return OK;
}
ReturnValue_t cfdp::SourceHandler::prepareNextFileDataPdu() {
// TODO: Implement
// Advance FSM after all file data PDUs were sent
step = TransactionStep::SENDING_EOF;
return OK;
}
ReturnValue_t cfdp::SourceHandler::prepareEofPdu() {
Review

boop

boop
Review

Will be added when fault declaration works properly

Will be added when fault declaration works properly
// TODO: Implement
step = TransactionStep::WAIT_FOR_FINISH;
return OK;
}

View File

@ -67,6 +67,9 @@ class SourceHandler {
void fsmNacked();
ReturnValue_t checksumGeneration();
ReturnValue_t prepareAndSendMetadataPdu();
ReturnValue_t prepareNextFileDataPdu();
ReturnValue_t prepareEofPdu();
};
} // namespace cfdp