diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index daed987a..37258cc1 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -3,7 +3,7 @@ #include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index bef7b6b1..8aec6902 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -4,7 +4,7 @@ #include "../ipc/QueueFactory.h" #include "../objectmanager/ObjectManager.h" #include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 272cc203..0c139f3a 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -5,7 +5,7 @@ #include "../objectmanager/ObjectManager.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index 5c2f734b..955a8093 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -118,11 +118,7 @@ uint16_t PUSDistributor::getIdentifier() { } ReturnValue_t PUSDistributor::initialize() { -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - currentPacket = new TcPacketStoredPusC(); -#else - currentPacket = new TcPacketStoredPusA(); -#endif + currentPacket = new TcPacketStoredPus(); if(currentPacket == nullptr) { // Should not happen, memory allocation failed! return ObjectManagerIF::CHILD_INIT_FAILED; diff --git a/tcdistribution/PUSDistributor.h b/tcdistribution/PUSDistributor.h index 0c288451..c6f863f0 100644 --- a/tcdistribution/PUSDistributor.h +++ b/tcdistribution/PUSDistributor.h @@ -5,7 +5,7 @@ #include "TcDistributor.h" #include "TcPacketCheck.h" -#include "../tmtcpacket/pus/TcPacketStored.h" +#include "../tmtcpacket/pus/tc.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tmtcservices/AcceptsTelecommandsIF.h" #include "../tmtcservices/VerificationReporter.h" @@ -52,11 +52,7 @@ protected: /** * The currently handled packet is stored here. */ -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC* currentPacket = nullptr; -#else - TcPacketStoredPusA* currentPacket = nullptr; -#endif + TcPacketStoredPus* currentPacket = nullptr; /** * With this variable, the current check status is stored to generate diff --git a/tcdistribution/TcPacketCheck.cpp b/tcdistribution/TcPacketCheck.cpp index e88305cc..dce0a458 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/tcdistribution/TcPacketCheck.cpp @@ -1,8 +1,8 @@ #include "TcPacketCheck.h" #include "../globalfunctions/CRC.h" -#include "../tmtcpacket/pus/TcPacketBase.h" -#include "../tmtcpacket/pus/TcPacketStoredBase.h" +#include "../tmtcpacket/pus/tc/TcPacketBase.h" +#include "../tmtcpacket/pus/tc/TcPacketStoredBase.h" #include "../serviceinterface/ServiceInterface.h" #include "../storagemanager/StorageManagerIF.h" #include "../tmtcservices/VerificationCodes.h" diff --git a/tmstorage/TmStorePackets.h b/tmstorage/TmStorePackets.h index 3abd0c1c..53a5d8d6 100644 --- a/tmstorage/TmStorePackets.h +++ b/tmstorage/TmStorePackets.h @@ -5,7 +5,7 @@ #include "../serialize/SerializeElement.h" #include "../serialize/SerialLinkedListAdapter.h" #include "../serialize/SerialBufferAdapter.h" -#include "../tmtcpacket/pus/TmPacketMinimal.h" +#include "../tmtcpacket/pus/tm/TmPacketMinimal.h" #include "../timemanager/TimeStamperIF.h" #include "../timemanager/CCSDSTime.h" #include "../globalfunctions/timevalOperations.h" diff --git a/tmtcpacket/packetmatcher/ApidMatcher.h b/tmtcpacket/packetmatcher/ApidMatcher.h index 4f196ac9..64f73dbf 100644 --- a/tmtcpacket/packetmatcher/ApidMatcher.h +++ b/tmtcpacket/packetmatcher/ApidMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" class ApidMatcher: public SerializeableMatcherIF { private: diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.h b/tmtcpacket/packetmatcher/PacketMatchTree.h index 54fc856c..735f0566 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.h +++ b/tmtcpacket/packetmatcher/PacketMatchTree.h @@ -4,7 +4,7 @@ #include "../../container/PlacementFactory.h" #include "../../globalfunctions/matching/MatchTree.h" #include "../../storagemanager/LocalPool.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" class PacketMatchTree: public MatchTree, public HasReturnvaluesIF { public: diff --git a/tmtcpacket/packetmatcher/ServiceMatcher.h b/tmtcpacket/packetmatcher/ServiceMatcher.h index eba23d75..57f491f3 100644 --- a/tmtcpacket/packetmatcher/ServiceMatcher.h +++ b/tmtcpacket/packetmatcher/ServiceMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../pus/tm/TmPacketMinimal.h" class ServiceMatcher: public SerializeableMatcherIF { private: diff --git a/tmtcpacket/packetmatcher/SubserviceMatcher.h b/tmtcpacket/packetmatcher/SubserviceMatcher.h index a9b6def8..80681b5d 100644 --- a/tmtcpacket/packetmatcher/SubserviceMatcher.h +++ b/tmtcpacket/packetmatcher/SubserviceMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../pus/tm/TmPacketMinimal.h" class SubServiceMatcher: public SerializeableMatcherIF { public: diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index 9340e3b1..32c80dd3 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -1,14 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TcPacketBase.cpp - TcPacketPusA.cpp - TcPacketStoredBase.cpp - TcPacketStoredPusA.cpp - - TmPacketBase.cpp - TmPacketMinimal.cpp - TmPacketStoredPusA.cpp - TmPacketStoredPusC.cpp - TmPacketPusA.cpp - TmPacketPusC.cpp - TmPacketStoredBase.cpp -) +add_subdirectory(tm) +add_subdirectory(tc) diff --git a/tmtcpacket/pus/TcPacketPusC.cpp b/tmtcpacket/pus/TcPacketPusC.cpp deleted file mode 100644 index 1f2946a8..00000000 --- a/tmtcpacket/pus/TcPacketPusC.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "TcPacketPusC.h" - - - diff --git a/tmtcpacket/pus/TcPacketPusC.h b/tmtcpacket/pus/TcPacketPusC.h deleted file mode 100644 index e965e752..00000000 --- a/tmtcpacket/pus/TcPacketPusC.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ - - - - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ */ diff --git a/tmtcpacket/pus/TcPacketStored.h b/tmtcpacket/pus/TcPacketStored.h deleted file mode 100644 index 0b6ff0f4..00000000 --- a/tmtcpacket/pus/TcPacketStored.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ - -#include - -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 -#include "TcPacketStoredPusC.h" -#else -#include "TcPacketStoredPusA.h" -#endif - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredPusC.cpp b/tmtcpacket/pus/TcPacketStoredPusC.cpp deleted file mode 100644 index 0ff2376a..00000000 --- a/tmtcpacket/pus/TcPacketStoredPusC.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "TcPacketStoredPusC.h" - diff --git a/tmtcpacket/pus/TcPacketStoredPusC.h b/tmtcpacket/pus/TcPacketStoredPusC.h deleted file mode 100644 index e8ced948..00000000 --- a/tmtcpacket/pus/TcPacketStoredPusC.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ - - - - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ */ diff --git a/tmtcpacket/pus/tc.h b/tmtcpacket/pus/tc.h new file mode 100644 index 00000000..156e49fe --- /dev/null +++ b/tmtcpacket/pus/tc.h @@ -0,0 +1,7 @@ +#ifndef FSFW_TMTCPACKET_PUS_TC_H_ +#define FSFW_TMTCPACKET_PUS_TC_H_ + +#include "tc/TcPacketStoredPus.h" +#include "tc/TcPacketPus.h" + +#endif /* FSFW_TMTCPACKET_PUS_TC_H_ */ diff --git a/tmtcpacket/pus/tc/CMakeLists.txt b/tmtcpacket/pus/tc/CMakeLists.txt new file mode 100644 index 00000000..723b7943 --- /dev/null +++ b/tmtcpacket/pus/tc/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TcPacketBase.cpp + TcPacketPus.cpp + TcPacketStoredBase.cpp + TcPacketStoredPus.cpp +) diff --git a/tmtcpacket/pus/TcPacketBase.cpp b/tmtcpacket/pus/tc/TcPacketBase.cpp similarity index 72% rename from tmtcpacket/pus/TcPacketBase.cpp rename to tmtcpacket/pus/tc/TcPacketBase.cpp index a5b6f9ce..dd576fec 100644 --- a/tmtcpacket/pus/TcPacketBase.cpp +++ b/tmtcpacket/pus/tc/TcPacketBase.cpp @@ -1,8 +1,8 @@ #include "TcPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../serviceinterface/ServiceInterface.h" #include diff --git a/tmtcpacket/pus/TcPacketBase.h b/tmtcpacket/pus/tc/TcPacketBase.h similarity index 98% rename from tmtcpacket/pus/TcPacketBase.h rename to tmtcpacket/pus/tc/TcPacketBase.h index 606975e2..f29f9b35 100644 --- a/tmtcpacket/pus/TcPacketBase.h +++ b/tmtcpacket/pus/tc/TcPacketBase.h @@ -1,7 +1,7 @@ #ifndef TMTCPACKET_PUS_TCPACKETBASE_H_ #define TMTCPACKET_PUS_TCPACKETBASE_H_ -#include "../../tmtcpacket/SpacePacketBase.h" +#include "../../../tmtcpacket/SpacePacketBase.h" #include /** diff --git a/tmtcpacket/pus/TcPacketPusA.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp similarity index 54% rename from tmtcpacket/pus/TcPacketPusA.cpp rename to tmtcpacket/pus/tc/TcPacketPus.cpp index 0ce767b4..7a184f3c 100644 --- a/tmtcpacket/pus/TcPacketPusA.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -1,39 +1,39 @@ -#include "TcPacketPusA.h" -#include "../../globalfunctions/CRC.h" +#include "TcPacketPus.h" +#include "../../../globalfunctions/CRC.h" #include -TcPacketPusA::TcPacketPusA(const uint8_t *setData): TcPacketBase(setData) { +TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { tcData = reinterpret_cast(const_cast(setData)); } -uint8_t TcPacketPusA::getService() const { - return tcData->dataField.service_type; +uint8_t TcPacketPus::getService() const { + return tcData->dataField.serviceType; } -uint8_t TcPacketPusA::getSubService() { - return tcData->dataField.service_subtype; +uint8_t TcPacketPus::getSubService() { + return tcData->dataField.serviceSubtype; } -uint8_t TcPacketPusA::getAcknowledgeFlags() { - return tcData->dataField.version_type_ack & 0b00001111; +uint8_t TcPacketPus::getAcknowledgeFlags() { + return tcData->dataField.versionTypeAck & 0b00001111; } -const uint8_t* TcPacketPusA::getApplicationData() const { +const uint8_t* TcPacketPus::getApplicationData() const { return &tcData->appData; } -uint16_t TcPacketPusA::getApplicationDataSize() { +uint16_t TcPacketPus::getApplicationDataSize() { return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; } -uint16_t TcPacketPusA::getErrorControl() { +uint16_t TcPacketPus::getErrorControl() { uint16_t size = getApplicationDataSize() + CRC_SIZE; uint8_t* p_to_buffer = &tcData->appData; return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; } -void TcPacketPusA::setErrorControl() { +void TcPacketPus::setErrorControl() { uint32_t full_size = getFullSize(); uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); uint32_t size = getApplicationDataSize(); @@ -41,35 +41,35 @@ void TcPacketPusA::setErrorControl() { (&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL } -void TcPacketPusA::setData(const uint8_t* pData) { +void TcPacketPus::setData(const uint8_t* pData) { SpacePacketBase::setData(pData); // This function is const-correct, but it was decided to keep the pointer non-const // for convenience. Therefore, cast aways constness here and then cast to packet type. tcData = reinterpret_cast(const_cast(pData)); } -uint8_t TcPacketPusA::getSecondaryHeaderFlag() { - return (tcData->dataField.version_type_ack & 0b10000000) >> 7; +uint8_t TcPacketPus::getSecondaryHeaderFlag() { + return (tcData->dataField.versionTypeAck & 0b10000000) >> 7; } -uint8_t TcPacketPusA::getPusVersionNumber() { - return (tcData->dataField.version_type_ack & 0b01110000) >> 4; +uint8_t TcPacketPus::getPusVersionNumber() { + return (tcData->dataField.versionTypeAck & 0b01110000) >> 4; } -void TcPacketPusA::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, +void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, uint8_t service, uint8_t subservice) { initSpacePacketHeader(true, true, apid, sequenceCount); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); // Data Field Header: // Set CCSDS_secondary_header_flag to 0 and version number to 001 - tcData->dataField.version_type_ack = 0b00010000; - tcData->dataField.version_type_ack |= (ack & 0x0F); - tcData->dataField.service_type = service; - tcData->dataField.service_subtype = subservice; + tcData->dataField.versionTypeAck = 0b00010000; + tcData->dataField.versionTypeAck |= (ack & 0x0F); + tcData->dataField.serviceType = service; + tcData->dataField.serviceSubtype = subservice; } -size_t TcPacketPusA::calculateFullPacketLength(size_t appDataLen) { +size_t TcPacketPus::calculateFullPacketLength(size_t appDataLen) { return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + appDataLen + TcPacketBase::CRC_SIZE; } diff --git a/tmtcpacket/pus/TcPacketPusA.h b/tmtcpacket/pus/tc/TcPacketPus.h similarity index 87% rename from tmtcpacket/pus/TcPacketPusA.h rename to tmtcpacket/pus/tc/TcPacketPus.h index 0e61d829..fb8483c5 100644 --- a/tmtcpacket/pus/TcPacketPusA.h +++ b/tmtcpacket/pus/tc/TcPacketPus.h @@ -1,7 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ -#include "../ccsds_header.h" +#include "../../../FSFW.h" +#include "../../ccsds_header.h" #include "TcPacketBase.h" #include @@ -13,10 +14,14 @@ * @ingroup tmtcpackets */ struct PUSTcDataFieldHeader { - uint8_t version_type_ack; - uint8_t service_type; - uint8_t service_subtype; - uint8_t source_id; + uint8_t versionTypeAck; + uint8_t serviceType; + uint8_t serviceSubtype; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + uint16_t sourceId; +#else + uint8_t sourceId; +#endif }; /** @@ -31,7 +36,7 @@ struct TcPacketPointer { }; -class TcPacketPusA: public TcPacketBase { +class TcPacketPus: public TcPacketBase { public: static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + 2); @@ -41,7 +46,7 @@ public: * create an empty (invalid) object by passing nullptr as the data pointer * @param setData */ - TcPacketPusA(const uint8_t* setData); + TcPacketPus(const uint8_t* setData); // Base class overrides virtual uint8_t getSecondaryHeaderFlag() override; diff --git a/tmtcpacket/pus/TcPacketStoredBase.cpp b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp similarity index 92% rename from tmtcpacket/pus/TcPacketStoredBase.cpp rename to tmtcpacket/pus/tc/TcPacketStoredBase.cpp index 629562c0..daae35f5 100644 --- a/tmtcpacket/pus/TcPacketStoredBase.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp @@ -1,8 +1,8 @@ #include "TcPacketStoredBase.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/frameworkObjects.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../objectmanager/frameworkObjects.h" #include diff --git a/tmtcpacket/pus/TcPacketStoredBase.h b/tmtcpacket/pus/tc/TcPacketStoredBase.h similarity index 96% rename from tmtcpacket/pus/TcPacketStoredBase.h rename to tmtcpacket/pus/tc/TcPacketStoredBase.h index 811123db..b7d73531 100644 --- a/tmtcpacket/pus/TcPacketStoredBase.h +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.h @@ -1,8 +1,8 @@ #ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_ #define TMTCPACKET_PUS_TCPACKETSTORED_H_ -#include -#include "../../storagemanager/StorageManagerIF.h" +#include "TcPacketStoredIF.h" +#include "../../../storagemanager/StorageManagerIF.h" /** * This class generates a ECSS PUS Telecommand packet within a given diff --git a/tmtcpacket/pus/TcPacketStoredIF.h b/tmtcpacket/pus/tc/TcPacketStoredIF.h similarity index 88% rename from tmtcpacket/pus/TcPacketStoredIF.h rename to tmtcpacket/pus/tc/TcPacketStoredIF.h index 8eb23004..3d356725 100644 --- a/tmtcpacket/pus/TcPacketStoredIF.h +++ b/tmtcpacket/pus/tc/TcPacketStoredIF.h @@ -1,9 +1,9 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ -#include "../../tmtcpacket/pus/TcPacketBase.h" -#include "../../storagemanager/storeAddress.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "TcPacketBase.h" +#include "../../../storagemanager/storeAddress.h" +#include "../../../returnvalues/HasReturnvaluesIF.h" class TcPacketStoredIF { public: diff --git a/tmtcpacket/pus/TcPacketStoredPusA.cpp b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp similarity index 78% rename from tmtcpacket/pus/TcPacketStoredPusA.cpp rename to tmtcpacket/pus/tc/TcPacketStoredPus.cpp index 7c706a1a..f098ce2b 100644 --- a/tmtcpacket/pus/TcPacketStoredPusA.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -1,11 +1,11 @@ -#include "TcPacketStoredPusA.h" +#include "TcPacketStoredPus.h" #include -TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service, +TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t sequenceCount, const uint8_t* data, size_t size, uint8_t ack) : - TcPacketPusA(nullptr) { + TcPacketPus(nullptr) { this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; if (not this->checkAndSetStore()) { return; @@ -28,14 +28,14 @@ TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service, this->setErrorControl(); } -TcPacketStoredPusA::TcPacketStoredPusA(): TcPacketStoredBase(), TcPacketPusA(nullptr) { +TcPacketStoredPus::TcPacketStoredPus(): TcPacketStoredBase(), TcPacketPus(nullptr) { } -TcPacketStoredPusA::TcPacketStoredPusA(store_address_t setAddress): TcPacketPusA(nullptr) { +TcPacketStoredPus::TcPacketStoredPus(store_address_t setAddress): TcPacketPus(nullptr) { TcPacketStoredBase::setStoreAddress(setAddress); } -TcPacketStoredPusA::TcPacketStoredPusA(const uint8_t* data, size_t size): TcPacketPusA(data) { +TcPacketStoredPus::TcPacketStoredPus(const uint8_t* data, size_t size): TcPacketPus(data) { if (this->getFullSize() != size) { return; } @@ -51,19 +51,19 @@ TcPacketStoredPusA::TcPacketStoredPusA(const uint8_t* data, size_t size): TcPack } } -ReturnValue_t TcPacketStoredPusA::deletePacket() { +ReturnValue_t TcPacketStoredPus::deletePacket() { ReturnValue_t result = this->store->deleteData(this->storeAddress); this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->setData(nullptr); return result; } -TcPacketBase* TcPacketStoredPusA::getPacketBase() { +TcPacketBase* TcPacketStoredPus::getPacketBase() { return this; } -bool TcPacketStoredPusA::isSizeCorrect() { +bool TcPacketStoredPus::isSizeCorrect() { const uint8_t* temp_data = nullptr; size_t temp_size; ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, diff --git a/tmtcpacket/pus/TcPacketStoredPusA.h b/tmtcpacket/pus/tc/TcPacketStoredPus.h similarity index 84% rename from tmtcpacket/pus/TcPacketStoredPusA.h rename to tmtcpacket/pus/tc/TcPacketStoredPus.h index fe1f64f7..8b318733 100644 --- a/tmtcpacket/pus/TcPacketStoredPusA.h +++ b/tmtcpacket/pus/tc/TcPacketStoredPus.h @@ -2,11 +2,11 @@ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ #include "TcPacketStoredBase.h" -#include "TcPacketPusA.h" +#include "TcPacketPus.h" -class TcPacketStoredPusA: +class TcPacketStoredPus: public TcPacketStoredBase, - public TcPacketPusA { + public TcPacketPus { public: /** * With this constructor, new space is allocated in the packet store and @@ -24,7 +24,7 @@ public: * number of verification packets returned * for this command. */ - TcPacketStoredPusA(uint16_t apid, uint8_t service, uint8_t subservice, + TcPacketStoredPus(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); /** @@ -32,13 +32,13 @@ public: * @param data * @param size */ - TcPacketStoredPusA(const uint8_t* data, size_t size); + TcPacketStoredPus(const uint8_t* data, size_t size); /** * Create stored packet from existing packet in store * @param setAddress */ - TcPacketStoredPusA(store_address_t setAddress); - TcPacketStoredPusA(); + TcPacketStoredPus(store_address_t setAddress); + TcPacketStoredPus(); ReturnValue_t deletePacket() override; TcPacketBase* getPacketBase() override; diff --git a/tmtcpacket/pus/tm.h b/tmtcpacket/pus/tm.h new file mode 100644 index 00000000..591ada7c --- /dev/null +++ b/tmtcpacket/pus/tm.h @@ -0,0 +1,16 @@ +#ifndef FSFW_TMTCPACKET_PUS_TM_H_ +#define FSFW_TMTCPACKET_PUS_TM_H_ + +#include "../../FSFW.h" + +#if FSFW_USE_PUS_C_TELEMETRY == 1 +#include "tm/TmPacketPusC.h" +#include "tm/TmPacketStoredPusC.h" +#else +#include "tm/TmPacketPusA.h" +#include "tm/TmPacketStoredPusA.h" +#endif + +#include "tm/TmPacketMinimal.h" + +#endif /* FSFW_TMTCPACKET_PUS_TM_H_ */ diff --git a/tmtcpacket/pus/tm/CMakeLists.txt b/tmtcpacket/pus/tm/CMakeLists.txt new file mode 100644 index 00000000..ace87820 --- /dev/null +++ b/tmtcpacket/pus/tm/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TmPacketStoredPusA.cpp + TmPacketStoredPusC.cpp + TmPacketPusA.cpp + TmPacketPusC.cpp + TmPacketStoredBase.cpp + TmPacketBase.cpp + TmPacketMinimal.cpp +) diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/tm/TmPacketBase.cpp similarity index 88% rename from tmtcpacket/pus/TmPacketBase.cpp rename to tmtcpacket/pus/tm/TmPacketBase.cpp index b144db1b..91ec7d58 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/tm/TmPacketBase.cpp @@ -1,10 +1,10 @@ #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketBase.h b/tmtcpacket/pus/tm/TmPacketBase.h similarity index 96% rename from tmtcpacket/pus/TmPacketBase.h rename to tmtcpacket/pus/tm/TmPacketBase.h index 6925e99b..9f534f29 100644 --- a/tmtcpacket/pus/TmPacketBase.h +++ b/tmtcpacket/pus/tm/TmPacketBase.h @@ -1,10 +1,10 @@ #ifndef TMTCPACKET_PUS_TMPACKETBASE_H_ #define TMTCPACKET_PUS_TMPACKETBASE_H_ -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketMinimal.cpp b/tmtcpacket/pus/tm/TmPacketMinimal.cpp similarity index 93% rename from tmtcpacket/pus/TmPacketMinimal.cpp rename to tmtcpacket/pus/tm/TmPacketMinimal.cpp index 18e9dda1..3f785cde 100644 --- a/tmtcpacket/pus/TmPacketMinimal.cpp +++ b/tmtcpacket/pus/tm/TmPacketMinimal.cpp @@ -1,7 +1,8 @@ #include "TmPacketMinimal.h" -#include -#include -#include "PacketTimestampInterpreterIF.h" +#include "../PacketTimestampInterpreterIF.h" + +#include +#include TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) { this->tm_data = (TmPacketMinimalPointer*)set_data; diff --git a/tmtcpacket/pus/TmPacketMinimal.h b/tmtcpacket/pus/tm/TmPacketMinimal.h similarity index 96% rename from tmtcpacket/pus/TmPacketMinimal.h rename to tmtcpacket/pus/tm/TmPacketMinimal.h index 728acb15..08daa584 100644 --- a/tmtcpacket/pus/TmPacketMinimal.h +++ b/tmtcpacket/pus/tm/TmPacketMinimal.h @@ -2,8 +2,8 @@ #define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_ -#include "../../tmtcpacket/SpacePacketBase.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "../../SpacePacketBase.h" +#include "../../../returnvalues/HasReturnvaluesIF.h" struct timeval; class PacketTimestampInterpreterIF; diff --git a/tmtcpacket/pus/TmPacketPusA.cpp b/tmtcpacket/pus/tm/TmPacketPusA.cpp similarity index 90% rename from tmtcpacket/pus/TmPacketPusA.cpp rename to tmtcpacket/pus/tm/TmPacketPusA.cpp index d96f6aa7..bdc0a815 100644 --- a/tmtcpacket/pus/TmPacketPusA.cpp +++ b/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -1,11 +1,11 @@ #include "TmPacketPusA.h" #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManagerIF.h" +#include "../../../serviceinterface/ServiceInterfaceStream.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketPusA.h b/tmtcpacket/pus/tm/TmPacketPusA.h similarity index 95% rename from tmtcpacket/pus/TmPacketPusA.h rename to tmtcpacket/pus/tm/TmPacketPusA.h index dd9a5d09..486b68f3 100644 --- a/tmtcpacket/pus/TmPacketPusA.h +++ b/tmtcpacket/pus/tm/TmPacketPusA.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ #include "TmPacketBase.h" -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/tm/TmPacketPusC.cpp similarity index 90% rename from tmtcpacket/pus/TmPacketPusC.cpp rename to tmtcpacket/pus/tm/TmPacketPusC.cpp index ca2bccdb..5090aaeb 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -1,11 +1,11 @@ #include "TmPacketPusC.h" #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManagerIF.h" +#include "../../../serviceinterface/ServiceInterfaceStream.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/tm/TmPacketPusC.h similarity index 95% rename from tmtcpacket/pus/TmPacketPusC.h rename to tmtcpacket/pus/tm/TmPacketPusC.h index fdc27548..97e5a9a5 100644 --- a/tmtcpacket/pus/TmPacketPusC.h +++ b/tmtcpacket/pus/tm/TmPacketPusC.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #include "TmPacketBase.h" -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/tm/TmPacketStored.h similarity index 100% rename from tmtcpacket/pus/TmPacketStored.h rename to tmtcpacket/pus/tm/TmPacketStored.h diff --git a/tmtcpacket/pus/TmPacketStoredBase.cpp b/tmtcpacket/pus/tm/TmPacketStoredBase.cpp similarity index 94% rename from tmtcpacket/pus/TmPacketStoredBase.cpp rename to tmtcpacket/pus/tm/TmPacketStoredBase.cpp index eeaa938d..ba8b15d1 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -1,8 +1,8 @@ #include "TmPacketStoredBase.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredBase.h b/tmtcpacket/pus/tm/TmPacketStoredBase.h similarity index 91% rename from tmtcpacket/pus/TmPacketStoredBase.h rename to tmtcpacket/pus/tm/TmPacketStoredBase.h index dd7e31eb..1bc092dd 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.h +++ b/tmtcpacket/pus/tm/TmPacketStoredBase.h @@ -1,15 +1,15 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ +#include "../../../FSFW.h" #include "TmPacketBase.h" #include "TmPacketStoredBase.h" -#include +#include "TmPacketPusA.h" -#include "../../tmtcpacket/pus/TmPacketPusA.h" -#include "../../serialize/SerializeIF.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueSenderIF.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 diff --git a/tmtcpacket/pus/TmPacketStoredPusA.cpp b/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp similarity index 95% rename from tmtcpacket/pus/TmPacketStoredPusA.cpp rename to tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 68102b62..02fb77ef 100644 --- a/tmtcpacket/pus/TmPacketStoredPusA.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -1,7 +1,7 @@ #include "TmPacketStoredPusA.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredPusA.h b/tmtcpacket/pus/tm/TmPacketStoredPusA.h similarity index 100% rename from tmtcpacket/pus/TmPacketStoredPusA.h rename to tmtcpacket/pus/tm/TmPacketStoredPusA.h diff --git a/tmtcpacket/pus/TmPacketStoredPusC.cpp b/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp similarity index 96% rename from tmtcpacket/pus/TmPacketStoredPusC.cpp rename to tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index 7f774411..6f8f7fa2 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -1,7 +1,7 @@ #include "TmPacketStoredPusC.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredPusC.h b/tmtcpacket/pus/tm/TmPacketStoredPusC.h similarity index 96% rename from tmtcpacket/pus/TmPacketStoredPusC.h rename to tmtcpacket/pus/tm/TmPacketStoredPusC.h index 883dc0ff..35c66083 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.h +++ b/tmtcpacket/pus/tm/TmPacketStoredPusC.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ -#include -#include +#include "TmPacketPusC.h" +#include "TmPacketStoredBase.h" /** * This class generates a ECSS PUS C Telemetry packet within a given diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 0ede27dc..b416ffbe 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -6,8 +6,8 @@ #include "../tcdistribution/PUSDistributorIF.h" #include "../objectmanager/ObjectManager.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TcPacketStored.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tc.h" +#include "../tmtcpacket/pus/tm.h" #include "../serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; @@ -246,11 +246,7 @@ void CommandingServiceBase::handleRequestQueue() { TmTcMessage message; ReturnValue_t result; store_address_t address; -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC packet; -#else - TcPacketStoredPusA packet; -#endif + TcPacketStoredPus packet; MessageQueueId_t queue; object_id_t objectId; for (result = requestQueue->receiveMessage(&message); result == RETURN_OK; @@ -436,11 +432,7 @@ void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) { if (iter->second.fifo.retrieve(&address) != RETURN_OK) { commandMap.erase(&iter); } else { -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC newPacket(address); -#else - TcPacketStoredPusA newPacket(address); -#endif + TcPacketStoredPus newPacket(address); startExecution(&newPacket, iter); } } diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index 46191bd5..4ee4a21a 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -1,7 +1,6 @@ #ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ -#include #include "AcceptsTelecommandsIF.h" #include "VerificationReporter.h" @@ -17,6 +16,7 @@ #include class TcPacketStored; +class TcPacketStoredBase; namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcservices/PusServiceBase.h b/tmtcservices/PusServiceBase.h index f48612b1..6cde6fb4 100644 --- a/tmtcservices/PusServiceBase.h +++ b/tmtcservices/PusServiceBase.h @@ -9,7 +9,7 @@ #include "../objectmanager/SystemObject.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tasks/ExecutableObjectIF.h" -#include "../tmtcpacket/pus/TcPacketStored.h" +#include "../tmtcpacket/pus/tc.h" #include "../ipc/MessageQueueIF.h" namespace Factory{ @@ -141,11 +141,7 @@ protected: * The current Telecommand to be processed. * It is deleted after handleRequest was executed. */ -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC currentPacket; -#else - TcPacketStoredPusA currentPacket; -#endif + TcPacketStoredPus currentPacket; static object_id_t packetSource; diff --git a/tmtcservices/PusVerificationReport.h b/tmtcservices/PusVerificationReport.h index 9dce95ac..0e1732ef 100644 --- a/tmtcservices/PusVerificationReport.h +++ b/tmtcservices/PusVerificationReport.h @@ -4,7 +4,7 @@ #include "VerificationCodes.h" #include "../ipc/MessageQueueMessage.h" -#include "../tmtcpacket/pus/TcPacketBase.h" +#include "../tmtcpacket/pus/tc/TcPacketBase.h" #include "../returnvalues/HasReturnvaluesIF.h" class PusVerificationMessage: public MessageQueueMessage {