2020-12-15 23:00:30 +01:00
|
|
|
#ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
|
|
|
|
#define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2022-07-20 22:21:15 +02:00
|
|
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include "fsfw/serialize/SerializeIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
/**
|
|
|
|
* A class implementing this IF provides facilities to add a time stamp to the
|
|
|
|
* buffer provided.
|
|
|
|
* Implementors need to ensure that calling the method is thread-safe, i.e.
|
|
|
|
* addTimeStamp may be called in parallel from a different context.
|
|
|
|
*/
|
2022-07-20 22:21:15 +02:00
|
|
|
class TimeStamperIF : public SerializeIF {
|
2022-02-02 10:29:30 +01:00
|
|
|
public:
|
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::TIME_STAMPER_IF;
|
|
|
|
static const ReturnValue_t BAD_TIMESTAMP = MAKE_RETURN_CODE(1);
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2022-07-20 22:21:15 +02:00
|
|
|
// I am going to assume there are no larger timestamps
|
|
|
|
static constexpr size_t MAXIMUM_TIMESTAMP_LEN = 16;
|
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
//! This is a mission-specific constant and determines the total
|
|
|
|
//! size reserved for timestamps.
|
2022-07-20 22:21:15 +02:00
|
|
|
// static const uint8_t MISSION_TIMESTAMP_SIZE = fsfwconfig::FSFW_MISSION_TIMESTAMP_SIZE;
|
2021-04-12 23:55:33 +02:00
|
|
|
|
2022-07-22 16:06:31 +02:00
|
|
|
[[nodiscard]] virtual size_t getTimestampSize() const { return getSerializedSize(); }
|
2022-07-21 11:34:11 +02:00
|
|
|
|
2022-07-22 16:06:31 +02:00
|
|
|
virtual ReturnValue_t addTimeStamp(uint8_t* buffer, uint8_t maxSize) = 0;
|
2022-07-20 22:21:15 +02:00
|
|
|
~TimeStamperIF() override = default;
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
2020-12-15 23:00:30 +01:00
|
|
|
#endif /* FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ */
|