2022-07-26 10:21:16 +02:00
|
|
|
#ifndef FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
|
|
|
#define FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|
|
|
|
|
|
|
|
#include "TmSendHelper.h"
|
|
|
|
#include "TmStoreHelper.h"
|
2022-07-26 13:59:09 +02:00
|
|
|
#include "tmHelpers.h"
|
2022-07-26 10:21:16 +02:00
|
|
|
|
2022-07-26 11:09:57 +02:00
|
|
|
/**
|
2022-07-26 11:14:40 +02:00
|
|
|
* Wrapper class intended to help with PUS TM handling. This wrapper class also caches the current
|
|
|
|
* packet count and the service ID
|
2022-07-26 11:09:57 +02:00
|
|
|
*/
|
|
|
|
class TmStoreAndSendWrapper {
|
2022-07-26 10:21:16 +02:00
|
|
|
public:
|
2022-07-26 11:14:40 +02:00
|
|
|
TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelper& storeHelper,
|
|
|
|
TmSendHelper& sendHelper);
|
2022-07-26 11:09:57 +02:00
|
|
|
|
|
|
|
/**
|
2022-07-26 13:59:09 +02:00
|
|
|
* Prepares a TM packet with the given parameters. It will also set the default service.
|
|
|
|
* @param subservice
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
ReturnValue_t prepareTmPacket(uint8_t subservice);
|
|
|
|
/**
|
|
|
|
* Prepares a TM packet with the given parameters. It will also set the default service.
|
2022-07-26 11:09:57 +02:00
|
|
|
* @param subservice Number of subservice
|
|
|
|
* @param sourceData Custom source data
|
|
|
|
* @param sourceDataLen Lenght of data in the Packet
|
|
|
|
*/
|
2022-07-26 13:59:09 +02:00
|
|
|
ReturnValue_t prepareTmPacket(uint8_t subservice, const uint8_t* sourceData,
|
|
|
|
size_t sourceDataLen);
|
2022-07-26 11:09:57 +02:00
|
|
|
|
|
|
|
/**
|
2022-07-26 13:59:09 +02:00
|
|
|
* Prepares a TM packet with the given parameters. It will also set the default service.
|
2022-07-26 11:09:57 +02:00
|
|
|
* @param subservice Number of subservice
|
|
|
|
* @param objectId ObjectId is placed before data
|
|
|
|
* @param data Data to append to the packet
|
|
|
|
* @param dataLen Length of Data
|
|
|
|
*/
|
2022-07-26 13:59:09 +02:00
|
|
|
ReturnValue_t prepareTmPacket(uint8_t subservice,
|
|
|
|
telemetry::DataWithObjectIdPrefix& dataWithObjectId);
|
2022-07-26 11:09:57 +02:00
|
|
|
|
|
|
|
/**
|
2022-07-26 13:59:09 +02:00
|
|
|
* Prepares a TM packet with the given parameters. It will also set the default service.
|
2022-07-26 11:09:57 +02:00
|
|
|
* @param subservice Number of subservice
|
|
|
|
* @param content This is a pointer to the serialized packet
|
|
|
|
* @param header Serialize IF header which will be placed before content
|
|
|
|
*/
|
2022-07-26 13:59:09 +02:00
|
|
|
ReturnValue_t prepareTmPacket(uint8_t subservice, SerializeIF& sourceData);
|
|
|
|
|
|
|
|
ReturnValue_t storeAndSendTmPacket();
|
2022-07-26 11:09:57 +02:00
|
|
|
|
|
|
|
bool incrementSendCounter = true;
|
2022-07-26 10:21:16 +02:00
|
|
|
TmStoreHelper& storeHelper;
|
|
|
|
TmSendHelper& sendHelper;
|
|
|
|
bool delOnFailure = true;
|
2022-07-26 11:09:57 +02:00
|
|
|
uint8_t defaultService = 0;
|
|
|
|
uint16_t sendCounter = 0;
|
2022-07-26 10:21:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FSFW_TMTCSERVICES_TMSTOREANDSENDHELPER_H
|