form improvements

This commit is contained in:
Robin Müller 2020-10-07 20:47:46 +02:00
parent 6e9db0d675
commit 2364c4f9a4
2 changed files with 33 additions and 21 deletions

View File

@ -1,8 +1,9 @@
#include "TmPacketStored.h"
#include "../../objectmanager/ObjectManagerIF.h" #include "../../objectmanager/ObjectManagerIF.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
#include "../../tmtcpacket/pus/TmPacketStored.h"
#include "../../tmtcservices/TmTcMessage.h" #include "../../tmtcservices/TmTcMessage.h"
#include <string.h> #include <cstring>
TmPacketStored::TmPacketStored(store_address_t setAddress) : TmPacketStored::TmPacketStored(store_address_t setAddress) :
TmPacketBase(NULL), storeAddress(setAddress) { TmPacketBase(NULL), storeAddress(setAddress) {
@ -11,7 +12,7 @@ TmPacketStored::TmPacketStored(store_address_t setAddress) :
TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service,
uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data, uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data,
uint32_t size, const uint8_t *headerData, uint32_t headerSize) : size_t size, const uint8_t *headerData, size_t headerSize) :
TmPacketBase(NULL) { TmPacketBase(NULL) {
storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
if (!checkAndSetStore()) { if (!checkAndSetStore()) {

View File

@ -1,9 +1,9 @@
#ifndef TMPACKETSTORED_H_ #ifndef FSFW_TMTCPACKET_TMPACKETSTORED_H_
#define TMPACKETSTORED_H_ #define FSFW_TMTCPACKET_TMPACKETSTORED_H_
#include "TmPacketBase.h"
#include "../../serialize/SerializeIF.h" #include "../../serialize/SerializeIF.h"
#include "../../storagemanager/StorageManagerIF.h" #include "../../storagemanager/StorageManagerIF.h"
#include "../../tmtcpacket/pus/TmPacketBase.h"
#include "../../internalError/InternalErrorReporterIF.h" #include "../../internalError/InternalErrorReporterIF.h"
#include "../../ipc/MessageQueueSenderIF.h" #include "../../ipc/MessageQueueSenderIF.h"
@ -21,7 +21,7 @@ class TmPacketStored : public TmPacketBase {
private: private:
/** /**
* This is a pointer to the store all instances of the class use. * 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 * 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. * call tries to set it and throws an error message in case of failures.
* The default store is objects::TM_STORE. * The default store is objects::TM_STORE.
*/ */
@ -37,8 +37,8 @@ private:
* A helper method to check if a store is assigned to the class. * 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 * If not, the method tries to retrieve the store from the global
* ObjectManager. * ObjectManager.
* @return @li \c true if the store is linked or could be created. * @return @li @c true if the store is linked or could be created.
* @li \c false otherwise. * @li @c false otherwise.
*/ */
bool checkAndSetStore(); bool checkAndSetStore();
@ -52,8 +52,9 @@ public:
/** /**
* With this constructor, new space is allocated in the packet store and * With this constructor, new space is allocated in the packet store and
* a new PUS Telemetry Packet is created there. * a new PUS Telemetry Packet is created there.
* Packet Application Data passed in data is copied into the packet. The Application data is * Packet Application Data passed in data is copied into the packet.
* passed in two parts, first a header, then a data field. This allows building a Telemetry * The Application data is passed in two parts, first a header, then a
* data field. This allows building a Telemetry
* Packet from two separate data sources. * Packet from two separate data sources.
* @param apid Sets the packet's APID field. * @param apid Sets the packet's APID field.
* @param service Sets the packet's Service ID field. * @param service Sets the packet's Service ID field.
@ -61,20 +62,29 @@ public:
* @param subservice Sets the packet's Service Subtype field. * @param subservice Sets the packet's Service Subtype field.
* This specifies the source sub-service. * This specifies the source sub-service.
* @param packet_counter Sets the Packet counter field of this packet * @param packet_counter Sets the Packet counter field of this packet
* @param data The payload data to be copied to the Application Data Field * @param data The payload data to be copied to the Application
* Data Field
* @param size The amount of data to be copied. * @param size The amount of data to be copied.
* @param headerData The header Data of the Application field; will be copied in front of data * @param headerData The header Data of the Application field; will be
* copied in front of data
* @param headerSize The size of the headerDataF * @param headerSize The size of the headerDataF
*/ */
TmPacketStored( uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packet_counter = 0, const uint8_t* data = NULL, uint32_t size = 0, const uint8_t* headerData = NULL, uint32_t headerSize = 0); TmPacketStored(uint16_t apid, uint8_t service, uint8_t subservice,
uint8_t packet_counter = 0, const uint8_t* data = nullptr,
size_t size = 0, const uint8_t* headerData = nullptr,
size_t headerSize = 0);
/** /**
* Another ctor to directly pass structured content and header data to the packet to avoid additional buffers. * Another ctor to directly pass structured content and header data to the
* packet to avoid additional buffers.
*/ */
TmPacketStored( uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packet_counter, SerializeIF* content, SerializeIF* header = NULL); TmPacketStored(uint16_t apid, uint8_t service, uint8_t subservice,
uint8_t packet_counter, SerializeIF* content,
SerializeIF* header = nullptr);
/** /**
* This is a getter for the current store address of the packet. * 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 * @return
* the packet is not linked. * The current store address. The (raw) value is
* @c StorageManagerIF::INVALID_ADDRESS if the packet is not linked.
*/ */
store_address_t getStoreAddress(); store_address_t getStoreAddress();
/** /**
@ -87,10 +97,11 @@ public:
* if the packet is a class member and used for more than one packet. * if the packet is a class member and used for more than one packet.
* @param setAddress The new packet id to link to. * @param setAddress The new packet id to link to.
*/ */
void setStoreAddress( store_address_t setAddress ); void setStoreAddress(store_address_t setAddress);
ReturnValue_t sendPacket( MessageQueueId_t destination, MessageQueueId_t sentFrom, bool doErrorReporting = true ); ReturnValue_t sendPacket(MessageQueueId_t destination,
MessageQueueId_t sentFrom, bool doErrorReporting = true);
}; };
#endif /* TMPACKETSTORED_H_ */ #endif /* FSFW_TMTCPACKET_TMPACKETSTORED_H_ */