CFDP SOURCE handler #157
@ -353,8 +353,8 @@ cfdp::CfdpState cfdp::SourceHandler::getState() const { return state; }
|
|||||||
cfdp::SourceHandler::TransactionStep cfdp::SourceHandler::getStep() const { return step; }
|
cfdp::SourceHandler::TransactionStep cfdp::SourceHandler::getStep() const { return step; }
|
||||||
|
|
||||||
void cfdp::SourceHandler::addError(ReturnValue_t error) {
|
void cfdp::SourceHandler::addError(ReturnValue_t error) {
|
||||||
if (errorIndex < fsmResult.errorCodes.size()) {
|
if (fsmResult.errors < fsmResult.errorCodes.size()) {
|
||||||
fsmResult.errorCodes[errorIndex] = error;
|
fsmResult.errorCodes[fsmResult.errors] = error;
|
||||||
errorIndex++;
|
fsmResult.errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,6 @@ class SourceHandler {
|
|||||||
std::array<uint8_t, 4096> fileBuf{};
|
std::array<uint8_t, 4096> fileBuf{};
|
||||||
SourceHandlerParams sourceParams;
|
SourceHandlerParams sourceParams;
|
||||||
cfdp::FsfwParams fsfwParams;
|
cfdp::FsfwParams fsfwParams;
|
||||||
uint8_t errorIndex = 0;
|
|
||||||
FsmResult fsmResult;
|
FsmResult fsmResult;
|
||||||
|
|
||||||
FsmResult& fsmNacked();
|
FsmResult& fsmNacked();
|
||||||
|
@ -66,6 +66,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
|
|
||||||
auto onePduSentCheck = [&](SourceHandler::FsmResult& fsmResult, TmTcMessage& tmtcMessage,
|
auto onePduSentCheck = [&](SourceHandler::FsmResult& fsmResult, TmTcMessage& tmtcMessage,
|
||||||
const uint8_t** pduPtr) {
|
const uint8_t** pduPtr) {
|
||||||
|
CHECK(fsmResult.errors == 0);
|
||||||
CHECK(fsmResult.packetsSent == 1);
|
CHECK(fsmResult.packetsSent == 1);
|
||||||
CHECK(mqMock.numberOfSentMessages() == 1);
|
CHECK(mqMock.numberOfSentMessages() == 1);
|
||||||
REQUIRE(mqMock.getNextSentMessage(destQueueId, tmtcMessage) == OK);
|
REQUIRE(mqMock.getNextSentMessage(destQueueId, tmtcMessage) == OK);
|
||||||
@ -75,6 +76,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
return std::move(accessor);
|
return std::move(accessor);
|
||||||
};
|
};
|
||||||
auto genericMetadataCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize) {
|
auto genericMetadataCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize) {
|
||||||
|
CHECK(fsmResult.errors == 0);
|
||||||
TmTcMessage tmtcMessage;
|
TmTcMessage tmtcMessage;
|
||||||
const uint8_t* pduPtr;
|
const uint8_t* pduPtr;
|
||||||
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);
|
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);
|
||||||
@ -97,6 +99,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
};
|
};
|
||||||
auto genericEofCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize,
|
auto genericEofCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize,
|
||||||
uint32_t expectedChecksum) {
|
uint32_t expectedChecksum) {
|
||||||
|
CHECK(fsmResult.errors == 0);
|
||||||
TmTcMessage tmtcMessage;
|
TmTcMessage tmtcMessage;
|
||||||
const uint8_t* pduPtr;
|
const uint8_t* pduPtr;
|
||||||
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);
|
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);
|
||||||
|
Loading…
Reference in New Issue
Block a user