2022-07-19 18:13:25 +02:00
|
|
|
#ifndef FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_
|
|
|
|
#define FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_
|
2021-12-03 15:37:49 +01:00
|
|
|
|
|
|
|
#include "../pus/tc/TcPacketStoredBase.h"
|
2022-07-19 18:13:25 +02:00
|
|
|
#include "CfdpPacket.h"
|
2021-12-03 15:37:49 +01:00
|
|
|
|
2022-07-19 18:13:25 +02:00
|
|
|
class CfdpPacketStored : public CfdpReader {
|
2022-02-02 10:29:30 +01:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create stored packet with existing data.
|
|
|
|
* @param data
|
|
|
|
* @param size
|
|
|
|
*/
|
2022-07-19 18:13:25 +02:00
|
|
|
CfdpPacketStored(const uint8_t* data, size_t size);
|
2022-02-02 10:29:30 +01:00
|
|
|
/**
|
|
|
|
* Create stored packet from existing packet in store
|
|
|
|
* @param setAddress
|
|
|
|
*/
|
2022-07-19 18:13:25 +02:00
|
|
|
explicit CfdpPacketStored(store_address_t setAddress);
|
|
|
|
CfdpPacketStored();
|
2022-02-02 10:29:30 +01:00
|
|
|
|
2022-07-19 18:13:25 +02:00
|
|
|
~CfdpPacketStored() override;
|
2022-02-02 10:29:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter function for the raw data.
|
|
|
|
* @param dataPtr [out] Pointer to the data pointer to set
|
|
|
|
* @param dataSize [out] Address of size to set.
|
|
|
|
* @return -@c RETURN_OK if data was retrieved successfully.
|
|
|
|
*/
|
|
|
|
ReturnValue_t getData(const uint8_t** dataPtr, size_t* dataSize);
|
|
|
|
|
|
|
|
void setStoreAddress(store_address_t setAddress);
|
|
|
|
|
|
|
|
store_address_t getStoreAddress();
|
|
|
|
|
|
|
|
ReturnValue_t deletePacket();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool isSizeCorrect();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* The address where the packet data of the object instance is stored.
|
|
|
|
*/
|
|
|
|
store_address_t storeAddress;
|
|
|
|
/**
|
|
|
|
* A helper method to check if a store is assigned to the class.
|
|
|
|
* If not, the method tries to retrieve the store from the global
|
|
|
|
* ObjectManager.
|
|
|
|
* @return @li @c true if the store is linked or could be created.
|
|
|
|
* @li @c false otherwise.
|
|
|
|
*/
|
|
|
|
bool checkAndSetStore();
|
2021-12-03 15:37:49 +01:00
|
|
|
};
|
|
|
|
|
2022-07-19 18:13:25 +02:00
|
|
|
#endif /* FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */
|