2022-09-14 19:29:43 +02:00
|
|
|
#include "SourceHandler.h"
|
2023-06-30 11:36:19 +02:00
|
|
|
|
2023-06-30 11:59:22 +02:00
|
|
|
SourceHandler::SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams) {}
|
2023-07-14 15:56:38 +02:00
|
|
|
|
|
|
|
void SourceHandler::fsmNacked() {
|
|
|
|
if (step == TransactionStep::IDLE) {
|
|
|
|
step = TransactionStep::TRANSACTION_START;
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::TRANSACTION_START) {
|
|
|
|
// TODO: Use put request information to start the transaction
|
|
|
|
step = TransactionStep::CRC_PROCEDURE;
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::CRC_PROCEDURE) {
|
|
|
|
// TODO: Perform CRC procedure: Generate the CRC32 from the file.
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::SENDING_METADATA) {
|
|
|
|
// TODO: Prepare and send metadata PDU
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::SENDING_FILE_DATA) {
|
|
|
|
// TODO: Prepare and send file data PDUs
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::SENDING_EOF) {
|
|
|
|
// TODO: Send EOF PDU
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::WAIT_FOR_FINISH) {
|
|
|
|
// TODO: In case this is a request with closure, wait for finish.
|
|
|
|
}
|
|
|
|
if (step == TransactionStep::NOTICE_OF_COMPLETION) {
|
|
|
|
// TODO: Notice of completion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SourceHandler::stateMachine() {
|
|
|
|
if (state == cfdp::CfdpState::IDLE) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (state == cfdp::CfdpState::BUSY_CLASS_1_NACKED) {
|
|
|
|
return fsmNacked();
|
|
|
|
}
|
|
|
|
}
|