fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h

64 lines
1.9 KiB
C
Raw Normal View History

#ifndef ABSTRACTSENSOR_H_
#define ABSTRACTSENSOR_H_
2022-02-02 10:29:30 +01:00
#include "ThermalModuleIF.h"
2021-07-13 20:22:54 +02:00
#include "fsfw/health/HasHealthIF.h"
#include "fsfw/health/HealthHelper.h"
2022-02-02 10:29:30 +01:00
#include "fsfw/ipc/MessageQueueIF.h"
2021-07-13 20:22:54 +02:00
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/parameters/ParameterHelper.h"
2022-02-02 10:29:30 +01:00
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "tcsDefinitions.h"
2020-12-03 18:32:32 +01:00
/**
* @defgroup thermal Thermal Components
* @brief Contains all components related to thermal tasks (sensors, heaters)
*/
/**
* @brief Base class for Temperature Sensor, implements all important interfaces.
* Please use the TemperatureSensor class to implement the actual sensors.
* @ingroup thermal
*/
2022-02-02 10:29:30 +01:00
class AbstractTemperatureSensor : public HasHealthIF,
public SystemObject,
public ExecutableObjectIF,
public ReceivesParameterMessagesIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::T_SENSORS;
static const Event TEMP_SENSOR_HIGH = MAKE_EVENT(0, severity::LOW);
static const Event TEMP_SENSOR_LOW = MAKE_EVENT(1, severity::LOW);
static const Event TEMP_SENSOR_GRADIENT = MAKE_EVENT(2, severity::LOW);
2022-02-02 10:29:30 +01:00
static constexpr float ZERO_KELVIN_C = -273.15;
AbstractTemperatureSensor(object_id_t setObjectid, ThermalModuleIF* thermalModule);
virtual ~AbstractTemperatureSensor();
2022-02-02 10:29:30 +01:00
virtual MessageQueueId_t getCommandQueue() const;
2022-02-02 10:29:30 +01:00
ReturnValue_t initialize();
2022-02-02 10:29:30 +01:00
ReturnValue_t performHealthOp();
2022-02-02 10:29:30 +01:00
ReturnValue_t performOperation(uint8_t opCode);
2022-02-02 10:29:30 +01:00
virtual float getTemperature() = 0;
virtual bool isValid() = 0;
2022-02-02 10:29:30 +01:00
virtual void resetOldState() = 0;
2022-02-02 10:29:30 +01:00
ReturnValue_t setHealth(HealthState health);
HasHealthIF::HealthState getHealth();
2022-02-02 10:29:30 +01:00
protected:
2022-02-19 16:14:02 +01:00
MessageQueueIF* commandQueue = nullptr;
2022-02-02 10:29:30 +01:00
HealthHelper healthHelper;
ParameterHelper parameterHelper;
2022-02-02 10:29:30 +01:00
virtual void doChildOperation() = 0;
2022-02-02 10:29:30 +01:00
void handleCommandQueue();
};
#endif /* ABSTRACTSENSOR_H_ */