eive-obsw/mission/com/LiveTmTask.h

80 lines
2.6 KiB
C
Raw Normal View History

2023-03-31 01:14:59 +02:00
#ifndef MISSION_TMTC_LIVETMTASK_H_
#define MISSION_TMTC_LIVETMTASK_H_
#include <fsfw/modes/HasModesIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/subsystem/ModeTreeChildIF.h>
#include <fsfw/subsystem/ModeTreeConnectionIF.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/timemanager/Countdown.h>
#include <mission/com/VirtualChannelWithQueue.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
2023-10-13 13:21:28 +02:00
2023-10-13 11:42:13 +02:00
#include <cstdint>
2023-10-13 13:21:28 +02:00
2023-10-13 11:42:13 +02:00
#include "eive/definitions.h"
2023-03-31 01:14:59 +02:00
2023-10-13 16:47:16 +02:00
static constexpr bool DEBUG_CFDP_TO_LIVE_TM_TASK = false;
2023-03-31 01:14:59 +02:00
class LiveTmTask : public SystemObject,
public HasModesIF,
public ExecutableObjectIF,
public ModeTreeChildIF,
public ModeTreeConnectionIF {
public:
LiveTmTask(object_id_t objectId, PusTmFunnel& pusFunnel, CfdpTmFunnel& cfdpFunnel,
2023-09-11 20:16:54 +02:00
VirtualChannel& channel, const std::atomic_bool& ptmeLocked,
uint32_t regularTmQueueDepth, uint32_t cfdpQueueDepth);
2023-03-31 01:14:59 +02:00
2023-09-11 20:16:54 +02:00
MessageQueueId_t getNormalLiveQueueId() const;
MessageQueueId_t getCfdpLiveQueueId() const;
2023-03-31 01:14:59 +02:00
ReturnValue_t performOperation(uint8_t opCode) override;
2023-03-31 12:11:31 +02:00
ReturnValue_t initialize() override;
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
2023-03-31 01:14:59 +02:00
private:
MessageQueueIF* requestQueue;
2023-09-11 20:16:54 +02:00
MessageQueueIF* cfdpTmQueue;
MessageQueueIF* regularTmQueue;
2023-09-13 13:09:07 +02:00
StorageManagerIF* tmStore = nullptr;
2023-03-31 01:14:59 +02:00
ModeHelper modeHelper;
Mode_t mode = HasModesIF::MODE_OFF;
Countdown tmFunnelCd = Countdown(100);
PusTmFunnel& pusFunnel;
CfdpTmFunnel& cfdpFunnel;
2023-09-11 20:16:54 +02:00
VirtualChannel& channel;
const std::atomic_bool& ptmeLocked;
2023-10-13 10:57:58 +02:00
bool throttlePeriodOngoing = false;
2023-10-13 14:20:50 +02:00
bool channelIsBusy = false;
2023-03-31 01:14:59 +02:00
void readCommandQueue(void);
2023-09-11 20:16:54 +02:00
ReturnValue_t handleRegularTmQueue();
ReturnValue_t handleCfdpTmQueue();
2023-10-13 13:21:28 +02:00
ReturnValue_t handleGenericTmQueue(MessageQueueIF& queue, bool isCfdp);
2023-09-11 20:16:54 +02:00
2023-03-31 01:14:59 +02:00
MessageQueueId_t getCommandQueue() const override;
void getMode(Mode_t* mode, Submode_t* submode) override;
2023-10-13 16:42:13 +02:00
void cfdpBackpressureHandling();
2023-03-31 01:14:59 +02:00
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
void startTransition(Mode_t mode, Submode_t submode) override;
void announceMode(bool recursive) override;
2023-10-13 10:57:58 +02:00
void throttleCfdp();
void releaseCfdp();
2023-10-13 14:20:50 +02:00
void updateBusyFlag();
2023-03-31 01:14:59 +02:00
object_id_t getObjectId() const override;
const HasHealthIF* getOptHealthIF() const override;
const HasModesIF& getModeIF() const override;
ModeTreeChildIF& getModeTreeChildIF() override;
};
#endif /* MISSION_TMTC_LIVETMTASK_H_ */