Merge branch 'tompert/devel' into mueller/master
This commit is contained in:
commit
4a495d987a
@ -1,6 +1,7 @@
|
|||||||
# Core
|
# Core
|
||||||
|
|
||||||
add_subdirectory(action)
|
add_subdirectory(action)
|
||||||
|
add_subdirectory(cfdp)
|
||||||
add_subdirectory(container)
|
add_subdirectory(container)
|
||||||
add_subdirectory(controller)
|
add_subdirectory(controller)
|
||||||
add_subdirectory(datapool)
|
add_subdirectory(datapool)
|
||||||
|
59
src/fsfw/cfdp/CFDPHandler.cpp
Normal file
59
src/fsfw/cfdp/CFDPHandler.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#include "fsfw/cfdp/CFDPHandler.h"
|
||||||
|
|
||||||
|
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
|
object_id_t CFDPHandler::packetSource = 0;
|
||||||
|
object_id_t CFDPHandler::packetDestination = 0;
|
||||||
|
|
||||||
|
CFDPHandler::CFDPHandler(object_id_t setObjectId, CFDPDistributor* dist) : SystemObject(setObjectId) {
|
||||||
|
requestQueue = QueueFactory::instance()->createMessageQueue(CFDP_HANDLER_MAX_RECEPTION);
|
||||||
|
distributor = dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFDPHandler::~CFDPHandler() {}
|
||||||
|
|
||||||
|
ReturnValue_t CFDPHandler::initialize() {
|
||||||
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
this->distributor->registerHandler(this);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CFDPHandler::handleRequest(uint8_t subservice) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "CFDPHandler::handleRequest" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("CFDPHandler::handleRequest");
|
||||||
|
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CFDPHandler::performOperation(uint8_t opCode) {
|
||||||
|
ReturnValue_t result = this->performService();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CFDPHandler::performService() {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::debug << "CFDPHandler::performService" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printDebug("CFDPHandler::performService");
|
||||||
|
#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
#endif
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CFDPHandler::getIdentifier() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageQueueId_t CFDPHandler::getRequestQueue() {
|
||||||
|
return this->requestQueue->getId();
|
||||||
|
}
|
63
src/fsfw/cfdp/CFDPHandler.h
Normal file
63
src/fsfw/cfdp/CFDPHandler.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#ifndef FSFW_CFDP_CFDPHANDLER_H_
|
||||||
|
#define FSFW_CFDP_CFDPHANDLER_H_
|
||||||
|
|
||||||
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
||||||
|
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
|
namespace Factory{
|
||||||
|
void setStaticFrameworkObjectIds();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFDPHandler :
|
||||||
|
public ExecutableObjectIF,
|
||||||
|
public AcceptsTelecommandsIF,
|
||||||
|
public SystemObject,
|
||||||
|
public HasReturnvaluesIF {
|
||||||
|
friend void (Factory::setStaticFrameworkObjectIds)();
|
||||||
|
public:
|
||||||
|
CFDPHandler(object_id_t setObjectId, CFDPDistributor* distributor);
|
||||||
|
/**
|
||||||
|
* The destructor is empty.
|
||||||
|
*/
|
||||||
|
virtual ~CFDPHandler();
|
||||||
|
|
||||||
|
virtual ReturnValue_t handleRequest(uint8_t subservice);
|
||||||
|
|
||||||
|
virtual ReturnValue_t performService();
|
||||||
|
virtual ReturnValue_t initialize() override;
|
||||||
|
virtual uint16_t getIdentifier() override;
|
||||||
|
MessageQueueId_t getRequestQueue() override;
|
||||||
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* This is a complete instance of the telecommand reception queue
|
||||||
|
* of the class. It is initialized on construction of the class.
|
||||||
|
*/
|
||||||
|
MessageQueueIF* requestQueue = nullptr;
|
||||||
|
|
||||||
|
CFDPDistributor* distributor = nullptr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current CFDP packet to be processed.
|
||||||
|
* It is deleted after handleRequest was executed.
|
||||||
|
*/
|
||||||
|
CFDPPacketStored currentPacket;
|
||||||
|
|
||||||
|
static object_id_t packetSource;
|
||||||
|
|
||||||
|
static object_id_t packetDestination;
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* This constant sets the maximum number of packets accepted per call.
|
||||||
|
* Remember that one packet must be completely handled in one
|
||||||
|
* #handleRequest call.
|
||||||
|
*/
|
||||||
|
static const uint8_t CFDP_HANDLER_MAX_RECEPTION = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_CFDP_CFDPHANDLER_H_ */
|
4
src/fsfw/cfdp/CMakeLists.txt
Normal file
4
src/fsfw/cfdp/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
CFDPHandler.cpp
|
||||||
|
)
|
@ -19,6 +19,9 @@ enum framework_objects: object_id_t {
|
|||||||
PUS_SERVICE_200_MODE_MGMT = 0x53000200,
|
PUS_SERVICE_200_MODE_MGMT = 0x53000200,
|
||||||
PUS_SERVICE_201_HEALTH = 0x53000201,
|
PUS_SERVICE_201_HEALTH = 0x53000201,
|
||||||
|
|
||||||
|
/* CFDP Distributer */
|
||||||
|
CFDP_PACKET_DISTRIBUTOR = 0x53001000,
|
||||||
|
|
||||||
//Generic IDs for IPC, modes, health, events
|
//Generic IDs for IPC, modes, health, events
|
||||||
HEALTH_TABLE = 0x53010000,
|
HEALTH_TABLE = 0x53010000,
|
||||||
// MODE_STORE = 0x53010100,
|
// MODE_STORE = 0x53010100,
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
|
||||||
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
||||||
|
|
||||||
|
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
||||||
|
|
||||||
#define CFDP_DISTRIBUTOR_DEBUGGING 0
|
#define CFDP_DISTRIBUTOR_DEBUGGING 0
|
||||||
|
|
||||||
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
CFDPDistributor::CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
object_id_t setPacketSource) :
|
object_id_t setPacketSource) :
|
||||||
TcDistributor(setObjectId), checker(setApid), verifyChannel(),
|
TcDistributor(setObjectId),
|
||||||
tcStatus(RETURN_FAILED), packetSource(setPacketSource) {}
|
tcStatus(RETURN_FAILED), packetSource(setPacketSource) {
|
||||||
|
this->apid = setApid;
|
||||||
|
}
|
||||||
|
|
||||||
CFDPDistributor::~CFDPDistributor() {}
|
CFDPDistributor::~CFDPDistributor() {}
|
||||||
|
|
||||||
@ -30,20 +33,7 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
|||||||
}
|
}
|
||||||
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
|
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
|
||||||
if (currentPacket->getWholeData() != nullptr) {
|
if (currentPacket->getWholeData() != nullptr) {
|
||||||
tcStatus = checker.checkPacket(currentPacket);
|
queueMapIt = this->queueMap.find(0);
|
||||||
if(tcStatus != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::debug << "CFDPDistributor::handlePacket: Packet format invalid, code " <<
|
|
||||||
static_cast<int>(tcStatus) << std::endl;
|
|
||||||
#else
|
|
||||||
sif::printDebug("CFDPDistributor::handlePacket: Packet format invalid, code %d\n",
|
|
||||||
static_cast<int>(tcStatus));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
uint32_t queue_id = currentPacket->getService();
|
|
||||||
queueMapIt = this->queueMap.find(queue_id);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tcStatus = PACKET_LOST;
|
tcStatus = PACKET_LOST;
|
||||||
@ -70,24 +60,24 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t CFDPDistributor::registerService(AcceptsTelecommandsIF* service) {
|
ReturnValue_t CFDPDistributor::registerHandler(AcceptsTelecommandsIF* handler) {
|
||||||
uint16_t serviceId = service->getIdentifier();
|
uint16_t handlerId = handler->getIdentifier(); //should be 0, because CFDPHandler does not set a set a service-ID
|
||||||
#if CFDP_DISTRIBUTOR_DEBUGGING == 1
|
#if CFDP_DISTRIBUTOR_DEBUGGING == 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Service ID: " << static_cast<int>(serviceId) << std::endl;
|
sif::info << "CFDPDistributor::registerHandler: Handler ID: " << static_cast<int>(handlerId) << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Service ID: %d\n", static_cast<int>(serviceId));
|
sif::printInfo("CFDPDistributor::registerHandler: Handler ID: %d\n", static_cast<int>(handlerId));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
MessageQueueId_t queue = service->getRequestQueue();
|
MessageQueueId_t queue = handler->getRequestQueue();
|
||||||
auto returnPair = queueMap.emplace(serviceId, queue);
|
auto returnPair = queueMap.emplace(handlerId, queue);
|
||||||
if (not returnPair.second) {
|
if (not returnPair.second) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "CFDPDistributor::registerService: Service ID already"
|
sif::error << "CFDPDistributor::registerHandler: Service ID already"
|
||||||
" exists in map" << std::endl;
|
" exists in map" << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("CFDPDistributor::registerService: Service ID already exists in map\n");
|
sif::printError("CFDPDistributor::registerHandler: Service ID already exists in map\n");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return SERVICE_ID_ALREADY_EXISTS;
|
return SERVICE_ID_ALREADY_EXISTS;
|
||||||
@ -99,30 +89,30 @@ MessageQueueId_t CFDPDistributor::getRequestQueue() {
|
|||||||
return tcQueue->getId();
|
return tcQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
//ReturnValue_t CFDPDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
||||||
if (queueStatus != RETURN_OK) {
|
// if (queueStatus != RETURN_OK) {
|
||||||
tcStatus = queueStatus;
|
// tcStatus = queueStatus;
|
||||||
}
|
// }
|
||||||
if (tcStatus != RETURN_OK) {
|
// if (tcStatus != RETURN_OK) {
|
||||||
this->verifyChannel.sendFailureReport(tc_verification::ACCEPTANCE_FAILURE,
|
// this->verifyChannel.sendFailureReport(tc_verification::ACCEPTANCE_FAILURE,
|
||||||
currentPacket, tcStatus);
|
// currentPacket, tcStatus);
|
||||||
// A failed packet is deleted immediately after reporting,
|
// // A failed packet is deleted immediately after reporting,
|
||||||
// otherwise it will block memory.
|
// // otherwise it will block memory.
|
||||||
currentPacket->deletePacket();
|
// currentPacket->deletePacket();
|
||||||
return RETURN_FAILED;
|
// return RETURN_FAILED;
|
||||||
} else {
|
// } else {
|
||||||
this->verifyChannel.sendSuccessReport(tc_verification::ACCEPTANCE_SUCCESS,
|
// this->verifyChannel.sendSuccessReport(tc_verification::ACCEPTANCE_SUCCESS,
|
||||||
currentPacket);
|
// currentPacket);
|
||||||
return RETURN_OK;
|
// return RETURN_OK;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
uint16_t CFDPDistributor::getIdentifier() {
|
uint16_t CFDPDistributor::getIdentifier() {
|
||||||
return checker.getApid();
|
return this->apid;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPDistributor::initialize() {
|
ReturnValue_t CFDPDistributor::initialize() {
|
||||||
currentPacket = new TcPacketStoredPus();
|
currentPacket = new CFDPPacketStored();
|
||||||
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;
|
||||||
|
@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
#include "CFDPDistributorIF.h"
|
#include "CFDPDistributorIF.h"
|
||||||
#include "TcDistributor.h"
|
#include "TcDistributor.h"
|
||||||
#include "TcPacketCheck.h"
|
#include "../tmtcpacket/cfdp/CFDPPacketStored.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"
|
||||||
@ -34,25 +32,17 @@ public:
|
|||||||
* The destructor is empty.
|
* The destructor is empty.
|
||||||
*/
|
*/
|
||||||
virtual ~CFDPDistributor();
|
virtual ~CFDPDistributor();
|
||||||
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
|
ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() override;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
uint16_t getIdentifier() override;
|
uint16_t getIdentifier() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
uint16_t apid;
|
||||||
* This attribute contains the class, that performs a formal packet check.
|
|
||||||
*/
|
|
||||||
TcPacketCheck checker;
|
|
||||||
/**
|
|
||||||
* With this class, verification messages are sent to the
|
|
||||||
* TC Verification service.
|
|
||||||
*/
|
|
||||||
VerificationReporter verifyChannel;
|
|
||||||
/**
|
/**
|
||||||
* The currently handled packet is stored here.
|
* The currently handled packet is stored here.
|
||||||
*/
|
*/
|
||||||
TcPacketStoredPus* currentPacket = nullptr;
|
CFDPPacketStored* currentPacket = nullptr;
|
||||||
/**
|
/**
|
||||||
* With this variable, the current check status is stored to generate
|
* With this variable, the current check status is stored to generate
|
||||||
* acceptance messages later.
|
* acceptance messages later.
|
||||||
@ -74,7 +64,7 @@ protected:
|
|||||||
* The callback here handles the generation of acceptance
|
* The callback here handles the generation of acceptance
|
||||||
* success/failure messages.
|
* success/failure messages.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t callbackAfterSending(ReturnValue_t queueStatus) override;
|
//ReturnValue_t callbackAfterSending(ReturnValue_t queueStatus) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_ */
|
#endif /* FSFW_TCDISTRIBUTION_CFDPDISTRIBUTOR_H_ */
|
||||||
|
@ -15,13 +15,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual ~CFDPDistributorIF() {
|
virtual ~CFDPDistributorIF() {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* With this method, Services can register themselves at the PUS Distributor.
|
* With this method, Handlers can register themselves at the CFDP Distributor.
|
||||||
* @param service A pointer to the registering Service.
|
* @param handler A pointer to the registering Handler.
|
||||||
* @return - @c RETURN_OK on success,
|
* @return - @c RETURN_OK on success,
|
||||||
* - @c RETURN_FAILED on failure.
|
* - @c RETURN_FAILED on failure.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t registerService( AcceptsTelecommandsIF* service ) = 0;
|
virtual ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_TCDISTRIBUTION_CFDPDISTRIBUTORIF_H_ */
|
#endif /* FSFW_TCDISTRIBUTION_CFDPDISTRIBUTORIF_H_ */
|
||||||
|
@ -2,7 +2,8 @@ target_sources(${LIB_FSFW_NAME} PRIVATE
|
|||||||
CCSDSDistributor.cpp
|
CCSDSDistributor.cpp
|
||||||
PUSDistributor.cpp
|
PUSDistributor.cpp
|
||||||
TcDistributor.cpp
|
TcDistributor.cpp
|
||||||
TcPacketCheck.cpp
|
TcPacketCheckPUS.cpp
|
||||||
|
TcPacketCheckCFDP.cpp
|
||||||
CFDPDistributor.cpp
|
CFDPDistributor.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "PUSDistributorIF.h"
|
#include "PUSDistributorIF.h"
|
||||||
#include "TcDistributor.h"
|
#include "TcDistributor.h"
|
||||||
#include "TcPacketCheck.h"
|
#include "TcPacketCheckPUS.h"
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/pus/tc.h"
|
#include "fsfw/tmtcpacket/pus/tc.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
@ -43,7 +43,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* This attribute contains the class, that performs a formal packet check.
|
* This attribute contains the class, that performs a formal packet check.
|
||||||
*/
|
*/
|
||||||
TcPacketCheck checker;
|
TcPacketCheckPUS checker;
|
||||||
/**
|
/**
|
||||||
* With this class, verification messages are sent to the
|
* With this class, verification messages are sent to the
|
||||||
* TC Verification service.
|
* TC Verification service.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "fsfw/tcdistribution/TcPacketCheck.h"
|
#include "fsfw/tcdistribution/TcPacketCheckPUS.h"
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h"
|
#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h"
|
||||||
@ -7,10 +7,10 @@
|
|||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/tmtcservices/VerificationCodes.h"
|
#include "fsfw/tmtcservices/VerificationCodes.h"
|
||||||
|
|
||||||
TcPacketCheck::TcPacketCheck(uint16_t setApid): apid(setApid) {
|
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) {
|
ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||||
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
|
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
|
||||||
if(tcPacketBase == nullptr) {
|
if(tcPacketBase == nullptr) {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -41,6 +41,6 @@ ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TcPacketCheck::getApid() const {
|
uint16_t TcPacketCheckPUS::getApid() const {
|
||||||
return apid;
|
return apid;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
|
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||||
#define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
|
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||||
|
|
||||||
|
#include "TcPacketCheckIF.h"
|
||||||
|
|
||||||
#include "fsfw/FSFW.h"
|
#include "fsfw/FSFW.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
@ -12,7 +14,9 @@ class TcPacketStoredBase;
|
|||||||
* Currently, it only checks if the APID and CRC are correct.
|
* Currently, it only checks if the APID and CRC are correct.
|
||||||
* @ingroup tc_distribution
|
* @ingroup tc_distribution
|
||||||
*/
|
*/
|
||||||
class TcPacketCheck : public HasReturnvaluesIF {
|
class TcPacketCheckPUS :
|
||||||
|
public TcPacketCheckIF,
|
||||||
|
public HasReturnvaluesIF {
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Describes the version number a packet must have to pass.
|
* Describes the version number a packet must have to pass.
|
||||||
@ -49,18 +53,11 @@ public:
|
|||||||
* The constructor only sets the APID attribute.
|
* The constructor only sets the APID attribute.
|
||||||
* @param set_apid The APID to set.
|
* @param set_apid The APID to set.
|
||||||
*/
|
*/
|
||||||
TcPacketCheck(uint16_t setApid);
|
TcPacketCheckPUS(uint16_t setApid);
|
||||||
/**
|
|
||||||
* This is the actual method to formally check a certain Telecommand Packet.
|
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
||||||
* The packet's Application Data can not be checked here.
|
|
||||||
* @param current_packet The packt to check
|
|
||||||
* @return - @c RETURN_OK on success.
|
|
||||||
* - @c INCORRECT_CHECKSUM if checksum is invalid.
|
|
||||||
* - @c ILLEGAL_APID if APID does not match.
|
|
||||||
*/
|
|
||||||
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket);
|
|
||||||
|
|
||||||
uint16_t getApid() const;
|
uint16_t getApid() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ */
|
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_ */
|
||||||
|
13
src/fsfw/tcdistribution/TcPacketCheckCFDP.cpp
Normal file
13
src/fsfw/tcdistribution/TcPacketCheckCFDP.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "fsfw/tcdistribution/TcPacketCheckCFDP.h"
|
||||||
|
|
||||||
|
|
||||||
|
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid): apid(setApid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TcPacketCheckCFDP::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t TcPacketCheckCFDP::getApid() const {
|
||||||
|
return apid;
|
||||||
|
}
|
35
src/fsfw/tcdistribution/TcPacketCheckCFDP.h
Normal file
35
src/fsfw/tcdistribution/TcPacketCheckCFDP.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_
|
||||||
|
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_
|
||||||
|
|
||||||
|
#include "TcPacketCheckIF.h"
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
|
||||||
|
class TcPacketStoredBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class performs a formal packet check for incoming CFDP Packets.
|
||||||
|
* @ingroup tc_distribution
|
||||||
|
*/
|
||||||
|
class TcPacketCheckCFDP :
|
||||||
|
public TcPacketCheckIF,
|
||||||
|
public HasReturnvaluesIF {
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* The packet id each correct packet should have.
|
||||||
|
* It is composed of the APID and some static fields.
|
||||||
|
*/
|
||||||
|
uint16_t apid;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The constructor only sets the APID attribute.
|
||||||
|
* @param set_apid The APID to set.
|
||||||
|
*/
|
||||||
|
TcPacketCheckCFDP(uint16_t setApid);
|
||||||
|
|
||||||
|
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
||||||
|
|
||||||
|
uint16_t getApid() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKCFDP_H_ */
|
32
src/fsfw/tcdistribution/TcPacketCheckIF.h
Normal file
32
src/fsfw/tcdistribution/TcPacketCheckIF.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
|
||||||
|
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
|
||||||
|
|
||||||
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
|
// TODO TcPacketStoredBase is currently only for PUS packets. not for CFDP packets
|
||||||
|
class TcPacketStoredBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface is used by PacketCheckers for PUS packets and CFDP packets .
|
||||||
|
* @ingroup tc_distribution
|
||||||
|
*/
|
||||||
|
class TcPacketCheckIF {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The empty virtual destructor.
|
||||||
|
*/
|
||||||
|
virtual ~TcPacketCheckIF() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the actual method to formally check a certain Packet.
|
||||||
|
* The packet's Application Data can not be checked here.
|
||||||
|
* @param current_packet The packet to check
|
||||||
|
* @return - @c RETURN_OK on success.
|
||||||
|
* - @c INCORRECT_CHECKSUM if checksum is invalid.
|
||||||
|
* - @c ILLEGAL_APID if APID does not match.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_ */
|
46
src/fsfw/tcdistribution/TcPacketCheckPUS.cpp
Normal file
46
src/fsfw/tcdistribution/TcPacketCheckPUS.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#include "fsfw/tcdistribution/TcPacketCheckPUS.h"
|
||||||
|
|
||||||
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
#include "fsfw/tmtcservices/VerificationCodes.h"
|
||||||
|
|
||||||
|
TcPacketCheckPUS::TcPacketCheckPUS(uint16_t setApid): apid(setApid) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TcPacketCheckPUS::checkPacket(TcPacketStoredBase* currentPacket) {
|
||||||
|
TcPacketBase* tcPacketBase = currentPacket->getPacketBase();
|
||||||
|
if(tcPacketBase == nullptr) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
uint16_t calculated_crc = CRC::crc16ccitt(tcPacketBase->getWholeData(),
|
||||||
|
tcPacketBase->getFullSize());
|
||||||
|
if (calculated_crc != 0) {
|
||||||
|
return INCORRECT_CHECKSUM;
|
||||||
|
}
|
||||||
|
bool condition = (not tcPacketBase->hasSecondaryHeader()) or
|
||||||
|
(tcPacketBase->getPacketVersionNumber() != CCSDS_VERSION_NUMBER) or
|
||||||
|
(not tcPacketBase->isTelecommand());
|
||||||
|
if (condition) {
|
||||||
|
return INCORRECT_PRIMARY_HEADER;
|
||||||
|
}
|
||||||
|
if (tcPacketBase->getAPID() != this->apid)
|
||||||
|
return ILLEGAL_APID;
|
||||||
|
|
||||||
|
if (not currentPacket->isSizeCorrect()) {
|
||||||
|
return INCOMPLETE_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
condition = (tcPacketBase->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) ||
|
||||||
|
(tcPacketBase->getPusVersionNumber() != PUS_VERSION_NUMBER);
|
||||||
|
if (condition) {
|
||||||
|
return INCORRECT_SECONDARY_HEADER;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t TcPacketCheckPUS::getApid() const {
|
||||||
|
return apid;
|
||||||
|
}
|
63
src/fsfw/tcdistribution/TcPacketCheckPUS.h
Normal file
63
src/fsfw/tcdistribution/TcPacketCheckPUS.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||||
|
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
|
||||||
|
|
||||||
|
#include "TcPacketCheckIF.h"
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tmtcservices/PusVerificationReport.h"
|
||||||
|
|
||||||
|
class TcPacketStoredBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class performs a formal packet check for incoming PUS Telecommand Packets.
|
||||||
|
* Currently, it only checks if the APID and CRC are correct.
|
||||||
|
* @ingroup tc_distribution
|
||||||
|
*/
|
||||||
|
class TcPacketCheckPUS :
|
||||||
|
public TcPacketCheckIF,
|
||||||
|
public HasReturnvaluesIF {
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Describes the version number a packet must have to pass.
|
||||||
|
*/
|
||||||
|
static constexpr uint8_t CCSDS_VERSION_NUMBER = 0;
|
||||||
|
/**
|
||||||
|
* Describes the secondary header a packet must have to pass.
|
||||||
|
*/
|
||||||
|
static constexpr uint8_t CCSDS_SECONDARY_HEADER_FLAG = 0;
|
||||||
|
/**
|
||||||
|
* Describes the TC Packet PUS Version Number a packet must have to pass.
|
||||||
|
*/
|
||||||
|
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
|
||||||
|
static constexpr uint8_t PUS_VERSION_NUMBER = 2;
|
||||||
|
#else
|
||||||
|
static constexpr uint8_t PUS_VERSION_NUMBER = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The packet id each correct packet should have.
|
||||||
|
* It is composed of the APID and some static fields.
|
||||||
|
*/
|
||||||
|
uint16_t apid;
|
||||||
|
public:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::TC_PACKET_CHECK;
|
||||||
|
static const ReturnValue_t ILLEGAL_APID = MAKE_RETURN_CODE( 0 );
|
||||||
|
static const ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE( 1 );
|
||||||
|
static const ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE( 2 );
|
||||||
|
static const ReturnValue_t ILLEGAL_PACKET_TYPE = MAKE_RETURN_CODE( 3 );
|
||||||
|
static const ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE( 4 );
|
||||||
|
static const ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE( 5 );
|
||||||
|
static const ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE( 6 );
|
||||||
|
/**
|
||||||
|
* The constructor only sets the APID attribute.
|
||||||
|
* @param set_apid The APID to set.
|
||||||
|
*/
|
||||||
|
TcPacketCheckPUS(uint16_t setApid);
|
||||||
|
|
||||||
|
ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket) override;
|
||||||
|
|
||||||
|
uint16_t getApid() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_ */
|
@ -3,5 +3,6 @@ target_sources(${LIB_FSFW_NAME} PRIVATE
|
|||||||
SpacePacketBase.cpp
|
SpacePacketBase.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(cfdp)
|
||||||
add_subdirectory(packetmatcher)
|
add_subdirectory(packetmatcher)
|
||||||
add_subdirectory(pus)
|
add_subdirectory(pus)
|
20
src/fsfw/tmtcpacket/cfdp/CFDPPacket.cpp
Normal file
20
src/fsfw/tmtcpacket/cfdp/CFDPPacket.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "fsfw/tmtcpacket/cfdp/CFDPPacket.h"
|
||||||
|
|
||||||
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
CFDPPacket::CFDPPacket(const uint8_t* setData): SpacePacketBase(setData) {}
|
||||||
|
|
||||||
|
CFDPPacket::~CFDPPacket() {}
|
||||||
|
|
||||||
|
void CFDPPacket::print() {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::info << "CFDPPacket::print:" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printInfo("CFDPPacket::print:\n");
|
||||||
|
#endif
|
||||||
|
arrayprinter::print(getWholeData(), getFullSize());
|
||||||
|
}
|
27
src/fsfw/tmtcpacket/cfdp/CFDPPacket.h
Normal file
27
src/fsfw/tmtcpacket/cfdp/CFDPPacket.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
||||||
|
#define FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_
|
||||||
|
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacketBase.h"
|
||||||
|
|
||||||
|
class CFDPPacket : public SpacePacketBase {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* This is the default constructor.
|
||||||
|
* It sets its internal data pointer to the address passed and also
|
||||||
|
* forwards the data pointer to the parent SpacePacketBase class.
|
||||||
|
* @param setData The position where the packet data lies.
|
||||||
|
*/
|
||||||
|
CFDPPacket( const uint8_t* setData );
|
||||||
|
/**
|
||||||
|
* This is the empty default destructor.
|
||||||
|
*/
|
||||||
|
virtual ~CFDPPacket();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a debugging helper method that prints the whole packet content
|
||||||
|
* to the screen.
|
||||||
|
*/
|
||||||
|
void print();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKET_H_ */
|
85
src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp
Normal file
85
src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "fsfw/tmtcpacket/cfdp/CFDPPacketStored.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
|
StorageManagerIF* CFDPPacketStored::store = nullptr;
|
||||||
|
|
||||||
|
CFDPPacketStored::CFDPPacketStored(): CFDPPacket(nullptr) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CFDPPacketStored::CFDPPacketStored(store_address_t setAddress): CFDPPacket(nullptr) {
|
||||||
|
this->setStoreAddress(setAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFDPPacketStored::CFDPPacketStored(const uint8_t* data, size_t size): CFDPPacket(data) {
|
||||||
|
if (this->getFullSize() != size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this->checkAndSetStore()) {
|
||||||
|
ReturnValue_t status = store->addData(&storeAddress, data, size);
|
||||||
|
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
this->setData(nullptr);
|
||||||
|
}
|
||||||
|
const uint8_t* storePtr = nullptr;
|
||||||
|
// Repoint base data pointer to the data in the store.
|
||||||
|
store->getData(storeAddress, &storePtr, &size);
|
||||||
|
this->setData(storePtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CFDPPacketStored::deletePacket() {
|
||||||
|
ReturnValue_t result = this->store->deleteData(this->storeAddress);
|
||||||
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
|
this->setData(nullptr);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CFDPPacket* CFDPPacketStored::getPacketBase() {
|
||||||
|
// return this;
|
||||||
|
//}
|
||||||
|
void CFDPPacketStored::setStoreAddress(store_address_t setAddress) {
|
||||||
|
this->storeAddress = setAddress;
|
||||||
|
const uint8_t* tempData = nullptr;
|
||||||
|
size_t tempSize;
|
||||||
|
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
||||||
|
if (this->checkAndSetStore()) {
|
||||||
|
status = this->store->getData(this->storeAddress, &tempData, &tempSize);
|
||||||
|
}
|
||||||
|
if (status == StorageManagerIF::RETURN_OK) {
|
||||||
|
this->setData(tempData);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->setData(nullptr);
|
||||||
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
store_address_t CFDPPacketStored::getStoreAddress() {
|
||||||
|
return this->storeAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFDPPacketStored::checkAndSetStore() {
|
||||||
|
if (this->store == nullptr) {
|
||||||
|
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||||
|
if (this->store == nullptr) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CFDPPacketStored::isSizeCorrect() {
|
||||||
|
const uint8_t* temp_data = nullptr;
|
||||||
|
size_t temp_size;
|
||||||
|
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data,
|
||||||
|
&temp_size);
|
||||||
|
if (status == StorageManagerIF::RETURN_OK) {
|
||||||
|
if (this->getFullSize() == temp_size) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
64
src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h
Normal file
64
src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_
|
||||||
|
#define FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_
|
||||||
|
|
||||||
|
#include "../pus/tc/TcPacketStoredBase.h"
|
||||||
|
#include "CFDPPacket.h"
|
||||||
|
|
||||||
|
class CFDPPacketStored:
|
||||||
|
public CFDPPacket {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Create stored packet with existing data.
|
||||||
|
* @param data
|
||||||
|
* @param size
|
||||||
|
*/
|
||||||
|
CFDPPacketStored(const uint8_t* data, size_t size);
|
||||||
|
/**
|
||||||
|
* Create stored packet from existing packet in store
|
||||||
|
* @param setAddress
|
||||||
|
*/
|
||||||
|
CFDPPacketStored(store_address_t setAddress);
|
||||||
|
CFDPPacketStored();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter function for the raw data.
|
||||||
|
* @param dataPtr [out] Pointer to the data pointer to set
|
||||||
|
* @param dataSize [out] Address of size to set.
|
||||||
|
* @return -@c RETURN_OK if data was retrieved successfully.
|
||||||
|
*/
|
||||||
|
ReturnValue_t getData(const uint8_t ** dataPtr, size_t* dataSize);
|
||||||
|
|
||||||
|
void setStoreAddress(store_address_t setAddress);
|
||||||
|
|
||||||
|
store_address_t getStoreAddress();
|
||||||
|
|
||||||
|
ReturnValue_t deletePacket();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool isSizeCorrect();
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* 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 /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */
|
4
src/fsfw/tmtcpacket/cfdp/CMakeLists.txt
Normal file
4
src/fsfw/tmtcpacket/cfdp/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
|
CFDPPacket.cpp
|
||||||
|
CFDPPacketStored.cpp
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user