CFDP SOURCE handler #157

Merged
muellerr merged 107 commits from cfdp-source-handler into develop 2023-10-19 10:59:55 +02:00
3 changed files with 16 additions and 5 deletions
Showing only changes of commit c075f27e20 - Show all commits

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);
}
}