added getter function for tc packet stored

This commit is contained in:
Robin Müller 2020-05-19 20:29:37 +02:00
parent 331b36fe18
commit ca10020f19
2 changed files with 23 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#include <framework/objectmanager/ObjectManagerIF.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <framework/tmtcpacket/pus/TcPacketStored.h>
#include <cstring>
TcPacketStored::TcPacketStored(store_address_t setAddress) :
@ -20,6 +21,8 @@ TcPacketStored::TcPacketStored(uint8_t service, uint8_t subservice,
ReturnValue_t returnValue = this->store->getFreeElement(&this->storeAddress,
(TC_PACKET_MIN_SIZE + size), &p_data);
if (returnValue != this->store->RETURN_OK) {
sif::warning << "TcPacketStored: Could not get free element from store!"
<< std::endl;
return;
}
this->setData(p_data);
@ -30,6 +33,15 @@ TcPacketStored::TcPacketStored(uint8_t service, uint8_t subservice,
this->setErrorControl();
}
ReturnValue_t TcPacketStored::getData(const uint8_t ** dataPtr,
size_t* dataSize) {
auto result = this->store->getData(storeAddress, dataPtr, dataSize);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "TcPacketStored: Could not get data!" << std::endl;
}
return result;
}
TcPacketStored::TcPacketStored() :
TcPacketBase(NULL) {
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;

View File

@ -74,10 +74,19 @@ public:
* @param Size size of the packet.
*/
TcPacketStored( const uint8_t* data, uint32_t size);
/**
* 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);
/**
* This is a getter for the current store address of the packet.
* @return The current store address. The (raw) value is \c StorageManagerIF::INVALID_ADDRESS if
* the packet is not linked.
* @return The current store address. The (raw) value is
* @c StorageManagerIF::INVALID_ADDRESS if the packet is not linked.
*/
store_address_t getStoreAddress();
/**