eive-obsw/mission/system/TcsBoardAssembly.h

63 lines
2.2 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-09-14 13:44:43 +02:00
#include "events/subsystemIdRanges.h"
#include "returnvalues/classIds.h"
2022-03-22 11:57:48 +01:00
struct TcsBoardHelper {
TcsBoardHelper(std::array<std::pair<object_id_t, std::string>, 16> rtdInfos)
: rtdInfos(std::move(rtdInfos)) {}
2022-03-21 10:12:17 +01:00
std::array<std::pair<object_id_t, std::string>, 16> rtdInfos = {};
2022-03-22 11:57:48 +01:00
};
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;
2022-03-23 15:02:48 +01:00
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 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-04-22 10:28:29 +02:00
void performChildOperation() override;
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_ */