Robin Mueller
1742371c14
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
#ifndef MISSION_SYSTEM_DUALLANEASSEMBLYBASE_H_
|
|
#define MISSION_SYSTEM_DUALLANEASSEMBLYBASE_H_
|
|
|
|
#include <fsfw/devicehandlers/AssemblyBase.h>
|
|
#include <mission/system/DualLanePowerStateMachine.h>
|
|
|
|
class DualLaneAssemblyBase : public AssemblyBase {
|
|
public:
|
|
static constexpr uint8_t TRANSITION_OTHER_SIDE_FAILED_ID = 0;
|
|
static constexpr uint8_t NOT_ENOUGH_DEVICES_DUAL_MODE_ID = 1;
|
|
static constexpr uint8_t POWER_STATE_MACHINE_TIMEOUT_ID = 2;
|
|
|
|
DualLaneAssemblyBase(object_id_t objectId, object_id_t parentId, PowerSwitchIF* pwrSwitcher,
|
|
pcduSwitches::Switches switch1, pcduSwitches::Switches switch2,
|
|
Event pwrSwitchTimeoutEvent);
|
|
|
|
virtual void performChildOperation() override;
|
|
virtual void startTransition(Mode_t mode, Submode_t submode) override;
|
|
|
|
protected:
|
|
// This helper object complete encapsulates power switching
|
|
DualLanePowerStateMachine pwrStateMachine;
|
|
Event pwrTimeoutEvent;
|
|
uint8_t powerRetryCounter = 0;
|
|
|
|
/**
|
|
* 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);
|
|
/**
|
|
* Thin wrapper function which is required because the helper class
|
|
* can not access protected member functions.
|
|
* @param mode
|
|
* @param submode
|
|
*/
|
|
virtual ReturnValue_t pwrStateMachineWrapper();
|
|
virtual void handleModeReached();
|
|
|
|
/**
|
|
* Implemented by user. Will be called if a full mode operation has finished.
|
|
* This includes both the regular mode state machine operations and the power state machine
|
|
* operations
|
|
*/
|
|
virtual void finishModeOp() = 0;
|
|
|
|
template <size_t MAX_SIZE>
|
|
void initModeTableEntry(object_id_t id, ModeListEntry& entry,
|
|
FixedArrayList<ModeListEntry, MAX_SIZE>& modeTable);
|
|
|
|
private:
|
|
};
|
|
|
|
template <size_t MAX_SIZE>
|
|
inline void DualLaneAssemblyBase::initModeTableEntry(
|
|
object_id_t id, ModeListEntry& entry, FixedArrayList<ModeListEntry, MAX_SIZE>& modeTable) {
|
|
entry.setObject(id);
|
|
entry.setMode(MODE_OFF);
|
|
entry.setSubmode(SUBMODE_NONE);
|
|
entry.setInheritSubmode(false);
|
|
modeTable.insert(entry);
|
|
}
|
|
|
|
#endif /* MISSION_SYSTEM_DUALLANEASSEMBLYBASE_H_ */
|