From 68fe94d5944a5462cd0ba05d96ded321c1f52e20 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 27 Sep 2021 16:15:51 +0200 Subject: [PATCH] PusParser integration --- src/fsfw/returnvalues/FwClassIds.h | 1 + src/fsfw/tmtcservices/PusParser.cpp | 26 +++++++++++++++----------- src/fsfw/tmtcservices/PusParser.h | 7 +++++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h index 4a3a578a..8422baa5 100644 --- a/src/fsfw/returnvalues/FwClassIds.h +++ b/src/fsfw/returnvalues/FwClassIds.h @@ -80,6 +80,7 @@ enum: uint8_t { FIXED_SLOT_TASK_IF, //FTIF MGM_LIS3MDL, //MGMLIS3 MGM_RM3100, //MGMRM3100 + PUS_PARSER, //PUSP FW_CLASS_ID_COUNT // [EXPORT] : [END] }; diff --git a/src/fsfw/tmtcservices/PusParser.cpp b/src/fsfw/tmtcservices/PusParser.cpp index 42044da3..5b63710c 100644 --- a/src/fsfw/tmtcservices/PusParser.cpp +++ b/src/fsfw/tmtcservices/PusParser.cpp @@ -1,8 +1,8 @@ #include "PusParser.h" #include -PusParser::PusParser(uint16_t maxExpectedPusPackets, - bool storeSplitPackets): indexSizePairFIFO(maxExpectedPusPackets) { +PusParser::PusParser(uint16_t maxExpectedPusPackets, bool storeSplitPackets): + indexSizePairFIFO(maxExpectedPusPackets) { } 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)); } else { +#if FSFW_VERBOSE_LEVEL >= 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; - sif::debug << "Throwing away packet. Detected packet size: " + sif::warning << "Throwing away packet. Detected packet size: " << packetSize << std::endl; #else - sif::printDebug("TcSerialPollingTask::readNextPacket: Next packet " + sif::printWarning("TcSerialPollingTask::readNextPacket: Next packet " "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(packetSize)); -#endif +#endif +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ } return SPLIT_PACKET; } @@ -108,16 +110,18 @@ ReturnValue_t PusParser::readNextPacket(const uint8_t *frame, indexSizePairFIFO.insert(indexSizePair(currentIndex, remainingSize)); } else { +#if FSFW_VERBOSE_LEVEL >= 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; - sif::debug << "Throwing away packet. Detected packet size: " + sif::warning << "Throwing away packet. Detected packet size: " << nextPacketSize << std::endl; #else - sif::printDebug("TcSerialPollingTask::readNextPacket: Next packet " + sif::printWarning("TcSerialPollingTask::readNextPacket: Next packet " "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(nextPacketSize)); +#endif #endif } return SPLIT_PACKET; diff --git a/src/fsfw/tmtcservices/PusParser.h b/src/fsfw/tmtcservices/PusParser.h index 0efbdcc5..851f1a5d 100644 --- a/src/fsfw/tmtcservices/PusParser.h +++ b/src/fsfw/tmtcservices/PusParser.h @@ -1,7 +1,9 @@ #ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ #define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ -#include +#include "fsfw/container/DynamicFIFO.h" +#include "fsfw/returnvalues/FwClassIds.h" + #include #include @@ -66,7 +68,8 @@ public: indexSizePair getNextFifoPair(); 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 * by the first constructor argument. */