eive-obsw/mission/tmtc/VirtualChannel.h

59 lines
1.5 KiB
C
Raw Normal View History

2021-09-22 16:54:55 +02:00
#ifndef VIRTUALCHANNEL_H_
#define VIRTUALCHANNEL_H_
2021-09-29 14:47:20 +02:00
#include "OBSWConfig.h"
2021-09-22 16:54:55 +02:00
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include <fsfw/ipc/MessageQueueIF.h>
2021-09-26 08:29:30 +02:00
#include <linux/obc/PtmeIF.h>
2021-09-22 16:54:55 +02:00
/**
2021-09-26 08:29:30 +02:00
* @brief This class represents a virtual channel. Sending a tm message to an object of this class
* will forward the tm packet to the respective virtual channel of the PTME IP Core.
2021-09-22 16:54:55 +02:00
*
* @author J. Meier
*/
class VirtualChannel: public AcceptsTelemetryIF, public HasReturnvaluesIF {
public:
/**
* @brief Constructor
*
* @param vcId The virtual channel id assigned to this object
* @param tmQueueDepth Queue depth of queue receiving telemetry from other objects
*/
VirtualChannel(uint8_t vcId, uint32_t tmQueueDepth);
ReturnValue_t initialize();
2021-09-26 08:29:30 +02:00
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
2021-09-22 16:54:55 +02:00
ReturnValue_t performOperation();
/**
* @brief Sets the PTME object which handles access to the PTME IP Core.
*
* @param ptme Pointer to ptme object
*/
2021-09-29 14:47:20 +02:00
void setPtmeObject(PtmeIF* ptme_);
2021-09-26 08:29:30 +02:00
/**
* @brief Can be used by the owner to set the link state. Packets will be discarded if link
* to ground station is down.
*/
void setLinkState(bool linkIsUp);
2021-09-22 16:54:55 +02:00
private:
PtmeIF* ptme = nullptr;
MessageQueueIF* tmQueue = nullptr;
2021-09-26 08:29:30 +02:00
uint8_t vcId;
2021-09-29 14:47:20 +02:00
#if OBSW_LINK_IS_UP == 1
bool linkIsUp = true;
#else
bool linkIsUp = false;
#endif /* OBSW_LINK_IS_UP == 1 */
2021-09-22 16:54:55 +02:00
StorageManagerIF* tmStore = nullptr;
};
#endif /* VIRTUALCHANNEL_H_ */