CFDP SOURCE handler #157
@ -284,7 +284,7 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
|
|||||||
uint8_t* dataPtr;
|
uint8_t* dataPtr;
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
fsfwParams.tcStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
|
fsfwParams.tmStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
|
||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
// TODO: Better error handling?
|
// TODO: Better error handling?
|
||||||
return result;
|
return result;
|
||||||
@ -294,8 +294,8 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
|
|||||||
if (result != OK) {
|
if (result != OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
TmTcMessage tcMsg(storeId);
|
TmTcMessage tmMsg(storeId);
|
||||||
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tcMsg);
|
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tmMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t cfdp::SourceHandler::noticeOfCompletion() {
|
ReturnValue_t cfdp::SourceHandler::noticeOfCompletion() {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
class MetadataGenericInfo {
|
class MetadataGenericInfo {
|
||||||
public:
|
public:
|
||||||
|
MetadataGenericInfo() = default;
|
||||||
explicit MetadataGenericInfo(cfdp::Fss fileSize);
|
explicit MetadataGenericInfo(cfdp::Fss fileSize);
|
||||||
MetadataGenericInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::Fss fileSize);
|
MetadataGenericInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::Fss fileSize);
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
||||||
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
||||||
|
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/util/SeqCountProvider.h"
|
#include "fsfw/util/SeqCountProvider.h"
|
||||||
#include "mocks/AcceptsTmMock.h"
|
#include "mocks/AcceptsTmMock.h"
|
||||||
@ -66,9 +67,18 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
CHECK(fsmResult.packetsSent == 1);
|
CHECK(fsmResult.packetsSent == 1);
|
||||||
CHECK(mqMock.numberOfSentMessages() == 1);
|
CHECK(mqMock.numberOfSentMessages() == 1);
|
||||||
CommandMessage msg;
|
CommandMessage msg;
|
||||||
CHECK(mqMock.getNextSentMessage(destQueueId, msg) == OK);
|
REQUIRE(mqMock.getNextSentMessage(destQueueId, msg) == OK);
|
||||||
store_address_t storeId = CfdpMessage::getStoreId(&msg);
|
store_address_t storeId = CfdpMessage::getStoreId(&msg);
|
||||||
auto accessor = tmStore.getData(storeId);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user