Merge branch 'mueller_TmTcBridge_cherryPicked' into mueller_framework
This commit is contained in:
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* @file TmTcBridge.h
|
||||
*
|
||||
* @date 26.12.2019
|
||||
*/
|
||||
|
||||
#ifndef FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
||||
#define FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
||||
|
||||
@ -21,32 +15,42 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
||||
public HasReturnvaluesIF,
|
||||
public SystemObject {
|
||||
public:
|
||||
static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
|
||||
static constexpr uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10;
|
||||
static constexpr uint8_t MAX_DOWNLINK_PACKETS_STORED = 15;
|
||||
|
||||
TmTcBridge(object_id_t objectId_, object_id_t ccsdsPacketDistributor_);
|
||||
virtual ~TmTcBridge();
|
||||
|
||||
/**
|
||||
* Initializes basic FSFW components for the TMTC Bridge
|
||||
* @return
|
||||
* Set number of packets sent per performOperation().Please note that this
|
||||
* value must be smaller than MAX_STORED_DATA_SENT_PER_CYCLE
|
||||
* @param sentPacketsPerCycle
|
||||
* @return -@c RETURN_OK if value was set successfully
|
||||
* -@c RETURN_FAILED otherwise, stored value stays the same
|
||||
*/
|
||||
virtual ReturnValue_t initialize();
|
||||
ReturnValue_t setNumberOfSentPacketsPerCycle(uint8_t sentPacketsPerCycle);
|
||||
|
||||
void registerCommConnect();
|
||||
void registerCommDisconnect();
|
||||
|
||||
/**
|
||||
* @brief The performOperation method is executed in a task.
|
||||
* @details There are no restrictions for calls within this method, so any
|
||||
* other member of the class can be used.
|
||||
* @return Currently, the return value is ignored.
|
||||
* Initializes necessary FSFW components for the TMTC Bridge
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
/**
|
||||
* @brief Handles TMTC reception
|
||||
*/
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
|
||||
/**
|
||||
* Return TMTC Reception Queue
|
||||
* @param virtualChannel
|
||||
* @return
|
||||
*/
|
||||
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0);
|
||||
|
||||
void registerCommConnect();
|
||||
void registerCommDisconnect();
|
||||
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
||||
protected:
|
||||
//! Used to send and receive TMTC messages.
|
||||
//! TmTcMessage is used to transport messages between tasks.
|
||||
@ -59,19 +63,25 @@ protected:
|
||||
bool tmStored = false;
|
||||
|
||||
/**
|
||||
* Handle TC reception. Default implementation provided
|
||||
* @brief Handle TC reception
|
||||
* @details
|
||||
* Default implementation provided, but is empty.
|
||||
* Child handler should override this in most cases orsend TC to the
|
||||
* TC distributor directly with the address of the reception queue by
|
||||
* calling getReportRecptionQueue()
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t handleTc();
|
||||
|
||||
/**
|
||||
* Implemented by child class. Perform receiving of Telecommand, for example by implementing
|
||||
* specific drivers or wrappers, e.g. UART Communication or lwIP stack
|
||||
* Implemented by child class. Perform receiving of Telecommand,
|
||||
* for example by implementing specific drivers or wrappers,
|
||||
* e.g. UART Communication or an ethernet stack
|
||||
* @param recvBuffer [out] Received data
|
||||
* @param size [out] Size of received data
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t receiveTc(uint8_t ** recvBuffer, uint32_t * size) = 0;
|
||||
virtual ReturnValue_t receiveTc(uint8_t ** recvBuffer, size_t * size) = 0;
|
||||
|
||||
/**
|
||||
* Handle Telemetry. Default implementation provided.
|
||||
@ -93,14 +103,14 @@ protected:
|
||||
* @param dataLen
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t sendTm(const uint8_t * data, uint32_t dataLen) = 0;
|
||||
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) = 0;
|
||||
|
||||
/**
|
||||
* Store data to be sent later if communication link is not up.
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t storeDownlinkData(TmTcMessage * message);
|
||||
virtual ReturnValue_t storeDownlinkData(TmTcMessage * message);
|
||||
|
||||
/**
|
||||
* Send stored data if communication link is active
|
||||
@ -113,16 +123,11 @@ protected:
|
||||
* @param data
|
||||
* @param dataLen
|
||||
*/
|
||||
void printData(uint8_t * data, uint32_t dataLen);
|
||||
void printData(uint8_t * data, size_t dataLen);
|
||||
|
||||
private:
|
||||
static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20;
|
||||
static constexpr uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10;
|
||||
static constexpr uint8_t MAX_DOWNLINK_PACKETS_STORED = 15;
|
||||
|
||||
FIFO<store_address_t, MAX_DOWNLINK_PACKETS_STORED> fifo;
|
||||
uint8_t * recvBuffer = nullptr;
|
||||
uint32_t size = 0;
|
||||
uint8_t sentPacketsPerCycle = 10;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user