add EOF impl
This commit is contained in:
parent
1bfb695b41
commit
6c9c4ee047
@ -158,7 +158,10 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendMetadataPdu() {
|
|||||||
cfdp::StringLv destName(transactionParams.destName.data(), transactionParams.destNameSize);
|
cfdp::StringLv destName(transactionParams.destName.data(), transactionParams.destNameSize);
|
||||||
auto metadataInfo = MetadataInfo(transactionParams.fileSize, sourceName, destName);
|
auto metadataInfo = MetadataInfo(transactionParams.fileSize, sourceName, destName);
|
||||||
auto metadataPdu = MetadataPduCreator(transactionParams.pduConf, metadataInfo);
|
auto metadataPdu = MetadataPduCreator(transactionParams.pduConf, metadataInfo);
|
||||||
sendGenericPdu(metadataPdu);
|
ReturnValue_t result = sendGenericPdu(metadataPdu);
|
||||||
|
if (result != OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
// Advance FSM if everything works
|
// Advance FSM if everything works
|
||||||
step = TransactionStep::SENDING_FILE_DATA;
|
step = TransactionStep::SENDING_FILE_DATA;
|
||||||
return OK;
|
return OK;
|
||||||
@ -190,7 +193,10 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu() {
|
|||||||
}
|
}
|
||||||
auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), readLen);
|
auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), readLen);
|
||||||
auto fileDataPdu = FileDataCreator(transactionParams.pduConf, fileDataInfo);
|
auto fileDataPdu = FileDataCreator(transactionParams.pduConf, fileDataInfo);
|
||||||
sendGenericPdu(fileDataPdu);
|
result = sendGenericPdu(fileDataPdu);
|
||||||
|
if (result != OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
transactionParams.progress += readLen;
|
transactionParams.progress += readLen;
|
||||||
if (transactionParams.progress >= fileSize) {
|
if (transactionParams.progress >= fileSize) {
|
||||||
// Advance FSM after all file data PDUs were sent.
|
// Advance FSM after all file data PDUs were sent.
|
||||||
@ -200,8 +206,13 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t cfdp::SourceHandler::prepareAndSendEofPdu() {
|
ReturnValue_t cfdp::SourceHandler::prepareAndSendEofPdu() {
|
||||||
// TODO: Implement
|
// TODO: Checksum
|
||||||
auto eofInfo = EofInfo();
|
auto eofInfo = EofInfo(ConditionCode::NO_ERROR, 0, transactionParams.fileSize);
|
||||||
|
auto eofPdu = EofPduCreator(transactionParams.pduConf, eofInfo);
|
||||||
|
ReturnValue_t result = sendGenericPdu(eofPdu);
|
||||||
|
if (result != OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
step = TransactionStep::WAIT_FOR_FINISH;
|
step = TransactionStep::WAIT_FOR_FINISH;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user