fsfw/src/fsfw/tmtcpacket/pus/tc/PusTcCreator.h

50 lines
1.9 KiB
C
Raw Normal View History

2022-07-18 10:29:39 +02:00
#ifndef FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
#define FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
2022-07-20 11:43:16 +02:00
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
2022-07-20 22:21:15 +02:00
#include "fsfw/tmtcpacket/pus/CreatorDataIF.h"
2022-07-21 11:34:11 +02:00
#include "fsfw/tmtcpacket/pus/defs.h"
2022-07-19 18:13:25 +02:00
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
2022-07-18 10:29:39 +02:00
2022-07-19 18:13:25 +02:00
struct PusTcParams {
PusTcParams(uint8_t service_, uint8_t subservice_) : service(service_), subservice(subservice_) {}
uint8_t service;
uint8_t subservice;
uint8_t ackFlags = ecss::ACK_ALL;
uint16_t sourceId = 0;
2022-07-20 22:21:15 +02:00
ecss::DataWrapper dataWrapper{};
2022-07-19 18:13:25 +02:00
uint8_t pusVersion = ecss::PusVersion::PUS_C;
};
2022-07-20 22:21:15 +02:00
class PusTcCreator : public PusTcIF, public SerializeIF, public CreatorDataIF {
2022-07-18 10:29:39 +02:00
public:
2022-07-19 18:13:25 +02:00
PusTcCreator(SpacePacketParams spParams, PusTcParams pusParams);
void updateSpLengthField();
2022-07-21 11:34:11 +02:00
PusTcParams &getPusParams();
SpacePacketParams &getSpParams();
2022-07-19 18:13:25 +02:00
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override;
2022-07-20 11:43:16 +02:00
[[nodiscard]] uint16_t getPacketIdRaw() const override;
[[nodiscard]] uint16_t getPacketSeqCtrlRaw() const override;
2022-07-19 18:13:25 +02:00
[[nodiscard]] uint16_t getPacketDataLen() const override;
[[nodiscard]] uint8_t getPusVersion() const override;
[[nodiscard]] uint8_t getAcknowledgeFlags() const override;
[[nodiscard]] uint8_t getService() const override;
[[nodiscard]] uint8_t getSubService() const override;
[[nodiscard]] uint16_t getSourceId() const override;
2022-07-20 22:21:15 +02:00
ecss::DataWrapper &getDataWrapper() override;
2022-07-18 10:29:39 +02:00
2022-07-18 10:42:56 +02:00
private:
2022-07-19 18:13:25 +02:00
SpacePacketCreator spCreator;
PusTcParams pusParams;
2022-07-18 10:29:39 +02:00
};
#endif // FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H