Robin Mueller
5a71a400be
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
72 lines
2.2 KiB
C++
72 lines
2.2 KiB
C++
#include "comModeTree.h"
|
|
|
|
#include <commonObjects.h>
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
#include <fsfw/modes/HasModesIF.h>
|
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
#include <fsfw/subsystem/Subsystem.h>
|
|
|
|
#include "util.h"
|
|
|
|
const auto check = subsystem::checkInsert;
|
|
|
|
static const auto OFF = HasModesIF::MODE_OFF;
|
|
static const auto ON = HasModesIF::MODE_ON;
|
|
static const auto NML = DeviceHandlerIF::MODE_NORMAL;
|
|
|
|
namespace {
|
|
void buildTxOffSequence(Subsystem* ss, ModeListEntry& eh);
|
|
void buildTxOnSequence(Subsystem* ss, ModeListEntry& eh);
|
|
}
|
|
|
|
void satsystem::com::init() {
|
|
ModeListEntry entry;
|
|
Subsystem* comSubsystem = new Subsystem(objects::COM_SUBSYSTEM, objects::EIVE_SYSTEM, 12, 24);
|
|
buildTxOffSequence(comSubsystem, entry);
|
|
buildTxOnSequence(comSubsystem, entry);
|
|
}
|
|
|
|
namespace {
|
|
|
|
void buildTxOffSequence(Subsystem* ss, ModeListEntry& eh) {
|
|
std::string context = "satsystem::com::buildTxOffSequence";
|
|
auto ctxc = context.c_str();
|
|
// Insert Helper Table
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
|
|
eh.setObject(obj);
|
|
eh.setMode(mode);
|
|
eh.setSubmode(submode);
|
|
check(table.insert(eh), ctxc);
|
|
};
|
|
// Insert Helper Sequence
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
bool checkSuccess) {
|
|
eh.setTableId(tableId);
|
|
eh.setWaitSeconds(waitSeconds);
|
|
eh.setCheckSuccess(checkSuccess);
|
|
check(sequence.insert(eh), ctxc);
|
|
};
|
|
}
|
|
|
|
void buildTxOnSequence(Subsystem* ss, ModeListEntry& eh) {
|
|
std::string context = "satsystem::com::buildTxOnSequence";
|
|
auto ctxc = context.c_str();
|
|
// Insert Helper Table
|
|
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
|
|
eh.setObject(obj);
|
|
eh.setMode(mode);
|
|
eh.setSubmode(submode);
|
|
check(table.insert(eh), ctxc);
|
|
};
|
|
// Insert Helper Sequence
|
|
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
|
|
bool checkSuccess) {
|
|
eh.setTableId(tableId);
|
|
eh.setWaitSeconds(waitSeconds);
|
|
eh.setCheckSuccess(checkSuccess);
|
|
check(sequence.insert(eh), ctxc);
|
|
};
|
|
}
|
|
|
|
}
|