fsfw/src/fsfw/power/PowerSwitchIF.h

78 lines
2.7 KiB
C
Raw Normal View History

2020-12-03 18:29:28 +01:00
#ifndef FSFW_POWER_POWERSWITCHIF_H_
#define FSFW_POWER_POWERSWITCHIF_H_
2020-08-13 20:53:35 +02:00
#include "../events/Event.h"
2022-08-16 12:48:22 +02:00
#include "../returnvalues/returnvalue.h"
2022-03-28 12:59:51 +02:00
#include "definitions.h"
/**
2020-12-03 18:29:28 +01:00
*
* @brief This interface defines a connection to a device that is capable of
* turning on and off switches of devices identified by a switch ID.
* @details
* The virtual functions of this interface do not allow to make any assignments
* because they can be called asynchronosuly (const ending).
* @ingroup interfaces
*/
2022-08-15 20:28:16 +02:00
class PowerSwitchIF {
2022-02-02 10:29:30 +01:00
public:
/**
* Empty dtor.
*/
virtual ~PowerSwitchIF() {}
/**
2022-08-16 12:48:22 +02:00
* The Returnvalues id of this class
2022-02-02 10:29:30 +01:00
*/
static const uint8_t INTERFACE_ID = CLASS_ID::POWER_SWITCH_IF;
static const ReturnValue_t SWITCH_ON = MAKE_RETURN_CODE(1);
static const ReturnValue_t SWITCH_OFF = MAKE_RETURN_CODE(0);
static const ReturnValue_t SWITCH_TIMEOUT = MAKE_RETURN_CODE(2);
static const ReturnValue_t FUSE_ON = MAKE_RETURN_CODE(3);
static const ReturnValue_t FUSE_OFF = MAKE_RETURN_CODE(4);
2023-03-14 13:45:03 +01:00
static const ReturnValue_t SWITCH_UNKNOWN = MAKE_RETURN_CODE(5);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::POWER_SWITCH_IF;
2022-06-21 00:49:58 +02:00
//!< Someone detected that a switch went off which shouldn't. Severity:
//!< Low, Parameter1: switchId1, Parameter2: switchId2
static const Event SWITCH_WENT_OFF = MAKE_EVENT(0, severity::LOW);
2022-02-02 10:29:30 +01:00
/**
* send a direct command to the Power Unit to enable/disable the specified switch.
*
* @param switchNr
* @param onOff on == @c SWITCH_ON; off != @c SWITCH_ON
*/
2022-03-28 12:47:09 +02:00
virtual ReturnValue_t sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) = 0;
2022-02-02 10:29:30 +01:00
/**
* Sends a command to the Power Unit to enable a certain fuse.
*/
2022-03-28 12:47:09 +02:00
virtual ReturnValue_t sendFuseOnCommand(uint8_t fuseNr) = 0;
2022-02-02 10:29:30 +01:00
/**
* get the state of the Switches.
* @param switchNr
* @return
* - @c SWITCH_ON if the specified switch is on.
* - @c SWITCH_OFF if the specified switch is off.
2023-03-14 13:45:03 +01:00
* - @c SWITCH_UNKNOWN if the state of the specified switch is unknown.
2022-08-15 20:28:16 +02:00
* - @c returnvalue::FAILED if an error occured
2022-02-02 10:29:30 +01:00
*/
2022-03-22 15:49:04 +01:00
virtual ReturnValue_t getSwitchState(power::Switch_t switchNr) const = 0;
2022-02-02 10:29:30 +01:00
/**
* get state of a fuse.
* @param fuseNr
* @return
* - @c FUSE_ON if the specified fuse is on.
* - @c FUSE_OFF if the specified fuse is off.
2022-08-15 20:28:16 +02:00
* - @c returnvalue::FAILED if an error occured
2022-02-02 10:29:30 +01:00
*/
virtual ReturnValue_t getFuseState(uint8_t fuseNr) const = 0;
/**
* The maximum delay that it will take to change a switch
*
* This may take into account the time to send a command, wait for it to be executed and see the
* switch changed.
*/
virtual uint32_t getSwitchDelayMs(void) const = 0;
};
2020-12-03 18:29:28 +01:00
#endif /* FSFW_POWER_POWERSWITCHIF_H_ */