From 82eaf4412f8eecb2a02bc07d95cf84af840754bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 16 May 2023 15:43:31 +0200 Subject: [PATCH] get rid of obsolete serializer --- .../tmtcpacket/pus/tc/TcPacketSerializer.cpp | 42 ------------------ .../tmtcpacket/pus/tc/TcPacketSerializer.h | 43 ------------------- 2 files changed, 85 deletions(-) delete mode 100644 src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp delete mode 100644 src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp deleted file mode 100644 index cc280d2b..00000000 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "TcPacketSerializer.h" - -#include - -TcPacketSerializer::TcPacketSerializer(uint8_t* store, size_t maxSize, PusConfig& cfg) - : TcPacketPus(nullptr), store(store), maxSize(maxSize), cfg(cfg) {} - -ReturnValue_t TcPacketSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize, - Endianness streamEndianness) const { - if (*size + getSerializedSize() > maxSize) { - return BUFFER_TOO_SHORT; - } - std::memcpy(*buffer, store, getSerializedSize()); - *buffer += getSerializedSize(); - *size += getSerializedSize(); - return RETURN_OK; -} - -size_t TcPacketSerializer::getSerializedSize() const { return TC_PACKET_MIN_SIZE + cfg.appDataLen; } - -ReturnValue_t TcPacketSerializer::initialize() { - if (getSerializedSize() > maxSize) { - return SerializeIF::BUFFER_TOO_SHORT; - } - ReturnValue_t result = setData(store, maxSize); - if (result != RETURN_OK) { - return result; - } - initializeTcPacket(cfg.apid, cfg.sequenceCount, cfg.ack, cfg.service, cfg.subservice, - PusConfig::PUS_VERSION, cfg.sourceId); - if (cfg.appData != nullptr and cfg.appDataLen > 0) { - std::memcpy(&tcData->appData, cfg.appData, cfg.appDataLen); - } - setPacketDataLength(calculateFullPacketLength(cfg.appDataLen) - sizeof(CCSDSPrimaryHeader) - 1); - setErrorControl(); - return RETURN_OK; -} - -ReturnValue_t TcPacketSerializer::deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) { - return RETURN_FAILED; -} diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h deleted file mode 100644 index 9abb37b1..00000000 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketSerializer.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_ -#define FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_ - -#include - -#include "TcPacketPus.h" -#include "fsfw/serialize/SerializeIF.h" - -struct PusConfig { - uint16_t apid = 0; - uint8_t service = 0; - uint8_t subservice = 0; - uint16_t sequenceCount = 0; - uint16_t sourceId = 0; - uint8_t* appData = nullptr; - size_t appDataLen = 0; -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - static constexpr pus::PusVersion PUS_VERSION = pus::PusVersion::PUS_C_VERSION; -#else - static constexpr pus::PusVersion PUS_VERSION = pus::PusVersion::PUS_A_VERSION; -#endif - uint8_t ack = TcPacketPus::ACK_ALL; -}; - -class TcPacketSerializer : public TcPacketPus, public SerializeIF, public HasReturnvaluesIF { - public: - TcPacketSerializer(uint8_t* store, size_t maxSize, PusConfig& cfg); - - ReturnValue_t initialize(); - - ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, - Endianness streamEndianness) const override; - size_t getSerializedSize() const override; - ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) override; - - private: - uint8_t* store; - size_t maxSize; - PusConfig& cfg; -}; - -#endif /* FSFW_SRC_FSFW_TMTCPACKET_PUS_TC_TCPACKETPUSINTOBUF_H_ */