Merge remote-tracking branch 'origin/develop' into flipped-tmtctest-preproc-define
This commit is contained in:
@ -1,22 +1,23 @@
|
||||
#ifndef CCSDSHANDLER_H_
|
||||
#define CCSDSHANDLER_H_
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||
#include "fsfw/parameters/ParameterHelper.h"
|
||||
#include "VirtualChannel.h"
|
||||
#include "fsfw/action/ActionHelper.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "fsfw/events/EventMessage.h"
|
||||
#include "linux/obc/TxRateSetterIF.h"
|
||||
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/parameters/ParameterHelper.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
#include "VirtualChannel.h"
|
||||
#include <unordered_map>
|
||||
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
|
||||
#include "linux/obc/TxRateSetterIF.h"
|
||||
|
||||
/**
|
||||
* @brief This class handles the data exchange with the CCSDS IP cores implemented in the
|
||||
@ -24,70 +25,69 @@
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class CCSDSHandler: public SystemObject,
|
||||
public ExecutableObjectIF,
|
||||
public AcceptsTelemetryIF,
|
||||
public AcceptsTelecommandsIF,
|
||||
public HasReturnvaluesIF,
|
||||
public ReceivesParameterMessagesIF,
|
||||
public HasActionsIF {
|
||||
public:
|
||||
class CCSDSHandler : public SystemObject,
|
||||
public ExecutableObjectIF,
|
||||
public AcceptsTelemetryIF,
|
||||
public AcceptsTelecommandsIF,
|
||||
public HasReturnvaluesIF,
|
||||
public ReceivesParameterMessagesIF,
|
||||
public HasActionsIF {
|
||||
public:
|
||||
using VcId_t = uint8_t;
|
||||
|
||||
using VcId_t = uint8_t;
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param objectId Object ID of the CCSDS handler
|
||||
* @param ptmeId Object ID of the PTME object providing access to the PTME IP Core.
|
||||
* @param tcDestination Object ID of object handling received TC space packets
|
||||
* @param txRateSetter Object providing the functionality to switch the input bitrate of
|
||||
* the S-Band transceiver.
|
||||
* @param gpioIF Required to enable TX data and TX clock RS485 transceiver chips.
|
||||
* @param enTxClock GPIO ID of RS485 tx clock enable
|
||||
* @param enTxData GPIO ID of RS485 tx data enable
|
||||
*/
|
||||
CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
|
||||
TxRateSetterIF* txRateSetterIF, GpioIF* gpioIF, gpioId_t enTxClock,
|
||||
gpioId_t enTxData);
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param objectId Object ID of the CCSDS handler
|
||||
* @param ptmeId Object ID of the PTME object providing access to the PTME IP Core.
|
||||
* @param tcDestination Object ID of object handling received TC space packets
|
||||
* @param txRateSetter Object providing the functionality to switch the input bitrate of
|
||||
* the S-Band transceiver.
|
||||
* @param gpioIF Required to enable TX data and TX clock RS485 transceiver chips.
|
||||
* @param enTxClock GPIO ID of RS485 tx clock enable
|
||||
* @param enTxData GPIO ID of RS485 tx data enable
|
||||
*/
|
||||
CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
|
||||
TxRateSetterIF* txRateSetterIF, GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData);
|
||||
~CCSDSHandler();
|
||||
|
||||
~CCSDSHandler();
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
ReturnValue_t initialize();
|
||||
MessageQueueId_t getCommandQueue() const;
|
||||
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
ReturnValue_t initialize();
|
||||
MessageQueueId_t getCommandQueue() const;
|
||||
/**
|
||||
* @brief Function to add a virtual channel
|
||||
*
|
||||
* @param virtualChannelId ID of the virtual channel to add
|
||||
* @param virtualChannel Pointer to virtual channel object
|
||||
*/
|
||||
void addVirtualChannel(VcId_t virtualChannelId, VirtualChannel* virtualChannel);
|
||||
|
||||
/**
|
||||
* @brief Function to add a virtual channel
|
||||
*
|
||||
* @param virtualChannelId ID of the virtual channel to add
|
||||
* @param virtualChannel Pointer to virtual channel object
|
||||
*/
|
||||
void addVirtualChannel(VcId_t virtualChannelId, VirtualChannel* virtualChannel);
|
||||
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0);
|
||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
|
||||
ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues,
|
||||
uint16_t startAtIndex);
|
||||
|
||||
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0);
|
||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
|
||||
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
|
||||
uint16_t startAtIndex);
|
||||
uint16_t getIdentifier() override;
|
||||
MessageQueueId_t getRequestQueue() override;
|
||||
|
||||
uint16_t getIdentifier() override;
|
||||
MessageQueueId_t getRequestQueue() override;
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
private:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
|
||||
|
||||
private:
|
||||
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
|
||||
static const ActionId_t SET_LOW_RATE = 0;
|
||||
static const ActionId_t SET_HIGH_RATE = 1;
|
||||
static const ActionId_t EN_TRANSMITTER = 2;
|
||||
static const ActionId_t DIS_TRANSMITTER = 3;
|
||||
|
||||
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
|
||||
|
||||
static const ActionId_t SET_LOW_RATE = 0;
|
||||
static const ActionId_t SET_HIGH_RATE = 1;
|
||||
static const ActionId_t EN_TRANSMITTER = 2;
|
||||
static const ActionId_t DIS_TRANSMITTER = 3;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Received action message with unknown action id
|
||||
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0);
|
||||
//! [EXPORT] : [COMMENT] Received action message with unknown action id
|
||||
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0);
|
||||
|
||||
#if OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT == 1
|
||||
// syrlinks must not be transmitting more than 15 minutes (according to datasheet)
|
||||
@ -97,72 +97,72 @@ private:
|
||||
static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day
|
||||
#endif /* OBSW_SYRLINKS_DOWNLINK == 0 */
|
||||
|
||||
static const bool UP = true;
|
||||
static const bool DOWN = false;
|
||||
static const bool UP = true;
|
||||
static const bool DOWN = false;
|
||||
|
||||
using VirtualChannelMap = std::unordered_map<VcId_t, VirtualChannel*>;
|
||||
using VirtualChannelMapIter = VirtualChannelMap::iterator;
|
||||
using VirtualChannelMap = std::unordered_map<VcId_t, VirtualChannel*>;
|
||||
using VirtualChannelMapIter = VirtualChannelMap::iterator;
|
||||
|
||||
VirtualChannelMap virtualChannelMap;
|
||||
VirtualChannelMap virtualChannelMap;
|
||||
|
||||
// Object ID of PTME object
|
||||
object_id_t ptmeId;
|
||||
// Object ID of PTME object
|
||||
object_id_t ptmeId;
|
||||
|
||||
object_id_t tcDestination;
|
||||
object_id_t tcDestination;
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
|
||||
ParameterHelper parameterHelper;
|
||||
ParameterHelper parameterHelper;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
ActionHelper actionHelper;
|
||||
|
||||
MessageQueueId_t tcDistributorQueueId;
|
||||
MessageQueueId_t tcDistributorQueueId;
|
||||
|
||||
TxRateSetterIF* txRateSetterIF = nullptr;
|
||||
TxRateSetterIF* txRateSetterIF = nullptr;
|
||||
|
||||
GpioIF* gpioIF = nullptr;
|
||||
gpioId_t enTxClock = gpio::NO_GPIO;
|
||||
gpioId_t enTxData = gpio::NO_GPIO;
|
||||
GpioIF* gpioIF = nullptr;
|
||||
gpioId_t enTxClock = gpio::NO_GPIO;
|
||||
gpioId_t enTxData = gpio::NO_GPIO;
|
||||
|
||||
// Countdown to disable transmitter after 15 minutes
|
||||
Countdown transmitterCountdown;
|
||||
// Countdown to disable transmitter after 15 minutes
|
||||
Countdown transmitterCountdown;
|
||||
|
||||
// When true transmitting is started as soon as carrier lock has been detected
|
||||
bool enableTxWhenCarrierLock = false;
|
||||
// When true transmitting is started as soon as carrier lock has been detected
|
||||
bool enableTxWhenCarrierLock = false;
|
||||
|
||||
bool linkState = DOWN;
|
||||
bool linkState = DOWN;
|
||||
|
||||
void readCommandQueue(void);
|
||||
void handleTelemetry();
|
||||
void handleTelecommands();
|
||||
void checkEvents();
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
void readCommandQueue(void);
|
||||
void handleTelemetry();
|
||||
void handleTelecommands();
|
||||
void checkEvents();
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
|
||||
void handleBitLockEvent();
|
||||
void handleCarrierLockEvent();
|
||||
void handleBitLockEvent();
|
||||
void handleCarrierLockEvent();
|
||||
|
||||
/**
|
||||
* @brief Forward link state to virtual channels.
|
||||
*/
|
||||
void forwardLinkstate();
|
||||
/**
|
||||
* @brief Forward link state to virtual channels.
|
||||
*/
|
||||
void forwardLinkstate();
|
||||
|
||||
/**
|
||||
* @brief Starts transmit timer and enables transmitter.
|
||||
*/
|
||||
void enableTransmit();
|
||||
/**
|
||||
* @brief Starts transmit timer and enables transmitter.
|
||||
*/
|
||||
void enableTransmit();
|
||||
|
||||
/**
|
||||
* @brief Checks Tx timer for timeout and disables RS485 tx clock and tx data in case
|
||||
* timer has expired.
|
||||
*/
|
||||
void checkTxTimer();
|
||||
/**
|
||||
* @brief Checks Tx timer for timeout and disables RS485 tx clock and tx data in case
|
||||
* timer has expired.
|
||||
*/
|
||||
void checkTxTimer();
|
||||
|
||||
/**
|
||||
* @brief Disables the transmitter by pulling the enable tx clock and tx data pin of the
|
||||
* RS485 transceiver chips to high.
|
||||
*/
|
||||
void disableTransmit();
|
||||
/**
|
||||
* @brief Disables the transmitter by pulling the enable tx clock and tx data pin of the
|
||||
* RS485 transceiver chips to high.
|
||||
*/
|
||||
void disableTransmit();
|
||||
};
|
||||
|
||||
#endif /* CCSDSHANDLER_H_ */
|
||||
|
Reference in New Issue
Block a user