whitespace corrections

This commit is contained in:
Robin Müller 2021-06-24 09:47:28 +02:00
parent 2500a5f4f7
commit 53cada41ef
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 243 additions and 243 deletions

View File

@ -7,8 +7,8 @@
#define CCSDS_DISTRIBUTOR_DEBUGGING 0 #define CCSDS_DISTRIBUTOR_DEBUGGING 0
CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid,
object_id_t setObjectId): object_id_t setObjectId):
TcDistributor(setObjectId), defaultApid( setDefaultApid ) { TcDistributor(setObjectId), defaultApid( setDefaultApid ) {
} }
CCSDSDistributor::~CCSDSDistributor() {} CCSDSDistributor::~CCSDSDistributor() {}
@ -16,97 +16,97 @@ CCSDSDistributor::~CCSDSDistributor() {}
TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() { TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
#if CCSDS_DISTRIBUTOR_DEBUGGING == 1 #if CCSDS_DISTRIBUTOR_DEBUGGING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "CCSDSDistributor::selectDestination received: " << sif::debug << "CCSDSDistributor::selectDestination received: " <<
this->currentMessage.getStorageId().poolIndex << ", " << this->currentMessage.getStorageId().poolIndex << ", " <<
this->currentMessage.getStorageId().packetIndex << std::endl; this->currentMessage.getStorageId().packetIndex << std::endl;
#else #else
sif::printDebug("CCSDSDistributor::selectDestination received: %d, %d\n", sif::printDebug("CCSDSDistributor::selectDestination received: %d, %d\n",
currentMessage.getStorageId().poolIndex, currentMessage.getStorageId().packetIndex); currentMessage.getStorageId().poolIndex, currentMessage.getStorageId().packetIndex);
#endif #endif
#endif #endif
const uint8_t* packet = nullptr; const uint8_t* packet = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(), ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(),
&packet, &size ); &packet, &size );
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "CCSDSDistributor::selectDestination: Getting data from" sif::error << "CCSDSDistributor::selectDestination: Getting data from"
" store failed!" << std::endl; " store failed!" << std::endl;
#else #else
sif::printError("CCSDSDistributor::selectDestination: Getting data from" sif::printError("CCSDSDistributor::selectDestination: Getting data from"
" store failed!\n"); " store failed!\n");
#endif #endif
#endif #endif
} }
SpacePacketBase currentPacket(packet); SpacePacketBase currentPacket(packet);
#if FSFW_CPP_OSTREAM_ENABLED == 1 && CCSDS_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 && CCSDS_DISTRIBUTOR_DEBUGGING == 1
sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex << sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex <<
currentPacket.getAPID() << std::dec << std::endl; currentPacket.getAPID() << std::dec << std::endl;
#endif #endif
TcMqMapIter position = this->queueMap.find(currentPacket.getAPID()); TcMqMapIter position = this->queueMap.find(currentPacket.getAPID());
if ( position != this->queueMap.end() ) { if ( position != this->queueMap.end() ) {
return position; return position;
} else { } else {
//The APID was not found. Forward packet to main SW-APID anyway to //The APID was not found. Forward packet to main SW-APID anyway to
// create acceptance failure report. // create acceptance failure report.
return this->queueMap.find( this->defaultApid ); return this->queueMap.find( this->defaultApid );
} }
} }
MessageQueueId_t CCSDSDistributor::getRequestQueue() { MessageQueueId_t CCSDSDistributor::getRequestQueue() {
return tcQueue->getId(); return tcQueue->getId();
} }
ReturnValue_t CCSDSDistributor::registerApplication( ReturnValue_t CCSDSDistributor::registerApplication(
AcceptsTelecommandsIF* application) { AcceptsTelecommandsIF* application) {
ReturnValue_t returnValue = RETURN_OK; ReturnValue_t returnValue = RETURN_OK;
auto insertPair = this->queueMap.emplace(application->getIdentifier(), auto insertPair = this->queueMap.emplace(application->getIdentifier(),
application->getRequestQueue()); application->getRequestQueue());
if(not insertPair.second) { if(not insertPair.second) {
returnValue = RETURN_FAILED; returnValue = RETURN_FAILED;
} }
return returnValue; return returnValue;
} }
ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid, ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid,
MessageQueueId_t id) { MessageQueueId_t id) {
ReturnValue_t returnValue = RETURN_OK; ReturnValue_t returnValue = RETURN_OK;
auto insertPair = this->queueMap.emplace(apid, id); auto insertPair = this->queueMap.emplace(apid, id);
if(not insertPair.second) { if(not insertPair.second) {
returnValue = RETURN_FAILED; returnValue = RETURN_FAILED;
} }
return returnValue; return returnValue;
} }
uint16_t CCSDSDistributor::getIdentifier() { uint16_t CCSDSDistributor::getIdentifier() {
return 0; return 0;
} }
ReturnValue_t CCSDSDistributor::initialize() { ReturnValue_t CCSDSDistributor::initialize() {
ReturnValue_t status = this->TcDistributor::initialize(); ReturnValue_t status = this->TcDistributor::initialize();
this->tcStore = ObjectManager::instance()->get<StorageManagerIF>( objects::TC_STORE ); this->tcStore = ObjectManager::instance()->get<StorageManagerIF>( objects::TC_STORE );
if (this->tcStore == nullptr) { if (this->tcStore == nullptr) {
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "CCSDSDistributor::initialize: Could not initialize" sif::error << "CCSDSDistributor::initialize: Could not initialize"
" TC store!" << std::endl; " TC store!" << std::endl;
#else #else
sif::printError("CCSDSDistributor::initialize: Could not initialize" sif::printError("CCSDSDistributor::initialize: Could not initialize"
" TC store!\n"); " TC store!\n");
#endif #endif
#endif #endif
status = RETURN_FAILED; status = RETURN_FAILED;
} }
return status; return status;
} }
ReturnValue_t CCSDSDistributor::callbackAfterSending( ReturnValue_t CCSDSDistributor::callbackAfterSending(
ReturnValue_t queueStatus) { ReturnValue_t queueStatus) {
if (queueStatus != RETURN_OK) { if (queueStatus != RETURN_OK) {
tcStore->deleteData(currentMessage.getStorageId()); tcStore->deleteData(currentMessage.getStorageId());
} }
return RETURN_OK; return RETURN_OK;
} }

