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

70 lines
2.1 KiB
C
Raw Normal View History

2021-06-13 12:34:06 +02:00
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_
#define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_
2022-02-02 10:29:30 +01:00
#include <cstdint>
2021-10-05 13:13:36 +02:00
#include "../definitions.h"
2022-07-18 18:36:41 +02:00
#include "PusTcReader.h"
2022-02-02 10:29:30 +01:00
#include "fsfw/FSFW.h"
#include "fsfw/tmtcpacket/ccsds_header.h"
2021-06-13 12:34:06 +02:00
/**
* This struct defines the data structure of a PUS Telecommand A packet when
* accessed via a pointer.
* @ingroup tmtcpackets
*/
2022-07-18 18:36:41 +02:00
/*
2021-06-13 12:34:06 +02:00
struct TcPacketPointer {
2022-07-18 18:36:41 +02:00
CCSDSPrimaryHeader primary;
PusTcDataFieldHeader dataField;
uint8_t appData;
2021-06-13 12:34:06 +02:00
};
2022-07-18 18:36:41 +02:00
*/
2021-06-13 12:34:06 +02:00
2022-02-02 10:29:30 +01:00
class TcPacketPus : public TcPacketPusBase {
public:
/**
* Initialize a PUS A telecommand packet which already exists. You can also
* create an empty (invalid) object by passing nullptr as the data pointer
* @param setData
*/
TcPacketPus(const uint8_t* setData);
2021-06-13 16:29:13 +02:00
2022-02-02 10:29:30 +01:00
// Base class overrides
uint8_t getSecondaryHeaderFlag() const override;
uint8_t getPusVersionNumber() const override;
uint8_t getAcknowledgeFlags() const override;
uint8_t getService() const override;
uint8_t getSubService() const override;
uint16_t getSourceId() const override;
const uint8_t* getApplicationData() const override;
uint16_t getApplicationDataSize() const override;
uint16_t getErrorControl() const override;
void setErrorControl() override;
size_t calculateFullPacketLength(size_t appDataLen) const override;
2021-06-13 16:29:13 +02:00
2022-02-02 10:29:30 +01:00
protected:
2022-07-18 10:20:26 +02:00
ReturnValue_t setData(uint8_t* dataPtr, size_t maxSize, void* args) override;
2021-06-13 16:29:13 +02:00
2022-02-02 10:29:30 +01:00
/**
* Initializes the Tc Packet header.
* @param apid APID used.
* @param sequenceCount Sequence Count in the primary header.
* @param ack Which acknowledeges are expected from the receiver.
* @param service PUS Service
* @param subservice PUS Subservice
*/
void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, uint8_t service,
uint8_t subservice, pus::PusVersion pusVersion, uint16_t sourceId = 0);
2021-06-13 16:29:13 +02:00
2022-02-02 10:29:30 +01:00
/**
* A pointer to a structure which defines the data structure of
* the packet's data.
*
* To be hardware-safe, all elements are of byte size.
*/
TcPacketPointer* tcData = nullptr;
2021-06-13 12:34:06 +02:00
};
#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ */