40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#include "SourceHandler.h"
|
|
|
|
SourceHandler::SourceHandler(SourceHandlerParams params, FsfwSourceParams fsfwParams) {}
|
|
|
|
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();
|
|
}
|
|
}
|