View File

@ -15,56 +15,57 @@
* The Secondary Header (with Service/Subservice) is ignored. * The Secondary Header (with Service/Subservice) is ignored.
* @ingroup tc_distribution * @ingroup tc_distribution
*/ */
class CCSDSDistributor : public TcDistributor, class CCSDSDistributor:
public CCSDSDistributorIF, public TcDistributor,
public AcceptsTelecommandsIF { public CCSDSDistributorIF,
public AcceptsTelecommandsIF {
public: public:
/** /**
* @brief The constructor sets the default APID and calls the * @brief The constructor sets the default APID and calls the
* TcDistributor ctor with a certain object id. * TcDistributor ctor with a certain object id.
* @details * @details
* @c tcStore is set in the @c initialize method. * @c tcStore is set in the @c initialize method.
* @param setDefaultApid The default APID, where packets with unknown * @param setDefaultApid The default APID, where packets with unknown
* destination are sent to. * destination are sent to.
*/ */
CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId); CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId);
/** /**
* The destructor is empty. * The destructor is empty.
*/ */
virtual ~CCSDSDistributor(); virtual ~CCSDSDistributor();
MessageQueueId_t getRequestQueue() override; MessageQueueId_t getRequestQueue() override;
ReturnValue_t registerApplication( uint16_t apid, ReturnValue_t registerApplication( uint16_t apid,
MessageQueueId_t id) override; MessageQueueId_t id) override;
ReturnValue_t registerApplication( ReturnValue_t registerApplication(
AcceptsTelecommandsIF* application) override; AcceptsTelecommandsIF* application) override;
uint16_t getIdentifier() override; uint16_t getIdentifier() override;
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
protected: protected:
/** /**
* This implementation checks if an application with fitting APID has * This implementation checks if an application with fitting APID has
* registered and forwards the packet to the according message queue. * registered and forwards the packet to the according message queue.
* If the packet is not found, it returns the queue to @c defaultApid, * If the packet is not found, it returns the queue to @c defaultApid,
* where a Acceptance Failure message should be generated. * where a Acceptance Failure message should be generated.
* @return Iterator to map entry of found APID or iterator to default APID. * @return Iterator to map entry of found APID or iterator to default APID.
*/ */
TcMqMapIter selectDestination() override; TcMqMapIter selectDestination() override;
/** /**
* 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;
/** /**
* The default APID, where packets with unknown APID are sent to. * The default APID, where packets with unknown APID are sent to.
*/ */
uint16_t defaultApid; uint16_t defaultApid;
/** /**
* A reference to the TC storage must be maintained, as this class handles * A reference to the TC storage must be maintained, as this class handles
* pure Space Packets and there exists no SpacePacketStored class. * pure Space Packets and there exists no SpacePacketStored class.
*/ */
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
}; };

