1
0
forked from fsfw/fsfw

more refactoring

This commit is contained in:
2020-10-28 02:20:12 +01:00
parent ce322ed121
commit 546db47db4
10 changed files with 241 additions and 254 deletions

View File

@ -1,8 +1,8 @@
#ifndef TCPACKETSTORED_H_
#define TCPACKETSTORED_H_
#ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_
#define TMTCPACKET_PUS_TCPACKETSTORED_H_
#include "../../storagemanager/StorageManagerIF.h"
#include "TcPacketBase.h"
#include "../../storagemanager/StorageManagerIF.h"
/**
* This class generates a ECSS PUS Telecommand packet within a given
@ -15,26 +15,6 @@
* @ingroup tmtcpackets
*/
class TcPacketStored : public TcPacketBase {
private:
/**
* This is a pointer to the store all instances of the class use.
* If the store is not yet set (i.e. \c store is NULL), every constructor
* call tries to set it and throws an error message in case of failures.
* The default store is objects::TC_STORE.
*/
static StorageManagerIF* store;
/**
* 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();
public:
/**
* This is a default constructor which does not set the data pointer.
@ -53,20 +33,20 @@ public:
* a new PUS Telecommand Packet is created there.
* Packet Application Data passed in data is copied into the packet.
* @param apid Sets the packet's APID field.
* @param ack Set's the packet's Ack field,
* which specifies number and size of verification packets returned
* for this command.
* @param service Sets the packet's Service ID field.
* This specifies the destination service.
* This specifies the destination service.
* @param subservice Sets the packet's Service Subtype field.
* This specifies the destination sub-service.
* @param sequence_count Sets the packet's Source Sequence Count field.
* This specifies the destination sub-service.
* @param sequence_count Sets the packet's Source Sequence Count field.
* @param data The data to be copied to the Application Data Field.
* @param size The amount of data to be copied.
* @param ack Set's the packet's Ack field, which specifies
* number of verification packets returned
* for this command.
*/
TcPacketStored( uint8_t service, uint8_t subservice, uint16_t apid,
TcPacketStored(uint16_t apid, uint8_t service, uint8_t subservice,
uint8_t sequence_count = 0, const uint8_t* data = nullptr,
size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL );
size_t size = 0, uint8_t ack = TcPacketBase::AckField::ACK_ALL);
/**
* Another constructor to create a TcPacket from a raw packet stream.
* Takes the data and adds it unchecked to the TcStore.
@ -110,7 +90,28 @@ public:
* store or size is incorrect.
*/
bool isSizeCorrect();
private:
/**
* This is a pointer to the store all instances of the class use.
* If the store is not yet set (i.e. @c store is NULL), every constructor
* call tries to set it and throws an error message in case of failures.
* The default store is objects::TC_STORE.
*/
static StorageManagerIF* store;
/**
* 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();
};
#endif /* TCPACKETSTORED_H_ */
#endif /* TMTCPACKET_PUS_TCPACKETSTORED_H_ */