eive-obsw/mission/system/TcsBoardAssembly.h

60 lines
2.1 KiB
C
Raw Normal View History

#ifndef MISSION_SYSTEM_TCSSUBSYSTEM_H_
#define MISSION_SYSTEM_TCSSUBSYSTEM_H_
2022-03-22 15:49:22 +01:00
#include <fsfw/container/FixedArrayList.h>
2022-03-22 17:58:05 +01:00
#include <fsfw/devicehandlers/AssemblyBase.h>
2022-03-22 15:49:22 +01:00
#include <fsfw/power/PowerSwitcher.h>
2022-03-21 10:12:17 +01:00
2022-03-22 11:57:48 +01:00
struct TcsBoardHelper {
2022-03-22 15:49:22 +01:00
TcsBoardHelper(std::array<object_id_t, 16> rtdIds) : rtdIds(rtdIds) {}
2022-03-21 10:12:17 +01:00
2022-03-22 11:57:48 +01:00
std::array<object_id_t, 16> rtdIds = {};
};
2022-03-22 18:48:03 +01:00
class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF {
2022-03-22 15:49:22 +01:00
public:
2022-03-22 20:40:30 +01:00
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TCS_BOARD_ASS;
static constexpr Event CHILDREN_LOST_MODE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
2022-03-22 20:40:30 +01:00
2022-03-22 18:48:03 +01:00
TcsBoardAssembly(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
power::Switch_t switcher, TcsBoardHelper helper);
2022-03-22 14:30:42 +01:00
ReturnValue_t initialize() override;
2022-03-22 17:58:05 +01:00
void performChildOperation() override;
2022-03-22 18:00:05 +01:00
2022-03-22 15:49:22 +01:00
private:
static constexpr uint8_t NUMBER_RTDS = 16;
PowerSwitcher switcher;
2022-03-22 20:35:37 +01:00
bool warningSwitch = true;
2022-03-22 15:49:22 +01:00
TcsBoardHelper helper;
FixedArrayList<ModeListEntry, NUMBER_RTDS> modeTable;
2022-03-22 18:48:03 +01:00
MessageQueueIF* eventQueue = nullptr;
2022-03-22 15:49:22 +01:00
2022-03-22 18:48:03 +01:00
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
/**
* Check whether it makes sense to send mode commands to the device
* @param object
* @param mode
* @return
*/
bool isUseable(object_id_t object, Mode_t mode);
// ConfirmFailureIF implementation
MessageQueueId_t getEventReceptionQueue() override;
// AssemblyBase implementation
2022-03-22 17:58:05 +01:00
ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override;
ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override;
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
2022-03-22 18:48:03 +01:00
void startTransition(Mode_t mode, Submode_t submode) override;
void handleModeReached() override;
2022-03-22 20:40:30 +01:00
// These two overrides prevent a transition of the whole assembly back to off just because
// some devices are not working
2022-03-22 20:35:37 +01:00
void handleChildrenLostMode(ReturnValue_t result) override;
void handleModeTransitionFailed(ReturnValue_t result) override;
2022-03-21 10:12:17 +01:00
};
#endif /* MISSION_SYSTEM_TCSSUBSYSTEM_H_ */