continue source FSM
This commit is contained in:
parent
8fcc4eab60
commit
4dc6398fd5
@ -14,6 +14,7 @@ cfdp::SourceHandler::SourceHandler(SourceHandlerParams params, FsfwParams fsfwPa
|
|||||||
fsfwParams(fsfwParams) {}
|
fsfwParams(fsfwParams) {}
|
||||||
|
|
||||||
void cfdp::SourceHandler::fsmNacked() {
|
void cfdp::SourceHandler::fsmNacked() {
|
||||||
|
ReturnValue_t result;
|
||||||
if (step == TransactionStep::IDLE) {
|
if (step == TransactionStep::IDLE) {
|
||||||
step = TransactionStep::TRANSACTION_START;
|
step = TransactionStep::TRANSACTION_START;
|
||||||
}
|
}
|
||||||
@ -22,26 +23,41 @@ void cfdp::SourceHandler::fsmNacked() {
|
|||||||
step = TransactionStep::CRC_PROCEDURE;
|
step = TransactionStep::CRC_PROCEDURE;
|
||||||
}
|
}
|
||||||
if (step == TransactionStep::CRC_PROCEDURE) {
|
if (step == TransactionStep::CRC_PROCEDURE) {
|
||||||
ReturnValue_t result = checksumGeneration();
|
result = checksumGeneration();
|
||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
// TODO: Some error handling
|
// TODO: Some error handling
|
||||||
}
|
}
|
||||||
step = TransactionStep::SENDING_METADATA;
|
step = TransactionStep::SENDING_METADATA;
|
||||||
}
|
}
|
||||||
if (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) {
|
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) {
|
if (step == TransactionStep::SENDING_EOF) {
|
||||||
// TODO: Send EOF PDU
|
result = prepareEofPdu();
|
||||||
|
if (result != OK) {
|
||||||
|
// TODO: Error handling
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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.
|
||||||
|
// Done, issue notice of completion
|
||||||
|
step = TransactionStep::NOTICE_OF_COMPLETION;
|
||||||
}
|
}
|
||||||
if (step == TransactionStep::NOTICE_OF_COMPLETION) {
|
if (step == TransactionStep::NOTICE_OF_COMPLETION) {
|
||||||
// TODO: 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() {
|
void cfdp::SourceHandler::stateMachine() {
|
||||||
@ -110,3 +126,21 @@ ReturnValue_t cfdp::SourceHandler::putRequest(PutRequestFull& putRequest, Remote
|
|||||||
currentRemoteCfg = cfg;
|
currentRemoteCfg = cfg;
|
||||||
return OK;
|
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() {
|
||||||
|
// TODO: Implement
|
||||||
|
step = TransactionStep::WAIT_FOR_FINISH;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
@ -67,6 +67,9 @@ class SourceHandler {
|
|||||||
|
|
||||||
void fsmNacked();
|
void fsmNacked();
|
||||||
ReturnValue_t checksumGeneration();
|
ReturnValue_t checksumGeneration();
|
||||||
|
ReturnValue_t prepareAndSendMetadataPdu();
|
||||||
|
ReturnValue_t prepareNextFileDataPdu();
|
||||||
|
ReturnValue_t prepareEofPdu();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
Loading…
Reference in New Issue
Block a user