CFDP SOURCE handler #157
@ -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?
|
||||
|
||||
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() {
|
||||
meggert
commented
boop boop
muellerr
commented
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;
|
||||
}
|
||||
|
@ -67,6 +67,9 @@ class SourceHandler {
|
||||
|
||||
void fsmNacked();
|
||||
ReturnValue_t checksumGeneration();
|
||||
ReturnValue_t prepareAndSendMetadataPdu();
|
||||
ReturnValue_t prepareNextFileDataPdu();
|
||||
ReturnValue_t prepareEofPdu();
|
||||
};
|
||||
|
||||
} // namespace cfdp
|
||||
|
Loading…
Reference in New Issue
Block a user
boop