2021-10-05 13:13:36 +02:00
|
|
|
#ifndef FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_
|
|
|
|
#define FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
2022-07-20 22:21:15 +02:00
|
|
|
#include "fsfw/serialize/SerializeIF.h"
|
|
|
|
|
2022-07-19 18:13:25 +02:00
|
|
|
namespace ecss {
|
2021-10-05 13:13:36 +02:00
|
|
|
|
|
|
|
//! Version numbers according to ECSS-E-ST-70-41C p.439
|
2022-07-19 18:13:25 +02:00
|
|
|
enum PusVersion : uint8_t { PUS_A = 1, PUS_C = 2 };
|
2021-10-05 13:13:36 +02:00
|
|
|
|
2022-07-20 22:21:15 +02:00
|
|
|
struct RawData {
|
|
|
|
const uint8_t* data;
|
|
|
|
size_t len;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DataTypes { RAW, SERIALIZABLE };
|
|
|
|
|
|
|
|
union DataUnion {
|
|
|
|
RawData raw;
|
|
|
|
SerializeIF* serializable;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DataWrapper {
|
|
|
|
DataTypes type;
|
|
|
|
DataUnion dataUnion;
|
|
|
|
|
|
|
|
[[nodiscard]] size_t getLength() const {
|
|
|
|
if (type == DataTypes::RAW) {
|
|
|
|
return dataUnion.raw.len;
|
|
|
|
} else if (type == DataTypes::SERIALIZABLE and dataUnion.serializable != nullptr) {
|
|
|
|
return dataUnion.serializable->getSerializedSize();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-07-19 18:13:25 +02:00
|
|
|
} // namespace ecss
|
2021-10-05 13:13:36 +02:00
|
|
|
|
|
|
|
#endif /* FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_ */
|