2020-10-01 13:23:06 +02:00
|
|
|
#ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
|
|
|
#define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "PUSDistributorIF.h"
|
|
|
|
#include "TcDistributor.h"
|
|
|
|
#include "TcPacketCheck.h"
|
2020-10-01 13:23:06 +02:00
|
|
|
|
2021-06-13 16:29:13 +02:00
|
|
|
#include "../tmtcpacket/pus/TcPacketStored.h"
|
2020-10-01 13:23:06 +02:00
|
|
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../tmtcservices/AcceptsTelecommandsIF.h"
|
|
|
|
#include "../tmtcservices/VerificationReporter.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* This class accepts PUS Telecommands and forwards them to Application
|
|
|
|
* services. In addition, the class performs a formal packet check and
|
|
|
|
* sends acceptance success or failure messages.
|
|
|
|
* @ingroup tc_distribution
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
class PUSDistributor: public TcDistributor,
|
|
|
|
public PUSDistributorIF,
|
|
|
|
public AcceptsTelecommandsIF {
|
|
|
|
public:
|
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* The ctor passes @c set_apid to the checker class and calls the
|
|
|
|
* TcDistribution ctor with a certain object id.
|
2018-07-12 16:29:32 +02:00
|
|
|
* @param setApid The APID of this receiving Application.
|
|
|
|
* @param setObjectId Object ID of the distributor itself
|
2020-10-01 13:23:06 +02:00
|
|
|
* @param setPacketSource Object ID of the source of TC packets.
|
|
|
|
* Must implement CCSDSDistributorIF.
|
2018-07-12 16:29:32 +02:00
|
|
|
*/
|
2020-10-01 13:23:06 +02:00
|
|
|
PUSDistributor(uint16_t setApid, object_id_t setObjectId,
|
|
|
|
object_id_t setPacketSource);
|
2018-07-12 16:29:32 +02:00
|
|
|
/**
|
|
|
|
* The destructor is empty.
|
|
|
|
*/
|
|
|
|
virtual ~PUSDistributor();
|
2020-10-01 13:23:06 +02:00
|
|
|
ReturnValue_t registerService(AcceptsTelecommandsIF* service) override;
|
|
|
|
MessageQueueId_t getRequestQueue() override;
|
|
|
|
ReturnValue_t initialize() override;
|
|
|
|
uint16_t getIdentifier() override;
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* This attribute contains the class, that performs a formal packet check.
|
|
|
|
*/
|
|
|
|
TcPacketCheck checker;
|
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* With this class, verification messages are sent to the
|
|
|
|
* TC Verification service.
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
VerificationReporter verifyChannel;
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* The currently handled packet is stored here.
|
|
|
|
*/
|
2021-06-13 16:29:13 +02:00
|
|
|
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
|
|
|
|
TcPacketStoredPusC* currentPacket = nullptr;
|
|
|
|
#else
|
|
|
|
TcPacketStoredPusA* currentPacket = nullptr;
|
|
|
|
#endif
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* With this variable, the current check status is stored to generate
|
|
|
|
* acceptance messages later.
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
ReturnValue_t tcStatus;
|
|
|
|
|
|
|
|
const object_id_t packetSource;
|
2020-10-01 13:23:06 +02:00
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* This method reads the packet service, checks if such a service is
|
|
|
|
* registered and forwards the packet to the destination.
|
|
|
|
* It also initiates the formal packet check and sending of verification
|
|
|
|
* messages.
|
|
|
|
* @return Iterator to map entry of found service id
|
|
|
|
* or iterator to @c map.end().
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2020-10-01 13:23:06 +02:00
|
|
|
TcMqMapIter selectDestination() override;
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
2020-10-01 13:23:06 +02:00
|
|
|
* The callback here handles the generation of acceptance
|
|
|
|
* success/failure messages.
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
2020-10-01 13:23:06 +02:00
|
|
|
ReturnValue_t callbackAfterSending(ReturnValue_t queueStatus) override;
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
2020-10-01 13:23:06 +02:00
|
|
|
#endif /* FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ */
|