2022-02-25 11:58:02 +01:00
|
|
|
#ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_
|
|
|
|
#define MISSION_SYSTEM_COMSUBSYSTEM_H_
|
|
|
|
|
2023-02-22 19:45:41 +01:00
|
|
|
#include <fsfw/events/EventMessage.h>
|
2023-01-27 18:38:36 +01:00
|
|
|
#include <fsfw/parameters/HasParametersIF.h>
|
|
|
|
#include <fsfw/parameters/ParameterHelper.h>
|
2022-04-14 09:54:07 +02:00
|
|
|
#include <fsfw/subsystem/Subsystem.h>
|
|
|
|
|
2023-01-27 18:38:36 +01:00
|
|
|
#include "mission/comDefs.h"
|
|
|
|
|
|
|
|
class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
2022-04-14 09:54:07 +02:00
|
|
|
public:
|
2023-02-22 19:45:41 +01:00
|
|
|
/**
|
|
|
|
* @brief Constructor
|
|
|
|
*
|
|
|
|
* @param setObjectId
|
|
|
|
* @param maxNumberOfSequences
|
|
|
|
* @param maxNumberOfTables
|
|
|
|
* @param transmitterTimeout Maximum time the transmitter of the syrlinks
|
2023-02-23 18:34:28 +01:00
|
|
|
* will
|
|
|
|
* be enabled
|
2023-02-22 19:45:41 +01:00
|
|
|
*/
|
2023-02-02 15:33:04 +01:00
|
|
|
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
|
|
|
|
uint32_t transmitterTimeout);
|
2023-01-28 14:49:28 +01:00
|
|
|
virtual ~ComSubsystem() = default;
|
2022-04-14 09:54:07 +02:00
|
|
|
|
2023-01-27 18:38:36 +01:00
|
|
|
MessageQueueId_t getCommandQueue() const override;
|
|
|
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
|
|
|
|
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
|
|
|
|
uint16_t startAtIndex) override;
|
2023-02-02 15:33:04 +01:00
|
|
|
virtual void performChildOperation() override;
|
2023-01-27 18:38:36 +01:00
|
|
|
|
2022-04-14 09:54:07 +02:00
|
|
|
private:
|
2023-02-22 13:02:40 +01:00
|
|
|
static const Mode_t INITIAL_MODE = 0;
|
|
|
|
|
2023-01-28 14:49:28 +01:00
|
|
|
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
|
|
|
|
|
|
|
ReturnValue_t initialize() override;
|
|
|
|
|
2023-02-02 15:33:04 +01:00
|
|
|
void startTransition(Mode_t mode, Submode_t submode) override;
|
|
|
|
|
|
|
|
void readEventQueue();
|
2023-02-22 19:45:41 +01:00
|
|
|
void handleEventMessage(EventMessage *eventMessage);
|
2023-02-02 15:33:04 +01:00
|
|
|
void handleBitLockEvent();
|
|
|
|
void handleCarrierLockEvent();
|
|
|
|
void checkTransmitterCountdown();
|
|
|
|
/**
|
2023-02-22 13:02:40 +01:00
|
|
|
* @brief Enables transmitter in low rate mode
|
|
|
|
*/
|
|
|
|
void startRxAndTxLowRateSeq();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns true if mode is a mode where the transmitter is on
|
2023-02-02 15:33:04 +01:00
|
|
|
*/
|
2023-02-22 13:02:40 +01:00
|
|
|
bool isTxMode(Mode_t mode);
|
2023-02-02 15:33:04 +01:00
|
|
|
|
2023-01-27 18:38:36 +01:00
|
|
|
uint8_t datarateCfg = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
|
2023-02-02 16:00:53 +01:00
|
|
|
// Maximum time after which the transmitter will be turned of. This is a
|
2023-02-22 19:45:41 +01:00
|
|
|
// protection mechanism due prevent the syrlinks from overheating
|
|
|
|
uint32_t transmitterTimeout = 0;
|
2023-01-27 18:38:36 +01:00
|
|
|
ParameterHelper paramHelper;
|
2023-02-02 15:33:04 +01:00
|
|
|
|
2023-02-22 19:45:41 +01:00
|
|
|
MessageQueueIF *eventQueue = nullptr;
|
2023-02-02 15:33:04 +01:00
|
|
|
|
|
|
|
bool enableTxWhenCarrierLock = false;
|
|
|
|
|
|
|
|
// Countdown will be started as soon as the transmitter was enabled
|
|
|
|
Countdown transmitterCountdown;
|
2023-02-22 09:53:09 +01:00
|
|
|
|
|
|
|
// Transmitter countdown only active when sysrlinks transmitter is on (modes:
|
|
|
|
// rx and tx low rate, rx and tx high rate, rx and tx default rate)
|
|
|
|
bool countdownActive = false;
|
2023-02-22 13:02:40 +01:00
|
|
|
|
|
|
|
// True when bit lock occurred while COM subsystem is in a transition. This
|
|
|
|
// variable is used to remember the bit lock and execute the default rate
|
|
|
|
// sequence after the active transition has been completed
|
|
|
|
bool rememberBitLock = false;
|
2022-04-14 09:54:07 +02:00
|
|
|
};
|
|
|
|
|
2022-02-25 11:58:02 +01:00
|
|
|
#endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */
|