fsfw/src/fsfw/housekeeping/PeriodicHousekeepingHelper.h

34 lines
959 B
C
Raw Normal View History

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