implemented fle data PDUs

This commit is contained in:
2023-07-19 13:44:52 +02:00
parent 896b7a7358
commit 1561b9a247
28 changed files with 135 additions and 104 deletions

View File

@ -50,7 +50,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
auto destHandler = DestHandler(dp, fp);
CHECK(destHandler.initialize() == OK);
auto metadataPreparation = [&](FileSize cfdpFileSize, ChecksumType checksumType) {
auto metadataPreparation = [&](Fss cfdpFileSize, ChecksumType checksumType) {
std::string srcNameString = "hello.txt";
std::string destNameString = "hello-cpy.txt";
StringLv srcName(srcNameString);
@ -91,7 +91,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
REQUIRE(res.step == DestHandler::TransactionStep::RECEIVING_FILE_DATA_PDUS);
};
auto eofPreparation = [&](FileSize cfdpFileSize, uint32_t crc) {
auto eofPreparation = [&](Fss cfdpFileSize, uint32_t crc) {
EofInfo eofInfo(cfdp::ConditionCode::NO_ERROR, crc, std::move(cfdpFileSize));
EofPduCreator eofCreator(conf, eofInfo);
REQUIRE(tcStore.getFreeElement(&storeId, eofCreator.getSerializedSize(), &buf) == OK);
@ -145,7 +145,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
SECTION("Empty File Transfer") {
const DestHandler::FsmResult& res = destHandler.performStateMachine();
CHECK(res.result == OK);
FileSize cfdpFileSize(0);
Fss cfdpFileSize(0);
metadataPreparation(cfdpFileSize, ChecksumType::NULL_CHECKSUM);
destHandler.performStateMachine();
metadataCheck(res, "hello.txt", "hello-cpy.txt", 0);
@ -165,14 +165,14 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
etl::crc32 crcCalc;
crcCalc.add(fileData.begin(), fileData.end());
uint32_t crc32 = crcCalc.value();
FileSize cfdpFileSize(fileData.size());
Fss cfdpFileSize(fileData.size());
metadataPreparation(cfdpFileSize, ChecksumType::CRC_32);
destHandler.performStateMachine();
metadataCheck(res, "hello.txt", "hello-cpy.txt", fileData.size());
destHandler.performStateMachine();
REQUIRE(res.callStatus == CallStatus::CALL_AFTER_DELAY);
auto transactionId = destHandler.getTransactionId();
FileSize offset(0);
Fss offset(0);
FileDataInfo fdPduInfo(offset, reinterpret_cast<const uint8_t*>(fileData.data()),
fileData.size());
FileDataCreator fdPduCreator(conf, fdPduInfo);
@ -201,7 +201,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
etl::crc32 crcCalc;
crcCalc.add(largerFileData.begin(), largerFileData.end());
uint32_t crc32 = crcCalc.value();
FileSize cfdpFileSize(largerFileData.size());
Fss cfdpFileSize(largerFileData.size());
metadataPreparation(cfdpFileSize, ChecksumType::CRC_32);
destHandler.performStateMachine();
metadataCheck(res, "hello.txt", "hello-cpy.txt", largerFileData.size());
@ -211,7 +211,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
std::vector<store_address_t> idsToCheck;
{
FileSize offset(0);
Fss offset(0);
FileDataInfo fdPduInfo(offset, reinterpret_cast<const uint8_t*>(largerFileData.data()),
largerFileData.size() / 2);
FileDataCreator fdPduCreator(conf, fdPduInfo);
@ -223,7 +223,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
}
{
FileSize offset(512);
Fss offset(512);
FileDataInfo fdPduInfo(offset, reinterpret_cast<const uint8_t*>(largerFileData.data() + 512),
largerFileData.size() / 2);
FileDataCreator fdPduCreator(conf, fdPduInfo);

View File

@ -21,7 +21,7 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
auto tcAcceptor = AcceptsTcMock("CFDP Receiver", 0, receiverQueueId);
// Set up Metadata PDU for generate test data.
cfdp::FileSize fileSize(12);
cfdp::Fss fileSize(12);
const cfdp::EntityId& sourceId(groundEntityId);
const cfdp::EntityId& destId(obswEntityId);
cfdp::TransactionSeqNum seqNum(UnsignedByteField<uint16_t>(12));