PusParser integration

This commit is contained in:
Robin Müller 2021-09-27 16:15:51 +02:00
parent 62a6e5da0b
commit 68fe94d594
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 21 additions and 13 deletions

View File

@ -80,6 +80,7 @@ enum: uint8_t {
FIXED_SLOT_TASK_IF, //FTIF FIXED_SLOT_TASK_IF, //FTIF
MGM_LIS3MDL, //MGMLIS3 MGM_LIS3MDL, //MGMLIS3
MGM_RM3100, //MGMRM3100 MGM_RM3100, //MGMRM3100
PUS_PARSER, //PUSP
FW_CLASS_ID_COUNT // [EXPORT] : [END] FW_CLASS_ID_COUNT // [EXPORT] : [END]
}; };

View File

@ -1,8 +1,8 @@
#include "PusParser.h" #include "PusParser.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
PusParser::PusParser(uint16_t maxExpectedPusPackets, PusParser::PusParser(uint16_t maxExpectedPusPackets, bool storeSplitPackets):
bool storeSplitPackets): indexSizePairFIFO(maxExpectedPusPackets) { indexSizePairFIFO(maxExpectedPusPackets) {
} }
ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame, ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
@ -39,17 +39,19 @@ ReturnValue_t PusParser::parsePusPackets(const uint8_t *frame,
indexSizePairFIFO.insert(indexSizePair(0, frameSize)); indexSizePairFIFO.insert(indexSizePair(0, frameSize));
} }
else { else {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "TcSerialPollingTask::readNextPacket: Next packet " sif::warning << "TcSerialPollingTask::readNextPacket: Next packet "
<< "larger than remaining frame," << std::endl; << "larger than remaining frame," << std::endl;
sif::debug << "Throwing away packet. Detected packet size: " sif::warning << "Throwing away packet. Detected packet size: "
<< packetSize << std::endl; << packetSize << std::endl;
#else #else
sif::printDebug("TcSerialPollingTask::readNextPacket: Next packet " sif::printWarning("TcSerialPollingTask::readNextPacket: Next packet "
"larger than remaining frame.\n"); "larger than remaining frame.\n");
sif::printDebug("Throwing away packet. Detected packet size: %lu", sif::printWarning("Throwing away packet. Detected packet size: %lu",
static_cast<unsigned long>(packetSize)); static_cast<unsigned long>(packetSize));
#endif #endif
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
} }
return SPLIT_PACKET; return SPLIT_PACKET;
} }
@ -108,16 +110,18 @@ ReturnValue_t PusParser::readNextPacket(const uint8_t *frame,
indexSizePairFIFO.insert(indexSizePair(currentIndex, remainingSize)); indexSizePairFIFO.insert(indexSizePair(currentIndex, remainingSize));
} }
else { else {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "TcSerialPollingTask::readNextPacket: Next packet " sif::warning << "TcSerialPollingTask::readNextPacket: Next packet "
<< "larger than remaining frame." << std::endl; << "larger than remaining frame." << std::endl;
sif::debug << "Throwing away packet. Detected packet size: " sif::warning << "Throwing away packet. Detected packet size: "
<< nextPacketSize << std::endl; << nextPacketSize << std::endl;
#else #else
sif::printDebug("TcSerialPollingTask::readNextPacket: Next packet " sif::printWarning("TcSerialPollingTask::readNextPacket: Next packet "
"larger than remaining frame.\n"); "larger than remaining frame.\n");
sif::printDebug("Throwing away packet. Detected packet size: %lu\n", sif::printWarning("Throwing away packet. Detected packet size: %lu\n",
static_cast<unsigned long>(nextPacketSize)); static_cast<unsigned long>(nextPacketSize));
#endif
#endif #endif
} }
return SPLIT_PACKET; return SPLIT_PACKET;

View File

@ -1,7 +1,9 @@
#ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ #ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
#define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ #define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
#include <fsfw/container/DynamicFIFO.h> #include "fsfw/container/DynamicFIFO.h"
#include "fsfw/returnvalues/FwClassIds.h"
#include <utility> #include <utility>
#include <cstdint> #include <cstdint>
@ -66,7 +68,8 @@ public:
indexSizePair getNextFifoPair(); indexSizePair getNextFifoPair();
private: private:
/** A FIFO is used to store information about multiple PUS packets /**
* A FIFO is used to store information about multiple PUS packets
* inside the receive buffer. The maximum number of entries is defined * inside the receive buffer. The maximum number of entries is defined
* by the first constructor argument. * by the first constructor argument.
*/ */