Filesystem and CFDP updates
This commit is contained in:
36
unittests/cfdp/PduSenderMock.h
Normal file
36
unittests/cfdp/PduSenderMock.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
#include "fsfw/cfdp/handler/PduSenderIF.h"
|
||||
|
||||
struct SentPdu {
|
||||
cfdp::PduType pduType;
|
||||
std::optional<cfdp::FileDirective> fileDirective;
|
||||
std::vector<uint8_t> rawPdu;
|
||||
};
|
||||
|
||||
class PduSenderMock : public cfdp::PduSenderIF {
|
||||
public:
|
||||
ReturnValue_t sendPdu(cfdp::PduType pduType, std::optional<cfdp::FileDirective> fileDirective,
|
||||
|
||||
const uint8_t* pdu, size_t pduSize) override {
|
||||
SentPdu sentPdu;
|
||||
sentPdu.pduType = pduType;
|
||||
sentPdu.fileDirective = fileDirective;
|
||||
sentPdu.rawPdu = std::vector(pdu, pdu + pduSize);
|
||||
sentPdus.push_back(sentPdu);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
std::optional<SentPdu> getNextSentPacket() {
|
||||
if (sentPdus.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
SentPdu nextPdu = sentPdus.front();
|
||||
sentPdus.pop_front();
|
||||
return nextPdu;
|
||||
}
|
||||
|
||||
std::deque<SentPdu> sentPdus;
|
||||
};
|
Reference in New Issue
Block a user