fsfw/src/fsfw/timemanager/CdsShortTimeStamper.h

42 lines
1.4 KiB
C
Raw Normal View History

2020-09-16 19:36:15 +02:00
#ifndef FSFW_TIMEMANAGER_TIMESTAMPER_H_
#define FSFW_TIMEMANAGER_TIMESTAMPER_H_
2022-02-02 10:29:30 +01:00
#include "CCSDSTime.h"
2022-07-27 17:33:39 +02:00
#include "TimeReaderIF.h"
2022-09-05 14:44:35 +02:00
#include "TimeWriterIF.h"
2022-07-21 11:34:11 +02:00
#include "fsfw/objectmanager/SystemObject.h"
2020-09-16 19:36:15 +02:00
/**
* @brief Time stamper which can be used to add any timestamp to a
* given buffer.
* @details
* This time stamper uses the CCSDS CDC short timestamp as a fault timestamp.
* This timestamp has a size of 8 bytes. A custom timestamp can be used by
* overriding the #addTimeStamp function.
* @ingroup utility
*/
2022-09-05 14:44:35 +02:00
class CdsShortTimeStamper : public TimeWriterIF, public TimeReaderIF, public SystemObject {
2022-02-02 10:29:30 +01:00
public:
2022-07-20 22:21:15 +02:00
static constexpr size_t TIMESTAMP_LEN = 7;
2023-02-07 12:06:34 +01:00
CdsShortTimeStamper();
2022-02-02 10:29:30 +01:00
/**
* @brief Default constructor which also registers the time stamper as a
* system object so it can be found with the #objectManager.
* @param objectId
*/
2022-07-20 22:21:15 +02:00
explicit CdsShortTimeStamper(object_id_t objectId);
2020-09-16 19:36:15 +02:00
2022-07-20 22:21:15 +02:00
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override;
2022-07-21 11:34:11 +02:00
[[nodiscard]] size_t getSerializedSize() const override;
2022-07-20 22:21:15 +02:00
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override;
2022-07-27 17:33:39 +02:00
timeval &getTime() override;
2022-07-21 11:34:11 +02:00
[[nodiscard]] size_t getTimestampSize() const override;
2022-07-27 17:33:39 +02:00
private:
timeval readTime{};
2020-09-16 19:36:15 +02:00
};
#endif /* FSFW_TIMEMANAGER_TIMESTAMPER_H_ */