start verifying metadata PDU

This commit is contained in:
Robin Müller 2023-08-03 13:57:55 +02:00
parent 3167988951
commit c075f27e20
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
3 changed files with 16 additions and 5 deletions

View File

@ -284,7 +284,7 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
uint8_t* dataPtr;
store_address_t storeId;
ReturnValue_t result =
fsfwParams.tcStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
fsfwParams.tmStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
if (result != OK) {
// TODO: Better error handling?
return result;
@ -294,8 +294,8 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
if (result != OK) {
return result;
}
TmTcMessage tcMsg(storeId);
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tcMsg);
TmTcMessage tmMsg(storeId);
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tmMsg);
}
ReturnValue_t cfdp::SourceHandler::noticeOfCompletion() {

View File

@ -11,6 +11,7 @@
class MetadataGenericInfo {
public:
MetadataGenericInfo() = default;
explicit MetadataGenericInfo(cfdp::Fss fileSize);
MetadataGenericInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::Fss fileSize);

View File

@ -8,6 +8,7 @@
#include "fsfw/cfdp/pdu/EofPduCreator.h"
#include "fsfw/cfdp/pdu/FileDataCreator.h"
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/util/SeqCountProvider.h"
#include "mocks/AcceptsTmMock.h"
@ -66,9 +67,18 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
CHECK(fsmResult.packetsSent == 1);
CHECK(mqMock.numberOfSentMessages() == 1);
CommandMessage msg;
CHECK(mqMock.getNextSentMessage(destQueueId, msg) == OK);
REQUIRE(mqMock.getNextSentMessage(destQueueId, msg) == OK);
store_address_t storeId = CfdpMessage::getStoreId(&msg);
auto accessor = tmStore.getData(storeId);
// CHECK(fsmResult.)
REQUIRE(accessor.first == OK);
const uint8_t* pduPtr = accessor.second.data();
MetadataGenericInfo metadataInfo;
MetadataPduReader metadataReader(pduPtr, accessor.second.size(), metadataInfo, nullptr, 0);
size_t srcFileSize = 0;
REQUIRE(metadataReader.parseData() == OK);
const char* srcNameRead = metadataReader.getSourceFileName().getString(srcFileSize);
REQUIRE(srcNameRead != nullptr);
std::string srcNameReadStr(srcNameRead, srcFileSize);
CHECK(std::string(srcFileName.path) == srcNameReadStr);
}
}