pus parser fixes

This commit is contained in:
Robin Müller 2020-07-06 20:17:05 +02:00
parent 8ba75fc3c2
commit fd1e612ea5

View File

@ -18,7 +18,6 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
return HasReturnvaluesIF::RETURN_FAILED;
}
size_t lengthField = frame[4] << 8 | frame[5];
if(lengthField == 0) {
@ -26,7 +25,6 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
}
size_t packetSize = lengthField + 7;
if(lengthField > 0) {
// Size of a pus packet is the value in the packet length field plus 7.
if(packetSize > frameSize)
{
@ -47,10 +45,11 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
{
indexSizePairFIFO.insert(indexSizePair(0, packetSize));
if(packetSize == frameSize) {
sif::info << "test2" << std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
}
}
// packet size is smaller than frame size, parse for more packets.
return readMultiplePackets(frame, frameSize, packetSize);
@ -59,6 +58,7 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
ReturnValue_t PusParser::readMultiplePackets(const uint8_t *frame,
size_t frameSize, size_t startIndex) {
while (startIndex < frameSize) {
sif::info << "test" << std::endl;
ReturnValue_t result = readNextPacket(frame, frameSize, startIndex);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;