diff --git a/src/fsfw/tcdistribution/PusDistributor.cpp b/src/fsfw/tcdistribution/PusDistributor.cpp index 7599114b..6d0da01f 100644 --- a/src/fsfw/tcdistribution/PusDistributor.cpp +++ b/src/fsfw/tcdistribution/PusDistributor.cpp @@ -8,8 +8,8 @@ #define PUS_DISTRIBUTOR_DEBUGGING 0 -PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, - CcsdsDistributorIF* distributor, StorageManagerIF* store_) +PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, StorageManagerIF* store_, + CcsdsDistributorIF* distributor) : TcDistributorBase(setObjectId), store(store_), checker(setApid, ccsds::PacketType::TC), @@ -122,14 +122,12 @@ ReturnValue_t PusDistributor::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } } - if (ccsdsDistributor == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl; - sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl; -#else - sif::printError("PusDistributor::initialize: Packet source invalid\n"); - sif::printError("Make sure it exists and implements CcsdsDistributorIF\n"); -#endif + if (ccsdsDistributor != nullptr) { + ReturnValue_t result = + ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false)); + if (result != returnvalue::OK) { + return result; + } return ObjectManagerIF::CHILD_INIT_FAILED; } if (verifyChannel == nullptr) { @@ -139,7 +137,6 @@ ReturnValue_t PusDistributor::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } } - return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false)); } void PusDistributor::checkerFailurePrinter() const { diff --git a/src/fsfw/tcdistribution/PusDistributor.h b/src/fsfw/tcdistribution/PusDistributor.h index 206f112a..f10c9d9b 100644 --- a/src/fsfw/tcdistribution/PusDistributor.h +++ b/src/fsfw/tcdistribution/PusDistributor.h @@ -31,8 +31,9 @@ class PusDistributor : public TcDistributorBase, * @param setPacketSource Object ID of the source of TC packets. * Must implement CcsdsDistributorIF. */ - PusDistributor(uint16_t setApid, object_id_t setObjectId, CcsdsDistributorIF* packetSource, - StorageManagerIF* store = nullptr); + PusDistributor(uint16_t setApid, object_id_t setObjectId, StorageManagerIF* store = nullptr, + CcsdsDistributorIF* packetSource = nullptr); + [[nodiscard]] const char* getName() const override; /** * The destructor is empty.