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 5 additions and 10 deletions
Showing only changes of commit 6021257a87 - Show all commits

View File

@ -50,19 +50,16 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
} }
if (step == TransactionStep::TRANSACTION_START) { if (step == TransactionStep::TRANSACTION_START) {
sourceParams.user.transactionIndication(transactionParams.id); sourceParams.user.transactionIndication(transactionParams.id);
step = TransactionStep::CRC_PROCEDURE;
}
if (step == TransactionStep::CRC_PROCEDURE) {
result = checksumGeneration(); result = checksumGeneration();
if (result != OK) { if (result != OK) {
// TODO: Some error handling addError(result);
} }
step = TransactionStep::SENDING_METADATA; step = TransactionStep::SENDING_METADATA;
} }
if (step == TransactionStep::SENDING_METADATA) { if (step == TransactionStep::SENDING_METADATA) {
result = prepareAndSendMetadataPdu(); result = prepareAndSendMetadataPdu();
if (result != OK) { if (result != OK) {
// TODO: Error handling addError(result);
} }
fsmResult.callStatus = CallStatus::CALL_AGAIN; fsmResult.callStatus = CallStatus::CALL_AGAIN;
return fsmResult; return fsmResult;
@ -72,13 +69,13 @@ cfdp::SourceHandler::FsmResult& cfdp::SourceHandler::fsmNacked() {
result = prepareAndSendNextFileDataPdu(noFdPdu); result = prepareAndSendNextFileDataPdu(noFdPdu);
if (result == OK and !noFdPdu) { if (result == OK and !noFdPdu) {
fsmResult.callStatus = CallStatus::CALL_AGAIN; fsmResult.callStatus = CallStatus::CALL_AGAIN;
return fsmResult;
} }
return fsmResult;
} }
if (step == TransactionStep::SENDING_EOF) { if (step == TransactionStep::SENDING_EOF) {
result = prepareAndSendEofPdu(); result = prepareAndSendEofPdu();
if (result != OK) { if (result != OK) {
// TODO: Error handling addError(result);
} }
if (sourceParams.cfg.indicCfg.eofSentIndicRequired) { if (sourceParams.cfg.indicCfg.eofSentIndicRequired) {
sourceParams.user.eofSentIndication(transactionParams.id); sourceParams.user.eofSentIndication(transactionParams.id);
@ -139,8 +136,7 @@ ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
params.size = readLen; params.size = readLen;
auto result = sourceParams.user.vfs.readFromFile(params, buf.data(), buf.size()); auto result = sourceParams.user.vfs.readFromFile(params, buf.data(), buf.size());
if (result != OK) { if (result != OK) {
// TODO: I think this is a case for a filestore rejection, but it might sense to print addError(result);
// a warning or trigger an event because this should generally not happen
return FAILED; return FAILED;
} }
crcCalc.add(buf.begin(), buf.begin() + readLen); crcCalc.add(buf.begin(), buf.begin() + readLen);
Review

boop

boop
Review

Will be added when fault declaration works properly

Will be added when fault declaration works properly

View File

@ -30,7 +30,6 @@ class SourceHandler {
enum class TransactionStep : uint8_t { enum class TransactionStep : uint8_t {
IDLE = 0, IDLE = 0,
TRANSACTION_START = 1, TRANSACTION_START = 1,
CRC_PROCEDURE = 2,
SENDING_METADATA = 3, SENDING_METADATA = 3,
SENDING_FILE_DATA = 4, SENDING_FILE_DATA = 4,
SENDING_EOF = 5, SENDING_EOF = 5,