eive-obsw/mission/tmtc/VirtualChannel.h

61 lines
1.7 KiB
C++

#ifndef VIRTUALCHANNEL_H_
#define VIRTUALCHANNEL_H_
#include <fsfw/ipc/MessageQueueIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <linux/ipcore/PtmeIF.h>
#include "OBSWConfig.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
class StorageManagerIF;
/**
* @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.
*
* @author J. Meier
*/
class VirtualChannel : public SystemObject, public ExecutableObjectIF, public AcceptsTelemetryIF {
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(object_id_t objectId, uint8_t vcId, const char* vcName, uint32_t tmQueueDepth);
ReturnValue_t initialize() override;
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) const override;
ReturnValue_t performOperation(uint8_t opCode) override;
/**
* @brief Sets the PTME object which handles access to the PTME IP Core.
*
* @param ptme Pointer to ptme object
*/
void setPtmeObject(PtmeIF* ptme_);
/**
* @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_);
const char* getName() const override;
private:
PtmeIF* ptme = nullptr;
MessageQueueIF* tmQueue = nullptr;
uint8_t vcId = 0;
std::string vcName;
bool linkIsUp = false;
StorageManagerIF* tmStore = nullptr;
};
#endif /* VIRTUALCHANNEL_H_ */