2020-12-15 23:00:30 +01:00
|
|
|
#ifndef FSFW_TIMEMANAGER_TIMEMESSAGE_H_
|
|
|
|
#define FSFW_TIMEMANAGER_TIMEMESSAGE_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "Clock.h"
|
2020-12-15 23:00:30 +01:00
|
|
|
#include "../ipc/MessageQueueMessage.h"
|
2018-07-12 16:29:32 +02:00
|
|
|
#include <cstring>
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class TimeMessage : public MessageQueueMessage {
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* @brief This call always returns the same fixed size of the message.
|
2018-07-12 16:29:32 +02:00
|
|
|
* @return Returns HEADER_SIZE + \c sizeof(timeval) + sizeof(uint32_t).
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2021-04-20 16:17:37 +02:00
|
|
|
size_t getMinimumMessageSize() const override;
|
2016-06-15 23:48:41 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ brief the size of a TimeMessage
|
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
static const uint32_t MAX_SIZE = HEADER_SIZE + sizeof(timeval) + sizeof(uint32_t);
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief In the default constructor, only the message_size is set.
|
|
|
|
*/
|
|
|
|
TimeMessage();
|
|
|
|
/**
|
|
|
|
* @brief With this constructor, the passed time information is directly put
|
|
|
|
* into the message.
|
2018-07-12 16:29:32 +02:00
|
|
|
* @param setTime The time information to put into the message.
|
|
|
|
* @param counterValue The counterValue to put into the message (GPS PPS).
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
TimeMessage( timeval setTime, uint32_t counterValue = 0 );
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* @brief The class's destructor is empty.
|
|
|
|
*/
|
|
|
|
~TimeMessage();
|
|
|
|
/**
|
|
|
|
* @brief This getter returns the time information in timeval format.
|
|
|
|
* @return Returns the time stored in this packet.
|
|
|
|
*/
|
|
|
|
timeval getTime();
|
2018-07-12 16:29:32 +02:00
|
|
|
/**
|
|
|
|
* @brief This getter returns the CounterValue in uint32_t format.
|
|
|
|
* @return Returns the CounterValue stored in this packet.
|
|
|
|
*/
|
|
|
|
uint32_t getCounterValue();
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
2020-12-15 23:00:30 +01:00
|
|
|
#endif /* FSFW_TIMEMANAGER_TIMEMESSAGE_H_ */
|