cleaned up a bit

This commit is contained in:
Robin Müller 2021-06-14 10:19:01 +02:00
parent dadba69272
commit 56d2af9d25
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
49 changed files with 173 additions and 196 deletions

View File

@ -3,7 +3,7 @@
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
#include "../objectmanager/SystemObject.h" #include "../objectmanager/SystemObject.h"
#include "../tmtcpacket/pus/TmPacketStored.h" #include "../tmtcpacket/pus/tm/TmPacketStored.h"
Service17Test::Service17Test(object_id_t objectId, Service17Test::Service17Test(object_id_t objectId,

View File

@ -4,7 +4,7 @@
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
#include "../objectmanager/ObjectManager.h" #include "../objectmanager/ObjectManager.h"
#include "../tmtcservices/PusVerificationReport.h" #include "../tmtcservices/PusVerificationReport.h"
#include "../tmtcpacket/pus/TmPacketStored.h" #include "../tmtcpacket/pus/tm/TmPacketStored.h"
#include "../serviceinterface/ServiceInterfaceStream.h" #include "../serviceinterface/ServiceInterfaceStream.h"
#include "../tmtcservices/AcceptsTelemetryIF.h" #include "../tmtcservices/AcceptsTelemetryIF.h"

View File

@ -5,7 +5,7 @@
#include "../objectmanager/ObjectManager.h" #include "../objectmanager/ObjectManager.h"
#include "../events/EventManagerIF.h" #include "../events/EventManagerIF.h"
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
#include "../tmtcpacket/pus/TmPacketStored.h" #include "../tmtcpacket/pus/tm/TmPacketStored.h"
Service5EventReporting::Service5EventReporting(object_id_t objectId, Service5EventReporting::Service5EventReporting(object_id_t objectId,

View File

@ -118,11 +118,7 @@ uint16_t PUSDistributor::getIdentifier() {
} }
ReturnValue_t PUSDistributor::initialize() { ReturnValue_t PUSDistributor::initialize() {
#if FSFW_USE_PUS_C_TELECOMMANDS == 1 currentPacket = new TcPacketStoredPus();
currentPacket = new TcPacketStoredPusC();
#else
currentPacket = new TcPacketStoredPusA();
#endif
if(currentPacket == nullptr) { if(currentPacket == nullptr) {
// Should not happen, memory allocation failed! // Should not happen, memory allocation failed!
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;

View File

@ -5,7 +5,7 @@
#include "TcDistributor.h" #include "TcDistributor.h"
#include "TcPacketCheck.h" #include "TcPacketCheck.h"
#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcpacket/pus/tc.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../tmtcservices/AcceptsTelecommandsIF.h" #include "../tmtcservices/AcceptsTelecommandsIF.h"
#include "../tmtcservices/VerificationReporter.h" #include "../tmtcservices/VerificationReporter.h"
@ -52,11 +52,7 @@ protected:
/** /**
* The currently handled packet is stored here. * The currently handled packet is stored here.
*/ */
#if FSFW_USE_PUS_C_TELECOMMANDS == 1 TcPacketStoredPus* currentPacket = nullptr;
TcPacketStoredPusC* currentPacket = nullptr;
#else
TcPacketStoredPusA* currentPacket = nullptr;
#endif
/** /**
* With this variable, the current check status is stored to generate * With this variable, the current check status is stored to generate

View File

@ -1,8 +1,8 @@
#include "TcPacketCheck.h" #include "TcPacketCheck.h"
#include "../globalfunctions/CRC.h" #include "../globalfunctions/CRC.h"
#include "../tmtcpacket/pus/TcPacketBase.h" #include "../tmtcpacket/pus/tc/TcPacketBase.h"
#include "../tmtcpacket/pus/TcPacketStoredBase.h" #include "../tmtcpacket/pus/tc/TcPacketStoredBase.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
#include "../storagemanager/StorageManagerIF.h" #include "../storagemanager/StorageManagerIF.h"
#include "../tmtcservices/VerificationCodes.h" #include "../tmtcservices/VerificationCodes.h"

View File

@ -5,7 +5,7 @@
#include "../serialize/SerializeElement.h" #include "../serialize/SerializeElement.h"
#include "../serialize/SerialLinkedListAdapter.h" #include "../serialize/SerialLinkedListAdapter.h"
#include "../serialize/SerialBufferAdapter.h" #include "../serialize/SerialBufferAdapter.h"
#include "../tmtcpacket/pus/TmPacketMinimal.h" #include "../tmtcpacket/pus/tm/TmPacketMinimal.h"
#include "../timemanager/TimeStamperIF.h" #include "../timemanager/TimeStamperIF.h"
#include "../timemanager/CCSDSTime.h" #include "../timemanager/CCSDSTime.h"
#include "../globalfunctions/timevalOperations.h" #include "../globalfunctions/timevalOperations.h"

View File

@ -3,7 +3,7 @@
#include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../globalfunctions/matching/SerializeableMatcherIF.h"
#include "../../serialize/SerializeAdapter.h" #include "../../serialize/SerializeAdapter.h"
#include "../../tmtcpacket/pus/TmPacketMinimal.h" #include "../../tmtcpacket/pus/tm/TmPacketMinimal.h"
class ApidMatcher: public SerializeableMatcherIF<TmPacketMinimal*> { class ApidMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
private: private:

View File

@ -4,7 +4,7 @@
#include "../../container/PlacementFactory.h" #include "../../container/PlacementFactory.h"
#include "../../globalfunctions/matching/MatchTree.h" #include "../../globalfunctions/matching/MatchTree.h"
#include "../../storagemanager/LocalPool.h" #include "../../storagemanager/LocalPool.h"
#include "../../tmtcpacket/pus/TmPacketMinimal.h" #include "../../tmtcpacket/pus/tm/TmPacketMinimal.h"
class PacketMatchTree: public MatchTree<TmPacketMinimal*>, public HasReturnvaluesIF { class PacketMatchTree: public MatchTree<TmPacketMinimal*>, public HasReturnvaluesIF {
public: public:

View File

@ -3,7 +3,7 @@
#include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../globalfunctions/matching/SerializeableMatcherIF.h"
#include "../../serialize/SerializeAdapter.h" #include "../../serialize/SerializeAdapter.h"
#include "../../tmtcpacket/pus/TmPacketMinimal.h" #include "../pus/tm/TmPacketMinimal.h"
class ServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> { class ServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
private: private:

View File

@ -3,7 +3,7 @@
#include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../globalfunctions/matching/SerializeableMatcherIF.h"
#include "../../serialize/SerializeAdapter.h" #include "../../serialize/SerializeAdapter.h"
#include "../../tmtcpacket/pus/TmPacketMinimal.h" #include "../pus/tm/TmPacketMinimal.h"
class SubServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> { class SubServiceMatcher: public SerializeableMatcherIF<TmPacketMinimal*> {
public: public:

View File

@ -1,14 +1,2 @@
target_sources(${LIB_FSFW_NAME} PRIVATE add_subdirectory(tm)
TcPacketBase.cpp add_subdirectory(tc)
TcPacketPusA.cpp
TcPacketStoredBase.cpp
TcPacketStoredPusA.cpp
TmPacketBase.cpp
TmPacketMinimal.cpp
TmPacketStoredPusA.cpp
TmPacketStoredPusC.cpp
TmPacketPusA.cpp
TmPacketPusC.cpp
TmPacketStoredBase.cpp
)

View File

@ -1,4 +0,0 @@
#include "TcPacketPusC.h"

View File

@ -1,8 +0,0 @@
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_
#define FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_
#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ */

View File

@ -1,13 +0,0 @@
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_
#define FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_
#include <FSFWConfig.h>
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
#include "TcPacketStoredPusC.h"
#else
#include "TcPacketStoredPusA.h"
#endif
#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ */

View File

@ -1,2 +0,0 @@
#include "TcPacketStoredPusC.h"

View File

@ -1,8 +0,0 @@
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_
#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_
#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ */

7
tmtcpacket/pus/tc.h Normal file
View File

@ -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_ */

View File

@ -0,0 +1,6 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TcPacketBase.cpp
TcPacketPus.cpp
TcPacketStoredBase.cpp
TcPacketStoredPus.cpp
)

View File

@ -1,8 +1,8 @@
#include "TcPacketBase.h" #include "TcPacketBase.h"
#include "../../globalfunctions/CRC.h" #include "../../../globalfunctions/CRC.h"
#include "../../globalfunctions/arrayprinter.h" #include "../../../globalfunctions/arrayprinter.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include <cstring> #include <cstring>

View File

@ -1,7 +1,7 @@
#ifndef TMTCPACKET_PUS_TCPACKETBASE_H_ #ifndef TMTCPACKET_PUS_TCPACKETBASE_H_
#define TMTCPACKET_PUS_TCPACKETBASE_H_ #define TMTCPACKET_PUS_TCPACKETBASE_H_
#include "../../tmtcpacket/SpacePacketBase.h" #include "../../../tmtcpacket/SpacePacketBase.h"
#include <cstddef> #include <cstddef>
/** /**

View File

@ -1,39 +1,39 @@
#include "TcPacketPusA.h" #include "TcPacketPus.h"
#include "../../globalfunctions/CRC.h" #include "../../../globalfunctions/CRC.h"
#include <cstring> #include <cstring>
TcPacketPusA::TcPacketPusA(const uint8_t *setData): TcPacketBase(setData) { TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) {
tcData = reinterpret_cast<TcPacketPointer*>(const_cast<uint8_t*>(setData)); tcData = reinterpret_cast<TcPacketPointer*>(const_cast<uint8_t*>(setData));
} }
uint8_t TcPacketPusA::getService() const { uint8_t TcPacketPus::getService() const {
return tcData->dataField.service_type; return tcData->dataField.serviceType;
} }
uint8_t TcPacketPusA::getSubService() { uint8_t TcPacketPus::getSubService() {
return tcData->dataField.service_subtype; return tcData->dataField.serviceSubtype;
} }
uint8_t TcPacketPusA::getAcknowledgeFlags() { uint8_t TcPacketPus::getAcknowledgeFlags() {
return tcData->dataField.version_type_ack & 0b00001111; return tcData->dataField.versionTypeAck & 0b00001111;
} }
const uint8_t* TcPacketPusA::getApplicationData() const { const uint8_t* TcPacketPus::getApplicationData() const {
return &tcData->appData; return &tcData->appData;
} }
uint16_t TcPacketPusA::getApplicationDataSize() { uint16_t TcPacketPus::getApplicationDataSize() {
return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1;
} }
uint16_t TcPacketPusA::getErrorControl() { uint16_t TcPacketPus::getErrorControl() {
uint16_t size = getApplicationDataSize() + CRC_SIZE; uint16_t size = getApplicationDataSize() + CRC_SIZE;
uint8_t* p_to_buffer = &tcData->appData; uint8_t* p_to_buffer = &tcData->appData;
return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1];
} }
void TcPacketPusA::setErrorControl() { void TcPacketPus::setErrorControl() {
uint32_t full_size = getFullSize(); uint32_t full_size = getFullSize();
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
uint32_t size = getApplicationDataSize(); uint32_t size = getApplicationDataSize();
@ -41,35 +41,35 @@ void TcPacketPusA::setErrorControl() {
(&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL (&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL
} }
void TcPacketPusA::setData(const uint8_t* pData) { void TcPacketPus::setData(const uint8_t* pData) {
SpacePacketBase::setData(pData); SpacePacketBase::setData(pData);
// This function is const-correct, but it was decided to keep the pointer non-const // 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. // for convenience. Therefore, cast aways constness here and then cast to packet type.
tcData = reinterpret_cast<TcPacketPointer*>(const_cast<uint8_t*>(pData)); tcData = reinterpret_cast<TcPacketPointer*>(const_cast<uint8_t*>(pData));
} }
uint8_t TcPacketPusA::getSecondaryHeaderFlag() { uint8_t TcPacketPus::getSecondaryHeaderFlag() {
return (tcData->dataField.version_type_ack & 0b10000000) >> 7; return (tcData->dataField.versionTypeAck & 0b10000000) >> 7;
} }
uint8_t TcPacketPusA::getPusVersionNumber() { uint8_t TcPacketPus::getPusVersionNumber() {
return (tcData->dataField.version_type_ack & 0b01110000) >> 4; 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) { uint8_t ack, uint8_t service, uint8_t subservice) {
initSpacePacketHeader(true, true, apid, sequenceCount); initSpacePacketHeader(true, true, apid, sequenceCount);
std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField));
setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
// Data Field Header: // Data Field Header:
// Set CCSDS_secondary_header_flag to 0 and version number to 001 // Set CCSDS_secondary_header_flag to 0 and version number to 001
tcData->dataField.version_type_ack = 0b00010000; tcData->dataField.versionTypeAck = 0b00010000;
tcData->dataField.version_type_ack |= (ack & 0x0F); tcData->dataField.versionTypeAck |= (ack & 0x0F);
tcData->dataField.service_type = service; tcData->dataField.serviceType = service;
tcData->dataField.service_subtype = subservice; tcData->dataField.serviceSubtype = subservice;
} }
size_t TcPacketPusA::calculateFullPacketLength(size_t appDataLen) { size_t TcPacketPus::calculateFullPacketLength(size_t appDataLen) {
return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) +
appDataLen + TcPacketBase::CRC_SIZE; appDataLen + TcPacketBase::CRC_SIZE;
} }

View File

@ -1,7 +1,8 @@
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_
#define 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 "TcPacketBase.h"
#include <cstdint> #include <cstdint>
@ -13,10 +14,14 @@
* @ingroup tmtcpackets * @ingroup tmtcpackets
*/ */
struct PUSTcDataFieldHeader { struct PUSTcDataFieldHeader {
uint8_t version_type_ack; uint8_t versionTypeAck;
uint8_t service_type; uint8_t serviceType;
uint8_t service_subtype; uint8_t serviceSubtype;
uint8_t source_id; #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: public:
static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) +
sizeof(PUSTcDataFieldHeader) + 2); sizeof(PUSTcDataFieldHeader) + 2);
@ -41,7 +46,7 @@ public:
* create an empty (invalid) object by passing nullptr as the data pointer * create an empty (invalid) object by passing nullptr as the data pointer
* @param setData * @param setData
*/ */
TcPacketPusA(const uint8_t* setData); TcPacketPus(const uint8_t* setData);
// Base class overrides // Base class overrides
virtual uint8_t getSecondaryHeaderFlag() override; virtual uint8_t getSecondaryHeaderFlag() override;

View File

@ -1,8 +1,8 @@
#include "TcPacketStoredBase.h" #include "TcPacketStoredBase.h"
#include "../../objectmanager/ObjectManager.h" #include "../../../objectmanager/ObjectManager.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include "../../objectmanager/frameworkObjects.h" #include "../../../objectmanager/frameworkObjects.h"
#include <cstring> #include <cstring>

View File

@ -1,8 +1,8 @@
#ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_ #ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_
#define TMTCPACKET_PUS_TCPACKETSTORED_H_ #define TMTCPACKET_PUS_TCPACKETSTORED_H_
#include <fsfw/tmtcpacket/pus/TcPacketStoredIF.h> #include "TcPacketStoredIF.h"
#include "../../storagemanager/StorageManagerIF.h" #include "../../../storagemanager/StorageManagerIF.h"
/** /**
* This class generates a ECSS PUS Telecommand packet within a given * This class generates a ECSS PUS Telecommand packet within a given

View File

@ -1,9 +1,9 @@
#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_
#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_
#include "../../tmtcpacket/pus/TcPacketBase.h" #include "TcPacketBase.h"
#include "../../storagemanager/storeAddress.h" #include "../../../storagemanager/storeAddress.h"
#include "../../returnvalues/HasReturnvaluesIF.h" #include "../../../returnvalues/HasReturnvaluesIF.h"
class TcPacketStoredIF { class TcPacketStoredIF {
public: public:

View File

@ -1,11 +1,11 @@
#include "TcPacketStoredPusA.h" #include "TcPacketStoredPus.h"
#include <cstring> #include <cstring>
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, uint8_t subservice, uint8_t sequenceCount, const uint8_t* data,
size_t size, uint8_t ack) : size_t size, uint8_t ack) :
TcPacketPusA(nullptr) { TcPacketPus(nullptr) {
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
if (not this->checkAndSetStore()) { if (not this->checkAndSetStore()) {
return; return;
@ -28,14 +28,14 @@ TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service,
this->setErrorControl(); 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); 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) { if (this->getFullSize() != size) {
return; 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); ReturnValue_t result = this->store->deleteData(this->storeAddress);
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
this->setData(nullptr); this->setData(nullptr);
return result; return result;
} }
TcPacketBase* TcPacketStoredPusA::getPacketBase() { TcPacketBase* TcPacketStoredPus::getPacketBase() {
return this; return this;
} }
bool TcPacketStoredPusA::isSizeCorrect() { bool TcPacketStoredPus::isSizeCorrect() {
const uint8_t* temp_data = nullptr; const uint8_t* temp_data = nullptr;
size_t temp_size; size_t temp_size;
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data,

View File

@ -2,11 +2,11 @@
#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_
#include "TcPacketStoredBase.h" #include "TcPacketStoredBase.h"
#include "TcPacketPusA.h" #include "TcPacketPus.h"
class TcPacketStoredPusA: class TcPacketStoredPus:
public TcPacketStoredBase, public TcPacketStoredBase,
public TcPacketPusA { public TcPacketPus {
public: 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
@ -24,7 +24,7 @@ public:
* number of verification packets returned * number of verification packets returned
* for this command. * 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, 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::ACK_ALL);
/** /**
@ -32,13 +32,13 @@ public:
* @param data * @param data
* @param size * @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 * Create stored packet from existing packet in store
* @param setAddress * @param setAddress
*/ */
TcPacketStoredPusA(store_address_t setAddress); TcPacketStoredPus(store_address_t setAddress);
TcPacketStoredPusA(); TcPacketStoredPus();
ReturnValue_t deletePacket() override; ReturnValue_t deletePacket() override;
TcPacketBase* getPacketBase() override; TcPacketBase* getPacketBase() override;

16
tmtcpacket/pus/tm.h Normal file
View File

@ -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_ */

View File

@ -0,0 +1,9 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TmPacketStoredPusA.cpp
TmPacketStoredPusC.cpp
TmPacketPusA.cpp
TmPacketPusC.cpp
TmPacketStoredBase.cpp
TmPacketBase.cpp
TmPacketMinimal.cpp
)

View File

@ -1,10 +1,10 @@
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "../../globalfunctions/CRC.h" #include "../../../globalfunctions/CRC.h"
#include "../../globalfunctions/arrayprinter.h" #include "../../../globalfunctions/arrayprinter.h"
#include "../../objectmanager/ObjectManager.h" #include "../../../objectmanager/ObjectManager.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include "../../timemanager/CCSDSTime.h" #include "../../../timemanager/CCSDSTime.h"
#include <cstring> #include <cstring>

View File

@ -1,10 +1,10 @@
#ifndef TMTCPACKET_PUS_TMPACKETBASE_H_ #ifndef TMTCPACKET_PUS_TMPACKETBASE_H_
#define TMTCPACKET_PUS_TMPACKETBASE_H_ #define TMTCPACKET_PUS_TMPACKETBASE_H_
#include "../SpacePacketBase.h" #include "../../SpacePacketBase.h"
#include "../../timemanager/TimeStamperIF.h" #include "../../../timemanager/TimeStamperIF.h"
#include "../../timemanager/Clock.h" #include "../../../timemanager/Clock.h"
#include "../../objectmanager/SystemObjectIF.h" #include "../../../objectmanager/SystemObjectIF.h"
namespace Factory{ namespace Factory{
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();

View File

@ -1,7 +1,8 @@
#include "TmPacketMinimal.h" #include "TmPacketMinimal.h"
#include <stddef.h> #include "../PacketTimestampInterpreterIF.h"
#include <time.h>
#include "PacketTimestampInterpreterIF.h" #include <cstddef>
#include <ctime>
TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) { TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) {
this->tm_data = (TmPacketMinimalPointer*)set_data; this->tm_data = (TmPacketMinimalPointer*)set_data;

View File

@ -2,8 +2,8 @@
#define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_ #define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
#include "../../tmtcpacket/SpacePacketBase.h" #include "../../SpacePacketBase.h"
#include "../../returnvalues/HasReturnvaluesIF.h" #include "../../../returnvalues/HasReturnvaluesIF.h"
struct timeval; struct timeval;
class PacketTimestampInterpreterIF; class PacketTimestampInterpreterIF;

View File

@ -1,11 +1,11 @@
#include "TmPacketPusA.h" #include "TmPacketPusA.h"
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "../../globalfunctions/CRC.h" #include "../../../globalfunctions/CRC.h"
#include "../../globalfunctions/arrayprinter.h" #include "../../../globalfunctions/arrayprinter.h"
#include "../../objectmanager/ObjectManagerIF.h" #include "../../../objectmanager/ObjectManagerIF.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../../serviceinterface/ServiceInterfaceStream.h"
#include "../../timemanager/CCSDSTime.h" #include "../../../timemanager/CCSDSTime.h"
#include <cstring> #include <cstring>

View File

@ -2,10 +2,10 @@
#define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "../SpacePacketBase.h" #include "../../SpacePacketBase.h"
#include "../../timemanager/TimeStamperIF.h" #include "../../../timemanager/TimeStamperIF.h"
#include "../../timemanager/Clock.h" #include "../../../timemanager/Clock.h"
#include "../../objectmanager/SystemObjectIF.h" #include "../../../objectmanager/SystemObjectIF.h"
namespace Factory{ namespace Factory{
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();

View File

@ -1,11 +1,11 @@
#include "TmPacketPusC.h" #include "TmPacketPusC.h"
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "../../globalfunctions/CRC.h" #include "../../../globalfunctions/CRC.h"
#include "../../globalfunctions/arrayprinter.h" #include "../../../globalfunctions/arrayprinter.h"
#include "../../objectmanager/ObjectManagerIF.h" #include "../../../objectmanager/ObjectManagerIF.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../../serviceinterface/ServiceInterfaceStream.h"
#include "../../timemanager/CCSDSTime.h" #include "../../../timemanager/CCSDSTime.h"
#include <cstring> #include <cstring>

View File

@ -2,10 +2,10 @@
#define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "../SpacePacketBase.h" #include "../../SpacePacketBase.h"
#include "../../timemanager/TimeStamperIF.h" #include "../../../timemanager/TimeStamperIF.h"
#include "../../timemanager/Clock.h" #include "../../../timemanager/Clock.h"
#include "../../objectmanager/SystemObjectIF.h" #include "../../../objectmanager/SystemObjectIF.h"
namespace Factory{ namespace Factory{
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();

View File

@ -1,8 +1,8 @@
#include "TmPacketStoredBase.h" #include "TmPacketStoredBase.h"
#include "../../objectmanager/ObjectManager.h" #include "../../../objectmanager/ObjectManager.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include "../../tmtcservices/TmTcMessage.h" #include "../../../tmtcservices/TmTcMessage.h"
#include <cstring> #include <cstring>

View File

@ -1,15 +1,15 @@
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_
#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_
#include "../../../FSFW.h"
#include "TmPacketBase.h" #include "TmPacketBase.h"
#include "TmPacketStoredBase.h" #include "TmPacketStoredBase.h"
#include <FSFWConfig.h> #include "TmPacketPusA.h"
#include "../../tmtcpacket/pus/TmPacketPusA.h" #include "../../../serialize/SerializeIF.h"
#include "../../serialize/SerializeIF.h" #include "../../../storagemanager/StorageManagerIF.h"
#include "../../storagemanager/StorageManagerIF.h" #include "../../../internalError/InternalErrorReporterIF.h"
#include "../../internalError/InternalErrorReporterIF.h" #include "../../../ipc/MessageQueueSenderIF.h"
#include "../../ipc/MessageQueueSenderIF.h"
/** /**
* This class generates a ECSS PUS Telemetry packet within a given * This class generates a ECSS PUS Telemetry packet within a given

View File

@ -1,7 +1,7 @@
#include "TmPacketStoredPusA.h" #include "TmPacketStoredPusA.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include "../../tmtcservices/TmTcMessage.h" #include "../../../tmtcservices/TmTcMessage.h"
#include <cstring> #include <cstring>

View File

@ -1,7 +1,7 @@
#include "TmPacketStoredPusC.h" #include "TmPacketStoredPusC.h"
#include "../../serviceinterface/ServiceInterface.h" #include "../../../serviceinterface/ServiceInterface.h"
#include "../../tmtcservices/TmTcMessage.h" #include "../../../tmtcservices/TmTcMessage.h"
#include <cstring> #include <cstring>

View File

@ -1,8 +1,8 @@
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h> #include "TmPacketPusC.h"
#include <fsfw/tmtcpacket/pus/TmPacketStoredBase.h> #include "TmPacketStoredBase.h"
/** /**
* This class generates a ECSS PUS C Telemetry packet within a given * This class generates a ECSS PUS C Telemetry packet within a given

View File

@ -6,8 +6,8 @@
#include "../tcdistribution/PUSDistributorIF.h" #include "../tcdistribution/PUSDistributorIF.h"
#include "../objectmanager/ObjectManager.h" #include "../objectmanager/ObjectManager.h"
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcpacket/pus/tc.h"
#include "../tmtcpacket/pus/TmPacketStored.h" #include "../tmtcpacket/pus/tm.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
@ -246,11 +246,7 @@ void CommandingServiceBase::handleRequestQueue() {
TmTcMessage message; TmTcMessage message;
ReturnValue_t result; ReturnValue_t result;
store_address_t address; store_address_t address;
#if FSFW_USE_PUS_C_TELECOMMANDS == 1 TcPacketStoredPus packet;
TcPacketStoredPusC packet;
#else
TcPacketStoredPusA packet;
#endif
MessageQueueId_t queue; MessageQueueId_t queue;
object_id_t objectId; object_id_t objectId;
for (result = requestQueue->receiveMessage(&message); result == RETURN_OK; 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) { if (iter->second.fifo.retrieve(&address) != RETURN_OK) {
commandMap.erase(&iter); commandMap.erase(&iter);
} else { } else {
#if FSFW_USE_PUS_C_TELECOMMANDS == 1 TcPacketStoredPus newPacket(address);
TcPacketStoredPusC newPacket(address);
#else
TcPacketStoredPusA newPacket(address);
#endif
startExecution(&newPacket, iter); startExecution(&newPacket, iter);
} }
} }

View File

@ -1,7 +1,6 @@
#ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
#define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
#include <fsfw/tmtcpacket/pus/TcPacketStoredBase.h>
#include "AcceptsTelecommandsIF.h" #include "AcceptsTelecommandsIF.h"
#include "VerificationReporter.h" #include "VerificationReporter.h"
@ -17,6 +16,7 @@
#include <FSFWConfig.h> #include <FSFWConfig.h>
class TcPacketStored; class TcPacketStored;
class TcPacketStoredBase;
namespace Factory{ namespace Factory{
void setStaticFrameworkObjectIds(); void setStaticFrameworkObjectIds();

View File

@ -9,7 +9,7 @@
#include "../objectmanager/SystemObject.h" #include "../objectmanager/SystemObject.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include "../tasks/ExecutableObjectIF.h" #include "../tasks/ExecutableObjectIF.h"
#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcpacket/pus/tc.h"
#include "../ipc/MessageQueueIF.h" #include "../ipc/MessageQueueIF.h"
namespace Factory{ namespace Factory{
@ -141,11 +141,7 @@ protected:
* The current Telecommand to be processed. * The current Telecommand to be processed.
* It is deleted after handleRequest was executed. * It is deleted after handleRequest was executed.
*/ */
#if FSFW_USE_PUS_C_TELECOMMANDS == 1 TcPacketStoredPus currentPacket;
TcPacketStoredPusC currentPacket;
#else
TcPacketStoredPusA currentPacket;
#endif
static object_id_t packetSource; static object_id_t packetSource;

View File

@ -4,7 +4,7 @@
#include "VerificationCodes.h" #include "VerificationCodes.h"
#include "../ipc/MessageQueueMessage.h" #include "../ipc/MessageQueueMessage.h"
#include "../tmtcpacket/pus/TcPacketBase.h" #include "../tmtcpacket/pus/tc/TcPacketBase.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
class PusVerificationMessage: public MessageQueueMessage { class PusVerificationMessage: public MessageQueueMessage {