implemented fle data PDUs
This commit is contained in:
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -14,7 +14,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
||||
size_t sz = 0;
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
EntityIdTlv faultLoc(destId);
|
||||
FileSize fileSize(12);
|
||||
Fss fileSize(12);
|
||||
// We can already set the fault location, it will be ignored
|
||||
EofInfo eofInfo(cfdp::ConditionCode::NO_ERROR, 5, fileSize, &faultLoc);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
|
@ -22,7 +22,7 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") {
|
||||
for (uint8_t idx = 0; idx < 10; idx++) {
|
||||
fileBuffer[idx] = idx;
|
||||
}
|
||||
FileSize offset(50);
|
||||
Fss offset(50);
|
||||
FileDataInfo info(offset, fileBuffer.data(), 10);
|
||||
|
||||
SECTION("Serialization") {
|
||||
@ -107,7 +107,7 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") {
|
||||
serializer.serialize(&buffer, &sz, fileDataBuffer.size(), SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(result == returnvalue::OK);
|
||||
|
||||
FileSize emptyOffset;
|
||||
Fss emptyOffset;
|
||||
FileDataInfo emptyInfo(emptyOffset);
|
||||
FileDataReader deserializer(fileDataBuffer.data(), fileDataBuffer.size(), emptyInfo);
|
||||
result = deserializer.parseData();
|
||||
|
@ -16,7 +16,7 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||
|
||||
FileSize progress(0x50);
|
||||
Fss progress(0x50);
|
||||
|
||||
SECTION("Serialize") {
|
||||
KeepAlivePduCreator serializer(pduConf, progress);
|
||||
|
@ -22,7 +22,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
||||
std::string firstFileName = "hello.txt";
|
||||
cfdp::StringLv sourceFileName(firstFileName);
|
||||
cfdp::StringLv destFileName;
|
||||
FileSize fileSize(35);
|
||||
Fss fileSize(35);
|
||||
MetadataInfo info(false, ChecksumType::MODULAR, fileSize, sourceFileName, destFileName);
|
||||
|
||||
FilestoreResponseTlv response(FilestoreActionCode::CREATE_DIRECTORY, FSR_CREATE_NOT_ALLOWED,
|
||||
|
@ -17,8 +17,8 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionMode::ACKNOWLEDGED, seqNum);
|
||||
|
||||
FileSize startOfScope(50);
|
||||
FileSize endOfScope(1050);
|
||||
Fss startOfScope(50);
|
||||
Fss endOfScope(1050);
|
||||
NakInfo info(startOfScope, endOfScope);
|
||||
SECTION("Serializer") {
|
||||
NakPduCreator serializer(pduConf, info);
|
||||
@ -40,8 +40,8 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
||||
REQUIRE(result == returnvalue::OK);
|
||||
REQUIRE(scope == 1050);
|
||||
|
||||
NakInfo::SegmentRequest segReq0(cfdp::FileSize(2020), cfdp::FileSize(2520));
|
||||
NakInfo::SegmentRequest segReq1(cfdp::FileSize(2932), cfdp::FileSize(3021));
|
||||
NakInfo::SegmentRequest segReq0(cfdp::Fss(2020), cfdp::Fss(2520));
|
||||
NakInfo::SegmentRequest segReq1(cfdp::Fss(2932), cfdp::Fss(3021));
|
||||
// Now add 2 segment requests to NAK info and serialize them as well
|
||||
std::array<NakInfo::SegmentRequest, 2> segReqs = {segReq0, segReq1};
|
||||
size_t segReqsLen = segReqs.size();
|
||||
@ -100,8 +100,8 @@ TEST_CASE("NAK PDU", "[cfdp][pdu]") {
|
||||
REQUIRE(info.getStartOfScope().getSize() == 50);
|
||||
REQUIRE(info.getEndOfScope().getSize() == 1050);
|
||||
|
||||
NakInfo::SegmentRequest segReq0(cfdp::FileSize(2020), cfdp::FileSize(2520));
|
||||
NakInfo::SegmentRequest segReq1(cfdp::FileSize(2932), cfdp::FileSize(3021));
|
||||
NakInfo::SegmentRequest segReq0(cfdp::Fss(2020), cfdp::Fss(2520));
|
||||
NakInfo::SegmentRequest segReq1(cfdp::Fss(2932), cfdp::Fss(3021));
|
||||
// Now add 2 segment requests to NAK info and serialize them as well
|
||||
std::array<NakInfo::SegmentRequest, 2> segReqs = {segReq0, segReq1};
|
||||
size_t segReqsLen = segReqs.size();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include "fsfw/cfdp/FileSize.h"
|
||||
#include "fsfw/cfdp/Fss.h"
|
||||
#include "fsfw/cfdp/pdu/FileDirectiveCreator.h"
|
||||
#include "fsfw/cfdp/pdu/FileDirectiveReader.h"
|
||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||
@ -79,7 +79,7 @@ TEST_CASE("CFDP Base", "[cfdp]") {
|
||||
std::array<uint8_t, 8> fssBuf = {};
|
||||
uint8_t* buffer = fssBuf.data();
|
||||
size_t size = 0;
|
||||
cfdp::FileSize fss;
|
||||
cfdp::Fss fss;
|
||||
REQUIRE(fss.getSize() == 0);
|
||||
fss.setFileSize(0x20, false);
|
||||
result = fss.serialize(&buffer, &size, fssBuf.size(), SerializeIF::Endianness::MACHINE);
|
||||
|
Reference in New Issue
Block a user