updates for PusDistributor
This commit is contained in:
parent
059fb10558
commit
740644f2c8
@ -9,12 +9,12 @@
|
|||||||
#define PUS_DISTRIBUTOR_DEBUGGING 0
|
#define PUS_DISTRIBUTOR_DEBUGGING 0
|
||||||
|
|
||||||
PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId,
|
||||||
object_id_t setPacketSource, StorageManagerIF* store_)
|
CCSDSDistributorIF* distributor, StorageManagerIF* store_)
|
||||||
: TcDistributor(setObjectId),
|
: TcDistributor(setObjectId),
|
||||||
store(store_),
|
store(store_),
|
||||||
checker(setApid, ccsds::PacketType::TC),
|
checker(setApid, ccsds::PacketType::TC),
|
||||||
tcStatus(RETURN_FAILED),
|
ccsdsDistributor(distributor),
|
||||||
packetSource(setPacketSource) {}
|
tcStatus(RETURN_FAILED) {}
|
||||||
|
|
||||||
PusDistributor::~PusDistributor() = default;
|
PusDistributor::~PusDistributor() = default;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ PusDistributor::TcMqMapIter PusDistributor::selectDestination() {
|
|||||||
<< storeId.packetIndex << std::endl;
|
<< storeId.packetIndex << std::endl;
|
||||||
#endif
|
#endif
|
||||||
auto queueMapIt = this->queueMap.end();
|
auto queueMapIt = this->queueMap.end();
|
||||||
if (this->currentPacket == nullptr) {
|
if (reader.isNull()) {
|
||||||
return queueMapIt;
|
return queueMapIt;
|
||||||
}
|
}
|
||||||
// TODO: Need to set the data
|
// TODO: Need to set the data
|
||||||
@ -135,13 +135,13 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
|
|||||||
uint16_t PusDistributor::getIdentifier() { return checker.getApid(); }
|
uint16_t PusDistributor::getIdentifier() { return checker.getApid(); }
|
||||||
|
|
||||||
ReturnValue_t PusDistributor::initialize() {
|
ReturnValue_t PusDistributor::initialize() {
|
||||||
if (currentPacket == nullptr) {
|
if (store == nullptr) {
|
||||||
// Should not happen, memory allocation failed!
|
store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
if (store == nullptr) {
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if(ccsdsDistributor == nullptr) {
|
||||||
auto* ccsdsDistributor = ObjectManager::instance()->get<CCSDSDistributorIF>(packetSource);
|
|
||||||
if (ccsdsDistributor == nullptr) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl;
|
sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl;
|
||||||
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
|
sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl;
|
||||||
@ -149,13 +149,7 @@ ReturnValue_t PusDistributor::initialize() {
|
|||||||
sif::printError("PusDistributor::initialize: Packet source invalid\n");
|
sif::printError("PusDistributor::initialize: Packet source invalid\n");
|
||||||
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
|
sif::printError("Make sure it exists and implements CCSDSDistributorIF\n");
|
||||||
#endif
|
#endif
|
||||||
return RETURN_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
|
||||||
if (store == nullptr) {
|
|
||||||
store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
|
|
||||||
if (store == nullptr) {
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ccsdsDistributor->registerApplication(this);
|
return ccsdsDistributor->registerApplication(this);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
#include "fsfw/tmtcservices/VerificationReporter.h"
|
#include "fsfw/tmtcservices/VerificationReporter.h"
|
||||||
|
|
||||||
class PacketStorageHelper;
|
class CCSDSDistributorIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class accepts PUS Telecommands and forwards them to Application
|
* This class accepts PUS Telecommands and forwards them to Application
|
||||||
@ -27,7 +27,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
* @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, object_id_t setPacketSource,
|
PusDistributor(uint16_t setApid, object_id_t setObjectId, CCSDSDistributorIF* packetSource,
|
||||||
StorageManagerIF* store = nullptr);
|
StorageManagerIF* store = nullptr);
|
||||||
/**
|
/**
|
||||||
* The destructor is empty.
|
* The destructor is empty.
|
||||||
@ -49,10 +49,8 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
* TC Verification service.
|
* TC Verification service.
|
||||||
*/
|
*/
|
||||||
VerificationReporterIF* verifyChannel = nullptr;
|
VerificationReporterIF* verifyChannel = nullptr;
|
||||||
/**
|
//! Cached for initialization
|
||||||
* The currently handled packet is stored here.
|
CCSDSDistributorIF* ccsdsDistributor = nullptr;
|
||||||
*/
|
|
||||||
PacketStorageHelper* currentPacket = nullptr;
|
|
||||||
PusTcReader reader;
|
PusTcReader reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,8 +59,6 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t tcStatus;
|
ReturnValue_t tcStatus;
|
||||||
|
|
||||||
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user