View File

@ -13,31 +13,30 @@
*/ */
class CCSDSDistributorIF { class CCSDSDistributorIF {
public: public:
/** /**
* With this call, a class implementing the CCSDSApplicationIF can register * With this call, a class implementing the CCSDSApplicationIF can register
* at the distributor. * at the distributor.
* @param application A pointer to the Application to register. * @param application A pointer to the Application to register.
* @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 registerApplication( virtual ReturnValue_t registerApplication(
AcceptsTelecommandsIF* application) = 0; AcceptsTelecommandsIF* application) = 0;
/** /**
* With this call, other Applications can register to the CCSDS distributor. * With this call, other Applications can register to the CCSDS distributor.
* This is done by passing an APID and a MessageQueueId to the method. * This is done by passing an APID and a MessageQueueId to the method.
* @param apid The APID to register. * @param apid The APID to register.
* @param id The MessageQueueId of the message queue to send the * @param id The MessageQueueId of the message queue to send the
* TC Packets to. * TC Packets to.
* @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 registerApplication( uint16_t apid, virtual ReturnValue_t registerApplication( uint16_t apid,
MessageQueueId_t id) = 0; MessageQueueId_t id) = 0;
/** /**
* The empty virtual destructor. * The empty virtual destructor.
*/ */
virtual ~CCSDSDistributorIF() { virtual ~CCSDSDistributorIF() {}
}
}; };

View File

@ -1,4 +1,3 @@
#include "CCSDSDistributorIF.h" #include "CCSDSDistributorIF.h"
#include "CFDPDistributor.h" #include "CFDPDistributor.h"

View File

