fsfw/src/fsfw/housekeeping/PeriodicHousekeepingHelper.h

32 lines
896 B
C
Raw Normal View History

2020-10-01 12:05:24 +02:00
#ifndef FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_
#define FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_
#include <cstdint>
2022-02-02 10:29:30 +01:00
#include "fsfw/timemanager/Clock.h"
2020-10-01 12:05:24 +02:00
class LocalPoolDataSetBase;
class PeriodicHousekeepingHelper {
2022-02-02 10:29:30 +01:00
public:
PeriodicHousekeepingHelper(LocalPoolDataSetBase* owner);
2020-10-01 12:05:24 +02:00
2023-03-14 17:40:39 +01:00
void initialize(float collectionInterval, dur_millis_t minimumPeriodicInterval);
2021-03-11 12:04:54 +01:00
2022-02-02 10:29:30 +01:00
void changeCollectionInterval(float newInterval);
float getCollectionIntervalInSeconds() const;
bool checkOpNecessary();
2020-10-01 12:05:24 +02:00
2022-02-02 10:29:30 +01:00
private:
LocalPoolDataSetBase* owner = nullptr;
2020-10-01 12:05:24 +02:00
2022-02-02 10:29:30 +01:00
uint32_t intervalSecondsToIntervalTicks(float collectionIntervalSeconds);
float intervalTicksToSeconds(uint32_t collectionInterval) const;
2020-10-01 12:05:24 +02:00
2022-02-02 10:29:30 +01:00
dur_millis_t minimumPeriodicInterval = 0;
uint32_t internalTickCounter = 1;
uint32_t collectionIntervalTicks = 0;
2020-10-01 12:05:24 +02:00
};
#endif /* FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ */