From a523f4ab911bed71752f2ac217e62df033a0cebd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Jul 2022 17:57:22 +0200 Subject: [PATCH] ping works now --- example/core/GenericFactory.cpp | 4 ++-- example/utility/TmFunnel.cpp | 10 +++++----- example/utility/TmFunnel.h | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/example/core/GenericFactory.cpp b/example/core/GenericFactory.cpp index 26d0b41..3f6296d 100644 --- a/example/core/GenericFactory.cpp +++ b/example/core/GenericFactory.cpp @@ -40,13 +40,13 @@ void ObjectFactory::produceGenericObjects() { new EventManager(objects::EVENT_MANAGER); new HealthTable(objects::HEALTH_TABLE); new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); - new CdsShortTimeStamper(objects::TIME_STAMPER); + auto* stamperAndReader = new CdsShortTimeStamper(objects::TIME_STAMPER); new VerificationReporter(nullptr); auto *ccsdsDistrib = new CCSDSDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR); new PusDistributor(apid::APID, objects::PUS_DISTRIBUTOR, ccsdsDistrib); - new TmFunnel(objects::TM_FUNNEL); + new TmFunnel(*stamperAndReader, objects::TM_FUNNEL); #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ /* PUS stack */ diff --git a/example/utility/TmFunnel.cpp b/example/utility/TmFunnel.cpp index 4cf640c..42599b1 100644 --- a/example/utility/TmFunnel.cpp +++ b/example/utility/TmFunnel.cpp @@ -9,8 +9,8 @@ object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT; object_id_t TmFunnel::storageDestination = objects::NO_OBJECT; -TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth) - : SystemObject(objectId), messageDepth(messageDepth) { +TmFunnel::TmFunnel(TimeReaderIF& timeReader, object_id_t objectId, uint32_t messageDepth) + : SystemObject(objectId), timeReader(timeReader), messageDepth(messageDepth) { tmQueue = QueueFactory::instance()->createMessageQueue( messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE); storageQueue = QueueFactory::instance()->createMessageQueue( @@ -29,6 +29,7 @@ ReturnValue_t TmFunnel::performOperation(uint8_t operationCode) { while (status == HasReturnvaluesIF::RETURN_OK) { status = handlePacket(¤tMessage); if (status != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "TmFunnel packet handling failed" << std::endl; break; } status = tmQueue->receiveMessage(¤tMessage); @@ -49,7 +50,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - PusTmZeroCopyWriter packet(packetData, size); + PusTmZeroCopyWriter packet(&timeReader, packetData, size); result = packet.parseDataWithoutCrcCheck(); if(result != HasReturnvaluesIF::RETURN_OK) { return result; @@ -62,8 +63,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) { if (result != HasReturnvaluesIF::RETURN_OK) { tmPool->deleteData(message->getStorageId()); #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmFunnel::handlePacket: Error sending to downlink handler" - << std::endl; + sif::error << "TmFunnel::handlePacket: Error sending TM to downlink handler" << std::endl; #endif return result; } diff --git a/example/utility/TmFunnel.h b/example/utility/TmFunnel.h index 52eee67..6dca3b4 100644 --- a/example/utility/TmFunnel.h +++ b/example/utility/TmFunnel.h @@ -7,6 +7,8 @@ #include #include +#include "fsfw/timemanager/TimeReaderIF.h" + namespace Factory { void setStaticFrameworkObjectIds(); } @@ -25,7 +27,7 @@ class TmFunnel : public AcceptsTelemetryIF, friend void(Factory::setStaticFrameworkObjectIds)(); public: - explicit TmFunnel(object_id_t objectId, uint32_t messageDepth = 20); + explicit TmFunnel(TimeReaderIF& timeReader, object_id_t objectId, uint32_t messageDepth = 20); ~TmFunnel() override; MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override; @@ -38,6 +40,7 @@ protected: private: uint16_t sourceSequenceCount = 0; + TimeReaderIF& timeReader; MessageQueueIF *tmQueue = nullptr; MessageQueueIF *storageQueue = nullptr;