@ -15,65 +15,66 @@
* services. * services.
* @ingroup tc_distribution * @ingroup tc_distribution
*/ */
class CFDPDistributor: public TcDistributor, class CFDPDistributor:
public CFDPDistributorIF, public TcDistributor,
public AcceptsTelecommandsIF { public CFDPDistributorIF,
public AcceptsTelecommandsIF {
public: public:
/** /**
* The ctor passes @c set_apid to the checker class and calls the * The ctor passes @c set_apid to the checker class and calls the
* TcDistribution ctor with a certain object id. * TcDistribution ctor with a certain object id.
* @param setApid The APID of this receiving Application. * @param setApid The APID of this receiving Application.
* @param setObjectId Object ID of the distributor itself * @param setObjectId Object ID of the distributor itself
* @param setPacketSource Object ID of the source of TC packets. * @param setPacketSource Object ID of the source of TC packets.
* Must implement CCSDSDistributorIF. * Must implement CCSDSDistributorIF.
*/ */
CFDPDistributor(uint16_t setApid, object_id_t setObjectId, CFDPDistributor(uint16_t setApid, object_id_t setObjectId,
object_id_t setPacketSource); object_id_t setPacketSource);
/** /**
* The destructor is empty. * The destructor is empty.
*/ */
virtual ~CFDPDistributor(); virtual ~CFDPDistributor();
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override; ReturnValue_t registerService(AcceptsTelecommandsIF* service) 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:
/** /**
* This attribute contains the class, that performs a formal packet check. * This attribute contains the class, that performs a formal packet check.
*/ */
TcPacketCheck checker; TcPacketCheck 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.
*/ */
VerificationReporter verifyChannel; VerificationReporter verifyChannel;
/** /**
* The currently handled packet is stored here. * The currently handled packet is stored here.
*/ */
TcPacketStoredPus* currentPacket = nullptr; TcPacketStoredPus* 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.
*/ */
ReturnValue_t tcStatus; ReturnValue_t tcStatus;
const object_id_t packetSource; const object_id_t packetSource;
/** /**
* This method reads the packet service, checks if such a service is * This method reads the packet service, checks if such a service is
* registered and forwards the packet to the destination. * registered and forwards the packet to the destination.
* It also initiates the formal packet check and sending of verification * It also initiates the formal packet check and sending of verification
* messages. * messages.
* @return Iterator to map entry of found service id * @return Iterator to map entry of found service id
* or iterator to @c map.end(). * or iterator to @c map.end().
*/ */
TcMqMapIter selectDestination() override; TcMqMapIter selectDestination() override;
/** /**
* 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_ */

View File

@ -17,65 +17,65 @@
* @ingroup tc_distribution * @ingroup tc_distribution
*/ */
class PUSDistributor: public TcDistributor, class PUSDistributor: public TcDistributor,
public PUSDistributorIF, public PUSDistributorIF,
public AcceptsTelecommandsIF { public AcceptsTelecommandsIF {
public: public:
/** /**
* The ctor passes @c set_apid to the checker class and calls the * The ctor passes @c set_apid to the checker class and calls the
* TcDistribution ctor with a certain object id. * TcDistribution ctor with a certain object id.
* @param setApid The APID of this receiving Application. * @param setApid The APID of this receiving Application.
* @param setObjectId Object ID of the distributor itself * @param setObjectId Object ID of the distributor itself
* @param setPacketSource Object ID of the source of TC packets. * @param setPacketSource Object ID of the source of TC packets.
* Must implement CCSDSDistributorIF. * Must implement CCSDSDistributorIF.
*/ */
PUSDistributor(uint16_t setApid, object_id_t setObjectId, PUSDistributor(uint16_t setApid, object_id_t setObjectId,
object_id_t setPacketSource); object_id_t setPacketSource);
/** /**
* The destructor is empty. * The destructor is empty.
*/ */
virtual ~PUSDistributor(); virtual ~PUSDistributor();
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override; ReturnValue_t registerService(AcceptsTelecommandsIF* service) 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:
/** /**
* This attribute contains the class, that performs a formal packet check. * This attribute contains the class, that performs a formal packet check.
*/ */
TcPacketCheck checker; TcPacketCheck 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.
*/ */
VerificationReporter verifyChannel; VerificationReporter verifyChannel;
/** /**
* The currently handled packet is stored here. * The currently handled packet is stored here.
*/ */
TcPacketStoredPus* currentPacket = nullptr; TcPacketStoredPus* 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.
*/ */
ReturnValue_t tcStatus; ReturnValue_t tcStatus;
const object_id_t packetSource; const object_id_t packetSource;
/** /**
* This method reads the packet service, checks if such a service is * This method reads the packet service, checks if such a service is
* registered and forwards the packet to the destination. * registered and forwards the packet to the destination.
* It also initiates the formal packet check and sending of verification * It also initiates the formal packet check and sending of verification
* messages. * messages.
* @return Iterator to map entry of found service id * @return Iterator to map entry of found service id
* or iterator to @c map.end(). * or iterator to @c map.end().
*/ */
TcMqMapIter selectDestination() override; TcMqMapIter selectDestination() override;
/** /**
* 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_PUSDISTRIBUTOR_H_ */ #endif /* FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ */

View File

@ -10,18 +10,18 @@
*/ */
class PUSDistributorIF { class PUSDistributorIF {
public: public:
/** /**
* The empty virtual destructor. * The empty virtual destructor.
*/ */
virtual ~PUSDistributorIF() { virtual ~PUSDistributorIF() {
} }
/** /**
* With this method, Services can register themselves at the PUS Distributor. * With this method, Services can register themselves at the PUS Distributor.
* @param service A pointer to the registering Service. * @param service A pointer to the registering Service.
* @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 registerService( AcceptsTelecommandsIF* service ) = 0;
}; };
#endif /* FSFW_TCDISTRIBUTION_PUSDISTRIBUTORIF_H_ */ #endif /* FSFW_TCDISTRIBUTION_PUSDISTRIBUTORIF_H_ */