diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index 283701711..cdd8817c2 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -2,7 +2,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" #include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 5e9d0e421..358d1faa5 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -3,7 +3,7 @@ #include "../ipc/QueueFactory.h" #include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 8632f8d71..f6281fe9e 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -4,7 +4,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index a2ce20e2e..747ed0702 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -4,7 +4,7 @@ target_sources(${LIB_FSFW_NAME} TcPacketStored.cpp TmPacketBase.cpp TmPacketMinimal.cpp - TmPacketStored.cpp + TmPacketStoredPusA.cpp TmPacketPusA.cpp TmPacketPusC.cpp TmPacketStoredBase.cpp diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index 10f37b00f..2dfef258c 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -3,13 +3,13 @@ #include "../../globalfunctions/CRC.h" #include "../../globalfunctions/arrayprinter.h" #include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../timemanager/CCSDSTime.h" #include TimeStamperIF* TmPacketBase::timeStamper = nullptr; -object_id_t TmPacketBase::timeStamperId = 0; +object_id_t TmPacketBase::timeStamperId = objects::NO_OBJECT; TmPacketBase::TmPacketBase(uint8_t* setData): SpacePacketBase(setData) { @@ -52,8 +52,10 @@ bool TmPacketBase::checkAndSetStamper() { timeStamper = objectManager->get(timeStamperId); if (timeStamper == NULL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmPacketBase::checkAndSetStamper: Stamper not found!" + sif::Warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" << std::endl; +#else + sif::printWarning("TmPacketBase::checkAndSetStamper: Stamper not found!\n"); #endif return false; } diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index aeeba2757..53ef3f4dd 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -1,71 +1,12 @@ -#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ -#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ -#include "TmPacketBase.h" -#include "TmPacketStoredBase.h" #include -#include "../../tmtcpacket/pus/TmPacketPusA.h" -#include "../../serialize/SerializeIF.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueSenderIF.h" - -/** - * This class generates a ECSS PUS Telemetry packet within a given - * intermediate storage. - * As most packets are passed between tasks with the help of a storage - * anyway, it seems logical to create a Packet-In-Storage access class - * which saves the user almost all storage handling operation. - * Packets can both be newly created with the class and be "linked" to - * packets in a store with the help of a storeAddress. - * @ingroup tmtcpackets - */ -class TmPacketStoredPusA : - public TmPacketStoredBase, - public TmPacketPusA { -public: - /** - * This is a default constructor which does not set the data pointer. - * However, it does try to set the packet store. - */ - TmPacketStoredPusA( store_address_t setAddress ); - /** - * With this constructor, new space is allocated in the packet store and - * a new PUS Telemetry Packet is created there. - * Packet Application Data passed in data is copied into the packet. - * 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. - * @param apid Sets the packet's APID field. - * @param service Sets the packet's Service ID field. - * This specifies the source service. - * @param subservice Sets the packet's Service Subtype field. - * This specifies the source sub-service. - * @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 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 headerSize The size of the headerDataF - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter = 0, const uint8_t* data = nullptr, - uint32_t size = 0, const uint8_t* headerData = nullptr, - uint32_t headerSize = 0); - /** - * Another ctor to directly pass structured content and header data to the - * packet to avoid additional buffers. - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter, SerializeIF* content, - SerializeIF* header = nullptr); - - uint8_t* getAllTmData() override; - void setDataPointer(const uint8_t* newPointer) override; - -}; +#if FSFW_USE_PUS_C_TELEMETRY == 1 +#else +#include "TmPacketStoredPusA.h" +#endif -#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ */ +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ */ diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStoredPusA.cpp similarity index 98% rename from tmtcpacket/pus/TmPacketStored.cpp rename to tmtcpacket/pus/TmPacketStoredPusA.cpp index b09f505d3..4931f8d94 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStoredPusA.cpp @@ -1,4 +1,4 @@ -#include "TmPacketStored.h" +#include "TmPacketStoredPusA.h" #include "../../objectmanager/ObjectManagerIF.h" #include "../../serviceinterface/ServiceInterfaceStream.h" diff --git a/tmtcpacket/pus/TmPacketStoredPusA.h b/tmtcpacket/pus/TmPacketStoredPusA.h new file mode 100644 index 000000000..aeeba2757 --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredPusA.h @@ -0,0 +1,71 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ + +#include "TmPacketBase.h" +#include "TmPacketStoredBase.h" +#include + +#include "../../tmtcpacket/pus/TmPacketPusA.h" +#include "../../serialize/SerializeIF.h" +#include "../../storagemanager/StorageManagerIF.h" +#include "../../internalError/InternalErrorReporterIF.h" +#include "../../ipc/MessageQueueSenderIF.h" + +/** + * This class generates a ECSS PUS Telemetry packet within a given + * intermediate storage. + * As most packets are passed between tasks with the help of a storage + * anyway, it seems logical to create a Packet-In-Storage access class + * which saves the user almost all storage handling operation. + * Packets can both be newly created with the class and be "linked" to + * packets in a store with the help of a storeAddress. + * @ingroup tmtcpackets + */ +class TmPacketStoredPusA : + public TmPacketStoredBase, + public TmPacketPusA { +public: + /** + * This is a default constructor which does not set the data pointer. + * However, it does try to set the packet store. + */ + TmPacketStoredPusA( store_address_t setAddress ); + /** + * With this constructor, new space is allocated in the packet store and + * a new PUS Telemetry Packet is created there. + * Packet Application Data passed in data is copied into the packet. + * 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. + * @param apid Sets the packet's APID field. + * @param service Sets the packet's Service ID field. + * This specifies the source service. + * @param subservice Sets the packet's Service Subtype field. + * This specifies the source sub-service. + * @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 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 headerSize The size of the headerDataF + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter = 0, const uint8_t* data = nullptr, + uint32_t size = 0, const uint8_t* headerData = nullptr, + uint32_t headerSize = 0); + /** + * Another ctor to directly pass structured content and header data to the + * packet to avoid additional buffers. + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter, SerializeIF* content, + SerializeIF* header = nullptr); + + uint8_t* getAllTmData() override; + void setDataPointer(const uint8_t* newPointer) override; + +}; + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ */ diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index bbcdcc808..147c87969 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -6,7 +6,7 @@ #include "../objectmanager/ObjectManagerIF.h" #include "../ipc/QueueFactory.h" #include "../tmtcpacket/pus/TcPacketStored.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" #include "../serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;