From 723f8749d42ba24b13bc7a1606e12139f7cfda5d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Sep 2022 19:52:33 +0200 Subject: [PATCH 01/14] bump changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24bc89fc..d85ad754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - mib module for the CFDP stack - PDU classes renamed from `...Serializer`/`...Deserializer` to `...Creator`/`...Reader` respetively + - Renamed `TcDistributor` to `TcDistributorBase` to prevent confusion + - Refactored `TcDisitributorBase` to be more flexible and usable for CFDP distribution + - Renamed `CCSDSDistributor` to `CcsdsDistributor` and add feature which allows it + to remove the CCSDS header when routing a packet. This allows CCSDS agnostic receiver + implementation without an extra component PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/682/files # [v5.0.0] 25.07.2022 From 0849c8a08dca5c44d0907584198395ff216dcc47 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Sep 2022 20:10:41 +0200 Subject: [PATCH 02/14] adding files manually --- src/fsfw/cfdp/CfdpHandler.cpp | 4 +- src/fsfw/cfdp/CfdpHandler.h | 4 +- src/fsfw/pus/CService200ModeCommanding.cpp | 4 +- src/fsfw/pus/CService201HealthCommanding.cpp | 4 +- .../pus/Service11TelecommandScheduling.tpp | 4 +- src/fsfw/pus/Service17Test.cpp | 4 +- src/fsfw/pus/Service20ParameterManagement.cpp | 4 +- src/fsfw/pus/Service2DeviceAccess.cpp | 4 +- src/fsfw/pus/Service3Housekeeping.cpp | 2 +- src/fsfw/pus/Service5EventReporting.cpp | 1 + src/fsfw/pus/Service8FunctionManagement.cpp | 4 +- src/fsfw/pus/Service9TimeManagement.cpp | 4 +- src/fsfw/tcdistribution/CFDPDistributor.h | 4 +- src/fsfw/tcdistribution/CMakeLists.txt | 9 +- .../tcdistribution/CcsdsPacketChecker.cpp | 8 +- src/fsfw/tcdistribution/PusDistributor.cpp | 103 +++++++++--------- src/fsfw/tcdistribution/PusDistributor.h | 37 +++++-- src/fsfw/tcdistribution/PusPacketChecker.cpp | 8 +- src/fsfw/tcdistribution/definitions.h | 23 ++-- src/fsfw/tmtcservices/AcceptsTelecommandsIF.h | 16 +-- src/fsfw/tmtcservices/AcceptsTelemetryIF.h | 2 + .../tmtcservices/CommandingServiceBase.cpp | 18 +-- src/fsfw/tmtcservices/CommandingServiceBase.h | 9 +- src/fsfw/tmtcservices/PusServiceBase.cpp | 14 ++- src/fsfw/tmtcservices/PusServiceBase.h | 12 +- src/fsfw/tmtcservices/TmTcBridge.cpp | 14 ++- src/fsfw/tmtcservices/TmTcBridge.h | 19 ++-- unittests/mocks/AcceptsTmMock.cpp | 2 + unittests/mocks/AcceptsTmMock.h | 1 + 29 files changed, 196 insertions(+), 146 deletions(-) diff --git a/src/fsfw/cfdp/CfdpHandler.cpp b/src/fsfw/cfdp/CfdpHandler.cpp index cfe423e3..cd6caf3c 100644 --- a/src/fsfw/cfdp/CfdpHandler.cpp +++ b/src/fsfw/cfdp/CfdpHandler.cpp @@ -51,6 +51,6 @@ ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) { return returnvalue::OK; } -uint16_t CfdpHandler::getIdentifier() { return 0; } +uint32_t CfdpHandler::getIdentifier() const { return 0; } -MessageQueueId_t CfdpHandler::getRequestQueue() { return this->requestQueue->getId(); } +MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); } diff --git a/src/fsfw/cfdp/CfdpHandler.h b/src/fsfw/cfdp/CfdpHandler.h index 94bb529e..14058893 100644 --- a/src/fsfw/cfdp/CfdpHandler.h +++ b/src/fsfw/cfdp/CfdpHandler.h @@ -25,8 +25,8 @@ class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, pub virtual ReturnValue_t handleRequest(store_address_t storeId); virtual ReturnValue_t initialize() override; - virtual uint16_t getIdentifier() override; - MessageQueueId_t getRequestQueue() override; + uint32_t getIdentifier() const override; + MessageQueueId_t getRequestQueue() const override; ReturnValue_t performOperation(uint8_t opCode) override; protected: diff --git a/src/fsfw/pus/CService200ModeCommanding.cpp b/src/fsfw/pus/CService200ModeCommanding.cpp index 69c057ea..d28df59b 100644 --- a/src/fsfw/pus/CService200ModeCommanding.cpp +++ b/src/fsfw/pus/CService200ModeCommanding.cpp @@ -10,8 +10,8 @@ CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, uint16_t commandTimeoutSeconds) - : CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) { -} + : CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands, + commandTimeoutSeconds) {} CService200ModeCommanding::~CService200ModeCommanding() {} diff --git a/src/fsfw/pus/CService201HealthCommanding.cpp b/src/fsfw/pus/CService201HealthCommanding.cpp index c8458edb..bf21c5bd 100644 --- a/src/fsfw/pus/CService201HealthCommanding.cpp +++ b/src/fsfw/pus/CService201HealthCommanding.cpp @@ -10,8 +10,8 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u uint8_t serviceId, uint8_t numParallelCommands, uint16_t commandTimeoutSeconds) - : CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) { -} + : CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands, + commandTimeoutSeconds) {} ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) { switch (subservice) { diff --git a/src/fsfw/pus/Service11TelecommandScheduling.tpp b/src/fsfw/pus/Service11TelecommandScheduling.tpp index 0c750d3c..9016af80 100644 --- a/src/fsfw/pus/Service11TelecommandScheduling.tpp +++ b/src/fsfw/pus/Service11TelecommandScheduling.tpp @@ -16,7 +16,9 @@ inline Service11TelecommandScheduling::Service11TelecommandScheduli : PusServiceBase(params), RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds), debugMode(debugMode), - tcRecipient(tcRecipient) {} + tcRecipient(tcRecipient) { + params.name = "PUS 11 TC Scheduling"; +} template inline Service11TelecommandScheduling::~Service11TelecommandScheduling() = default; diff --git a/src/fsfw/pus/Service17Test.cpp b/src/fsfw/pus/Service17Test.cpp index 0a9db32f..bea2eeb8 100644 --- a/src/fsfw/pus/Service17Test.cpp +++ b/src/fsfw/pus/Service17Test.cpp @@ -8,7 +8,9 @@ Service17Test::Service17Test(PsbParams params) : PusServiceBase(params), storeHelper(params.apid), - tmHelper(params.serviceId, storeHelper, sendHelper) {} + tmHelper(params.serviceId, storeHelper, sendHelper) { + params.name = "PUS 17 Test"; +} Service17Test::~Service17Test() = default; diff --git a/src/fsfw/pus/Service20ParameterManagement.cpp b/src/fsfw/pus/Service20ParameterManagement.cpp index f58a0d6c..e12d47bc 100644 --- a/src/fsfw/pus/Service20ParameterManagement.cpp +++ b/src/fsfw/pus/Service20ParameterManagement.cpp @@ -11,8 +11,8 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint8_t serviceId, uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds) - : CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands, - commandTimeoutSeconds) {} + : CommandingServiceBase(objectId, apid, "PUS 20 Parameter MGMT", serviceId, + numberOfParallelCommands, commandTimeoutSeconds) {} Service20ParameterManagement::~Service20ParameterManagement() = default; diff --git a/src/fsfw/pus/Service2DeviceAccess.cpp b/src/fsfw/pus/Service2DeviceAccess.cpp index 6eea1807..517c35e6 100644 --- a/src/fsfw/pus/Service2DeviceAccess.cpp +++ b/src/fsfw/pus/Service2DeviceAccess.cpp @@ -14,8 +14,8 @@ Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds) - : CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands, - commandTimeoutSeconds) {} + : CommandingServiceBase(objectId, apid, "PUS 2 Raw Commanding", serviceId, + numberOfParallelCommands, commandTimeoutSeconds) {} Service2DeviceAccess::~Service2DeviceAccess() {} diff --git a/src/fsfw/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp index 41bb2472..3ce93c70 100644 --- a/src/fsfw/pus/Service3Housekeeping.cpp +++ b/src/fsfw/pus/Service3Housekeeping.cpp @@ -5,7 +5,7 @@ #include "fsfw/pus/servicepackets/Service3Packets.h" Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId) - : CommandingServiceBase(objectId, apid, serviceId, NUM_OF_PARALLEL_COMMANDS, + : CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS, COMMAND_TIMEOUT_SECONDS) {} Service3Housekeeping::~Service3Housekeeping() {} diff --git a/src/fsfw/pus/Service5EventReporting.cpp b/src/fsfw/pus/Service5EventReporting.cpp index 9fbbc8d9..9145920c 100644 --- a/src/fsfw/pus/Service5EventReporting.cpp +++ b/src/fsfw/pus/Service5EventReporting.cpp @@ -13,6 +13,7 @@ Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumbe storeHelper(params.apid), tmHelper(params.serviceId, storeHelper, sendHelper), maxNumberReportsPerCycle(maxNumberReportsPerCycle) { + psbParams.name = "PUS 5 Event Reporting"; eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth); } diff --git a/src/fsfw/pus/Service8FunctionManagement.cpp b/src/fsfw/pus/Service8FunctionManagement.cpp index b9ef6c4d..8b7c6972 100644 --- a/src/fsfw/pus/Service8FunctionManagement.cpp +++ b/src/fsfw/pus/Service8FunctionManagement.cpp @@ -12,8 +12,8 @@ Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uin uint8_t serviceId, uint8_t numParallelCommands, uint16_t commandTimeoutSeconds) - : CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) { -} + : CommandingServiceBase(objectId, apid, "PUS 8 Functional Commanding", serviceId, + numParallelCommands, commandTimeoutSeconds) {} Service8FunctionManagement::~Service8FunctionManagement() {} diff --git a/src/fsfw/pus/Service9TimeManagement.cpp b/src/fsfw/pus/Service9TimeManagement.cpp index 698290c9..d19cb518 100644 --- a/src/fsfw/pus/Service9TimeManagement.cpp +++ b/src/fsfw/pus/Service9TimeManagement.cpp @@ -5,7 +5,9 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/timemanager/CCSDSTime.h" -Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {} +Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) { + params.name = "PUS 9 Time MGMT"; +} Service9TimeManagement::~Service9TimeManagement() = default; diff --git a/src/fsfw/tcdistribution/CFDPDistributor.h b/src/fsfw/tcdistribution/CFDPDistributor.h index 17e79ff3..5d422a71 100644 --- a/src/fsfw/tcdistribution/CFDPDistributor.h +++ b/src/fsfw/tcdistribution/CFDPDistributor.h @@ -33,9 +33,9 @@ class CFDPDistributor : public TcDistributor, */ ~CFDPDistributor() override; ReturnValue_t registerHandler(AcceptsTelecommandsIF* handler) override; - MessageQueueId_t getRequestQueue() override; + MessageQueueId_t getRequestQueue() const override; ReturnValue_t initialize() override; - uint16_t getIdentifier() override; + uint32_t getIdentifier() const override; protected: uint16_t apid; diff --git a/src/fsfw/tcdistribution/CMakeLists.txt b/src/fsfw/tcdistribution/CMakeLists.txt index 532ba2ca..bcad563a 100644 --- a/src/fsfw/tcdistribution/CMakeLists.txt +++ b/src/fsfw/tcdistribution/CMakeLists.txt @@ -1,9 +1,4 @@ target_sources( ${LIB_FSFW_NAME} - PRIVATE CCSDSDistributor.cpp - PusDistributor.cpp - TcDistributor.cpp - PusPacketChecker.cpp - TcPacketCheckCFDP.cpp - CFDPDistributor.cpp - CcsdsPacketChecker.cpp) + PRIVATE CcsdsDistributor.cpp PusDistributor.cpp TcDistributorBase.cpp + PusPacketChecker.cpp TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp) diff --git a/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp b/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp index 08ec1811..977a90a2 100644 --- a/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp +++ b/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp @@ -10,19 +10,19 @@ ReturnValue_t CcsdsPacketChecker::checkPacket(const SpacePacketReader& currentPa size_t packetLen) { if (checkApid) { if (currentPacket.getApid() != apid) { - return tcdistrib::INVALID_APID; + return tmtcdistrib::INVALID_APID; } } if (currentPacket.getVersion() != ccsdsVersion) { - return tcdistrib::INVALID_CCSDS_VERSION; + return tmtcdistrib::INVALID_CCSDS_VERSION; } if (currentPacket.getPacketType() != packetType) { - return tcdistrib::INVALID_PACKET_TYPE; + return tmtcdistrib::INVALID_PACKET_TYPE; } // This assumes that the getFullPacketLen version uses the space packet data length field if (currentPacket.getFullPacketLen() != packetLen) { - return tcdistrib::INCOMPLETE_PACKET; + return tmtcdistrib::INCOMPLETE_PACKET; } return returnvalue::OK; } diff --git a/src/fsfw/tcdistribution/PusDistributor.cpp b/src/fsfw/tcdistribution/PusDistributor.cpp index c94d5736..7599114b 100644 --- a/src/fsfw/tcdistribution/PusDistributor.cpp +++ b/src/fsfw/tcdistribution/PusDistributor.cpp @@ -3,14 +3,14 @@ #include "definitions.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/CCSDSDistributorIF.h" +#include "fsfw/tcdistribution/CcsdsDistributorIF.h" #include "fsfw/tmtcservices/PusVerificationReport.h" #define PUS_DISTRIBUTOR_DEBUGGING 0 PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, - CCSDSDistributorIF* distributor, StorageManagerIF* store_) - : TcDistributor(setObjectId), + CcsdsDistributorIF* distributor, StorageManagerIF* store_) + : TcDistributorBase(setObjectId), store(store_), checker(setApid, ccsds::PacketType::TC), ccsdsDistributor(distributor), @@ -18,61 +18,59 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, PusDistributor::~PusDistributor() = default; -PusDistributor::TcMqMapIter PusDistributor::selectDestination() { +ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) { #if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1 store_address_t storeId = currentMessage.getStorageId(); sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", " << storeId.packetIndex << std::endl; #endif - auto queueMapIt = queueMap.end(); // TODO: Need to set the data const uint8_t* packetPtr = nullptr; size_t packetLen = 0; - if (store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK) { - return queueMapIt; - } - ReturnValue_t result = reader.setReadOnlyData(packetPtr, packetLen); + ReturnValue_t result = + store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK; if (result != returnvalue::OK) { tcStatus = PACKET_LOST; - return queueMapIt; + return result; + } + result = reader.setReadOnlyData(packetPtr, packetLen); + if (result != returnvalue::OK) { + tcStatus = PACKET_LOST; + return result; } // CRC check done by checker result = reader.parseDataWithoutCrcCheck(); if (result != returnvalue::OK) { tcStatus = PACKET_LOST; - return queueMapIt; + return result; } + if (reader.getFullData() != nullptr) { tcStatus = checker.checkPacket(reader, reader.getFullPacketLen()); if (tcStatus != returnvalue::OK) { checkerFailurePrinter(); } - uint32_t queue_id = reader.getService(); - queueMapIt = queueMap.find(queue_id); + uint8_t pusId = reader.getService(); + auto iter = receiverMap.find(pusId); + if (iter == receiverMap.end()) { + tcStatus = DESTINATION_NOT_FOUND; +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl; +#else + sif::printDebug("PUSDistributor::handlePacket: Destination not found\n"); +#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif + } + destId = iter->second.destId; } else { tcStatus = PACKET_LOST; } - - if (queueMapIt == this->queueMap.end()) { - tcStatus = DESTINATION_NOT_FOUND; -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl; -#else - sif::printDebug("PUSDistributor::handlePacket: Destination not found\n"); -#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif - } - - if (tcStatus != returnvalue::OK) { - return this->queueMap.end(); - } else { - return queueMapIt; - } + return tcStatus; } -ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) { - uint16_t serviceId = service->getIdentifier(); +ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& service) { + uint16_t serviceId = service.getIdentifier(); #if PUS_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Service ID: " << static_cast(serviceId) << std::endl; @@ -80,8 +78,8 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) { sif::printInfo("Service ID: %d\n", static_cast(serviceId)); #endif #endif - MessageQueueId_t queue = service->getRequestQueue(); - auto returnPair = queueMap.emplace(serviceId, queue); + MessageQueueId_t queue = service.getRequestQueue(); + auto returnPair = receiverMap.emplace(serviceId, ServiceInfo(service.getName(), queue)); if (not returnPair.second) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -97,7 +95,7 @@ ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) { return returnvalue::OK; } -MessageQueueId_t PusDistributor::getRequestQueue() { return tcQueue->getId(); } +MessageQueueId_t PusDistributor::getRequestQueue() const { return tcQueue->getId(); } ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) { if (queueStatus != returnvalue::OK) { @@ -115,7 +113,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) { } } -uint16_t PusDistributor::getIdentifier() { return checker.getApid(); } +uint32_t PusDistributor::getIdentifier() const { return checker.getApid(); } ReturnValue_t PusDistributor::initialize() { if (store == nullptr) { @@ -130,7 +128,7 @@ ReturnValue_t PusDistributor::initialize() { 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"); + sif::printError("Make sure it exists and implements CcsdsDistributorIF\n"); #endif return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -141,28 +139,29 @@ ReturnValue_t PusDistributor::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } } - return ccsdsDistributor->registerApplication(this); + return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false)); } void PusDistributor::checkerFailurePrinter() const { #if FSFW_VERBOSE_LEVEL >= 1 - const char* keyword = "unnamed error"; - if (tcStatus == tcdistrib::INCORRECT_CHECKSUM) { - keyword = "checksum"; - } else if (tcStatus == tcdistrib::INCORRECT_PRIMARY_HEADER) { - keyword = "incorrect primary header"; - } else if (tcStatus == tcdistrib::INVALID_APID) { - keyword = "illegal APID"; - } else if (tcStatus == tcdistrib::INCORRECT_SECONDARY_HEADER) { - keyword = "incorrect secondary header"; - } else if (tcStatus == tcdistrib::INCOMPLETE_PACKET) { - keyword = "incomplete packet"; + const char* reason = "Unknown reason"; + if (tcStatus == tmtcdistrib::INCORRECT_CHECKSUM) { + reason = "Checksum Error"; + } else if (tcStatus == tmtcdistrib::INCORRECT_PRIMARY_HEADER) { + reason = "Incorrect Primary Header"; + } else if (tcStatus == tmtcdistrib::INVALID_APID) { + reason = "Illegal APID"; + } else if (tcStatus == tmtcdistrib::INCORRECT_SECONDARY_HEADER) { + reason = "Incorrect Secondary Header"; + } else if (tcStatus == tmtcdistrib::INCOMPLETE_PACKET) { + reason = "Incomplete packet"; } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error" - << std::endl; + sif::warning << "PUSDistributor::handlePacket: Check failed: " << reason << std::endl; #else - sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n", keyword); + sif::printWarning("PUSDistributor::handlePacket: Check failed: %s\n", reason); #endif #endif } + +const char* PusDistributor::getName() const { return "PUS Distributor"; } diff --git a/src/fsfw/tcdistribution/PusDistributor.h b/src/fsfw/tcdistribution/PusDistributor.h index d2265f95..206f112a 100644 --- a/src/fsfw/tcdistribution/PusDistributor.h +++ b/src/fsfw/tcdistribution/PusDistributor.h @@ -1,15 +1,17 @@ #ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ #define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ -#include "PUSDistributorIF.h" +#include + +#include "PusDistributorIF.h" #include "PusPacketChecker.h" -#include "TcDistributor.h" +#include "TcDistributorBase.h" #include "fsfw/returnvalues/returnvalue.h" #include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" #include "fsfw/tmtcservices/VerificationReporter.h" -class CCSDSDistributorIF; +class CcsdsDistributorIF; /** * This class accepts PUS Telecommands and forwards them to Application @@ -17,7 +19,9 @@ class CCSDSDistributorIF; * sends acceptance success or failure messages. * @ingroup tc_distribution */ -class PusDistributor : public TcDistributor, public PUSDistributorIF, public AcceptsTelecommandsIF { +class PusDistributor : public TcDistributorBase, + public PusDistributorIF, + public AcceptsTelecommandsIF { public: /** * The ctor passes @c set_apid to the checker class and calls the @@ -25,20 +29,31 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc * @param setApid The APID of this receiving Application. * @param setObjectId Object ID of the distributor itself * @param setPacketSource Object ID of the source of TC packets. - * Must implement CCSDSDistributorIF. + * Must implement CcsdsDistributorIF. */ - PusDistributor(uint16_t setApid, object_id_t setObjectId, CCSDSDistributorIF* packetSource, + PusDistributor(uint16_t setApid, object_id_t setObjectId, CcsdsDistributorIF* packetSource, StorageManagerIF* store = nullptr); + [[nodiscard]] const char* getName() const override; /** * The destructor is empty. */ ~PusDistributor() override; - ReturnValue_t registerService(AcceptsTelecommandsIF* service) override; - MessageQueueId_t getRequestQueue() override; + ReturnValue_t registerService(const AcceptsTelecommandsIF& service) override; + [[nodiscard]] MessageQueueId_t getRequestQueue() const override; ReturnValue_t initialize() override; - uint16_t getIdentifier() override; + [[nodiscard]] uint32_t getIdentifier() const override; protected: + struct ServiceInfo { + ServiceInfo(const char* name, MessageQueueId_t destId) : name(name), destId(destId) {} + + const char* name; + MessageQueueId_t destId; + }; + /// PUS recipient map. The key value will generally be the PUS Service + using PusReceiverMap = std::map; + + PusReceiverMap receiverMap; StorageManagerIF* store; /** * This attribute contains the class, that performs a formal packet check. @@ -50,7 +65,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc */ VerificationReporterIF* verifyChannel = nullptr; //! Cached for initialization - CCSDSDistributorIF* ccsdsDistributor = nullptr; + CcsdsDistributorIF* ccsdsDistributor = nullptr; PusTcReader reader; /** @@ -67,7 +82,7 @@ class PusDistributor : public TcDistributor, public PUSDistributorIF, public Acc * @return Iterator to map entry of found service id * or iterator to @c map.end(). */ - TcMqMapIter selectDestination() override; + ReturnValue_t selectDestination(MessageQueueId_t& destId) override; /** * The callback here handles the generation of acceptance * success/failure messages. diff --git a/src/fsfw/tcdistribution/PusPacketChecker.cpp b/src/fsfw/tcdistribution/PusPacketChecker.cpp index dc5b9ab9..55a7934c 100644 --- a/src/fsfw/tcdistribution/PusPacketChecker.cpp +++ b/src/fsfw/tcdistribution/PusPacketChecker.cpp @@ -12,17 +12,17 @@ PusPacketChecker::PusPacketChecker(uint16_t apid, ccsds::PacketType packetType_, ReturnValue_t PusPacketChecker::checkPacket(const PusTcReader& pusPacket, size_t packetLen) { // Other primary header fields are checked by base class if (not pusPacket.hasSecHeader()) { - return tcdistrib::INVALID_SEC_HEADER_FIELD; + return tmtcdistrib::INVALID_SEC_HEADER_FIELD; } uint16_t calculated_crc = CRC::crc16ccitt(pusPacket.getFullData(), pusPacket.getFullPacketLen()); if (calculated_crc != 0) { - return tcdistrib::INCORRECT_CHECKSUM; + return tmtcdistrib::INCORRECT_CHECKSUM; } if (pusPacket.getApid() != apid) { - return tcdistrib::INVALID_APID; + return tmtcdistrib::INVALID_APID; } if (pusPacket.getPusVersion() != pusVersion) { - return tcdistrib::INVALID_PUS_VERSION; + return tmtcdistrib::INVALID_PUS_VERSION; } return returnvalue::OK; } diff --git a/src/fsfw/tcdistribution/definitions.h b/src/fsfw/tcdistribution/definitions.h index 3d455077..01fc3085 100644 --- a/src/fsfw/tcdistribution/definitions.h +++ b/src/fsfw/tcdistribution/definitions.h @@ -3,16 +3,19 @@ #include +#include "fsfw/events/Event.h" +#include "fsfw/events/fwSubsystemIdRanges.h" #include "fsfw/returnvalues/FwClassIds.h" #include "fsfw/returnvalues/returnvalue.h" -namespace tcdistrib { -static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK; -static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(0); -static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(1); -static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(2); -static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(3); -static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(4); +namespace tmtcdistrib { +static const uint8_t INTERFACE_ID = CLASS_ID::TMTC_DISTRIBUTION; +static constexpr ReturnValue_t NO_DESTINATION_FOUND = returnvalue::makeCode(INTERFACE_ID, 0); +static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(1); +static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(2); +static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(3); +static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(4); +static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(5); static constexpr ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(5); static constexpr ReturnValue_t INVALID_PUS_VERSION = MAKE_RETURN_CODE(6); @@ -20,5 +23,9 @@ static constexpr ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE(7); static constexpr ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(8); static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(9); -}; // namespace tcdistrib +static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION; +//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues +static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); + +}; // namespace tmtcdistrib #endif // FSFW_TMTCPACKET_DEFINITIONS_H diff --git a/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h b/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h index e18a4f3a..6c214b0f 100644 --- a/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h +++ b/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h @@ -21,20 +21,22 @@ class AcceptsTelecommandsIF { * @brief The virtual destructor as it is mandatory for C++ interfaces. */ virtual ~AcceptsTelecommandsIF() = default; + [[nodiscard]] virtual const char* getName() const = 0; + /** - * @brief Getter for the service id. - * @details Any receiving service (at least any PUS service) shall have a - * service ID. If the receiver can handle Telecommands, but for - * some reason has no service id, it shall return 0. - * @return The service ID or 0. + * @brief Getter for a generic identifier ID. + * @details Any receiving service (at least any PUS service) shall have an identifier. For + * example, this could be the APID for a receiver expecting generic PUS packets, or a PUS + * service for a component expecting specific PUS service packets. + * @return The identifier. */ - virtual uint16_t getIdentifier() = 0; + [[nodiscard]] virtual uint32_t getIdentifier() const = 0; /** * @brief This method returns the message queue id of the telecommand * receiving message queue. * @return The telecommand reception message queue id. */ - virtual MessageQueueId_t getRequestQueue() = 0; + [[nodiscard]] virtual MessageQueueId_t getRequestQueue() const = 0; }; #endif /* FRAMEWORK_TMTCSERVICES_ACCEPTSTELECOMMANDSIF_H_ */ diff --git a/src/fsfw/tmtcservices/AcceptsTelemetryIF.h b/src/fsfw/tmtcservices/AcceptsTelemetryIF.h index 6f8a6226..c3e3eff3 100644 --- a/src/fsfw/tmtcservices/AcceptsTelemetryIF.h +++ b/src/fsfw/tmtcservices/AcceptsTelemetryIF.h @@ -14,6 +14,8 @@ class AcceptsTelemetryIF { * @brief The virtual destructor as it is mandatory for C++ interfaces. */ virtual ~AcceptsTelemetryIF() = default; + + [[nodiscard]] virtual const char* getName() const = 0; /** * @brief This method returns the message queue id of the telemetry * receiving message queue. diff --git a/src/fsfw/tmtcservices/CommandingServiceBase.cpp b/src/fsfw/tmtcservices/CommandingServiceBase.cpp index 63db51ff..1ec5c0d8 100644 --- a/src/fsfw/tmtcservices/CommandingServiceBase.cpp +++ b/src/fsfw/tmtcservices/CommandingServiceBase.cpp @@ -3,7 +3,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/tcdistribution/PusDistributorIF.h" #include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/TmTcMessage.h" @@ -14,7 +14,8 @@ object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT; CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t apid, - uint8_t service, uint8_t numberOfParallelCommands, + const char* name, uint8_t service, + uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds, size_t queueDepth, VerificationReporterIF* verificationReporter) : SystemObject(setObjectId), @@ -24,7 +25,8 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId, uint16_t a tmStoreHelper(apid), tmHelper(service, tmStoreHelper, tmSendHelper), verificationReporter(verificationReporter), - commandMap(numberOfParallelCommands) { + commandMap(numberOfParallelCommands), + name(name) { commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth); requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth); } @@ -50,9 +52,9 @@ ReturnValue_t CommandingServiceBase::performOperation(uint8_t opCode) { return returnvalue::OK; } -uint16_t CommandingServiceBase::getIdentifier() { return service; } +uint32_t CommandingServiceBase::getIdentifier() const { return service; } -MessageQueueId_t CommandingServiceBase::getRequestQueue() { return requestQueue->getId(); } +MessageQueueId_t CommandingServiceBase::getRequestQueue() const { return requestQueue->getId(); } ReturnValue_t CommandingServiceBase::initialize() { ReturnValue_t result = SystemObject::initialize(); @@ -68,7 +70,7 @@ ReturnValue_t CommandingServiceBase::initialize() { if (packetSource == objects::NO_OBJECT) { packetSource = defaultPacketSource; } - auto* distributor = ObjectManager::instance()->get(packetSource); + auto* distributor = ObjectManager::instance()->get(packetSource); if (packetForwarding == nullptr or distributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -79,7 +81,7 @@ ReturnValue_t CommandingServiceBase::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - distributor->registerService(this); + distributor->registerService(*this); requestQueue->setDefaultDestination(packetForwarding->getReportReceptionQueue()); ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); @@ -489,3 +491,5 @@ void CommandingServiceBase::prepareVerificationSuccessWithFullInfo( successParams.tcPsc = tcInfo.tcSequenceControl; successParams.ackFlags = tcInfo.ackFlags; } + +const char* CommandingServiceBase::getName() const { return name; } diff --git a/src/fsfw/tmtcservices/CommandingServiceBase.h b/src/fsfw/tmtcservices/CommandingServiceBase.h index 303d6d2e..92369b58 100644 --- a/src/fsfw/tmtcservices/CommandingServiceBase.h +++ b/src/fsfw/tmtcservices/CommandingServiceBase.h @@ -75,7 +75,7 @@ class CommandingServiceBase : public SystemObject, * @param setPacketDestination * @param queueDepth */ - CommandingServiceBase(object_id_t setObjectId, uint16_t apid, uint8_t service, + CommandingServiceBase(object_id_t setObjectId, uint16_t apid, const char* name, uint8_t service, uint8_t numberOfParallelCommands, uint16_t commandTimeoutSeconds, size_t queueDepth = 20, VerificationReporterIF* reporter = nullptr); ~CommandingServiceBase() override; @@ -105,7 +105,7 @@ class CommandingServiceBase : public SystemObject, */ ReturnValue_t performOperation(uint8_t opCode) override; - uint16_t getIdentifier() override; + uint32_t getIdentifier() const override; /** * Returns the requestQueue MessageQueueId_t @@ -114,7 +114,7 @@ class CommandingServiceBase : public SystemObject, * * @return requestQueue messageQueueId_t */ - MessageQueueId_t getRequestQueue() override; + MessageQueueId_t getRequestQueue() const override; /** * Returns the commandQueue MessageQueueId_t @@ -133,6 +133,7 @@ class CommandingServiceBase : public SystemObject, * @param task Pointer to the taskIF of this task */ void setTaskIF(PeriodicTaskIF* task) override; + const char* getName() const override; protected: /** @@ -283,6 +284,8 @@ class CommandingServiceBase : public SystemObject, uint32_t failureParameter1 = 0; uint32_t failureParameter2 = 0; + const char* name = ""; + static object_id_t defaultPacketSource; object_id_t packetSource = objects::NO_OBJECT; static object_id_t defaultPacketDestination; diff --git a/src/fsfw/tmtcservices/PusServiceBase.cpp b/src/fsfw/tmtcservices/PusServiceBase.cpp index 091ab2f8..9598e536 100644 --- a/src/fsfw/tmtcservices/PusServiceBase.cpp +++ b/src/fsfw/tmtcservices/PusServiceBase.cpp @@ -3,7 +3,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/tcdistribution/PusDistributorIF.h" #include "fsfw/timemanager/CdsShortTimeStamper.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/PusVerificationReport.h" @@ -82,9 +82,9 @@ void PusServiceBase::handleRequestQueue() { } } -uint16_t PusServiceBase::getIdentifier() { return psbParams.serviceId; } +uint32_t PusServiceBase::getIdentifier() const { return psbParams.serviceId; } -MessageQueueId_t PusServiceBase::getRequestQueue() { +MessageQueueId_t PusServiceBase::getRequestQueue() const { if (psbParams.reqQueue == nullptr) { return MessageQueueIF::NO_QUEUE; } @@ -111,7 +111,7 @@ ReturnValue_t PusServiceBase::initialize() { } if (psbParams.pusDistributor == nullptr) { - psbParams.pusDistributor = ObjectManager::instance()->get(PUS_DISTRIBUTOR); + psbParams.pusDistributor = ObjectManager::instance()->get(PUS_DISTRIBUTOR); if (psbParams.pusDistributor != nullptr) { registerService(*psbParams.pusDistributor); } @@ -193,8 +193,8 @@ void PusServiceBase::setVerificationReporter(VerificationReporterIF& reporter) { psbParams.verifReporter = &reporter; } -ReturnValue_t PusServiceBase::registerService(PUSDistributorIF& distributor) { - return distributor.registerService(this); +ReturnValue_t PusServiceBase::registerService(PusDistributorIF& distributor) { + return distributor.registerService(*this); } void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) { @@ -202,3 +202,5 @@ void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) { } void PusServiceBase::setRequestQueue(MessageQueueIF& reqQueue) { psbParams.reqQueue = &reqQueue; } + +const char* PusServiceBase::getName() const { return psbParams.name; } diff --git a/src/fsfw/tmtcservices/PusServiceBase.h b/src/fsfw/tmtcservices/PusServiceBase.h index 8a4f3cd0..befd3240 100644 --- a/src/fsfw/tmtcservices/PusServiceBase.h +++ b/src/fsfw/tmtcservices/PusServiceBase.h @@ -22,9 +22,13 @@ class StorageManagerIF; struct PsbParams { PsbParams() = default; PsbParams(uint16_t apid, AcceptsTelemetryIF* tmReceiver) : apid(apid), tmReceiver(tmReceiver) {} + PsbParams(const char* name, uint16_t apid, AcceptsTelemetryIF* tmReceiver) + : name(name), apid(apid), tmReceiver(tmReceiver) {} PsbParams(object_id_t objectId, uint16_t apid, uint8_t serviceId) : objectId(objectId), apid(apid), serviceId(serviceId) {} - + PsbParams(const char* name, object_id_t objectId, uint16_t apid, uint8_t serviceId) + : name(name), objectId(objectId), apid(apid), serviceId(serviceId) {} + const char* name = ""; object_id_t objectId = objects::NO_OBJECT; uint16_t apid = 0; uint8_t serviceId = 0; @@ -187,11 +191,12 @@ class PusServiceBase : public ExecutableObjectIF, * @c returnvalue::FAILED else. */ ReturnValue_t performOperation(uint8_t opCode) override; - uint16_t getIdentifier() override; - MessageQueueId_t getRequestQueue() override; + uint32_t getIdentifier() const override; + MessageQueueId_t getRequestQueue() const override; ReturnValue_t initialize() override; void setTaskIF(PeriodicTaskIF* taskHandle) override; + [[nodiscard]] const char* getName() const override; protected: /** @@ -200,6 +205,7 @@ class PusServiceBase : public ExecutableObjectIF, * Will be set by setTaskIF(), which is called on task creation. */ PeriodicTaskIF* taskHandle = nullptr; + /** * One of two error parameters for additional error information. */ diff --git a/src/fsfw/tmtcservices/TmTcBridge.cpp b/src/fsfw/tmtcservices/TmTcBridge.cpp index f4ea50d0..0e9f0da4 100644 --- a/src/fsfw/tmtcservices/TmTcBridge.cpp +++ b/src/fsfw/tmtcservices/TmTcBridge.cpp @@ -7,9 +7,10 @@ #define TMTCBRIDGE_WIRETAPPING 0 -TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, - object_id_t tcStoreId) +TmTcBridge::TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination, + object_id_t tmStoreId, object_id_t tcStoreId) : SystemObject(objectId), + name(name), tmStoreId(tmStoreId), tcStoreId(tcStoreId), tcDestination(tcDestination) @@ -67,8 +68,7 @@ ReturnValue_t TmTcBridge::initialize() { #endif return ObjectManagerIF::CHILD_INIT_FAILED; } - AcceptsTelecommandsIF* tcDistributor = - ObjectManager::instance()->get(tcDestination); + auto* tcDistributor = ObjectManager::instance()->get(tcDestination); if (tcDistributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TmTcBridge::initialize: TC Distributor invalid" << std::endl; @@ -246,14 +246,16 @@ MessageQueueId_t TmTcBridge::getReportReceptionQueue(uint8_t virtualChannel) { void TmTcBridge::printData(uint8_t* data, size_t dataLen) { arrayprinter::print(data, dataLen); } -uint16_t TmTcBridge::getIdentifier() { +uint32_t TmTcBridge::getIdentifier() const { // This is no PUS service, so we just return 0 return 0; } -MessageQueueId_t TmTcBridge::getRequestQueue() { +MessageQueueId_t TmTcBridge::getRequestQueue() const { // Default implementation: Relay TC messages to TC distributor directly. return tmTcReceptionQueue->getDefaultDestination(); } void TmTcBridge::setFifoToOverwriteOldData(bool overwriteOld) { this->overwriteOld = overwriteOld; } + +const char* TmTcBridge::getName() const { return name; } diff --git a/src/fsfw/tmtcservices/TmTcBridge.h b/src/fsfw/tmtcservices/TmTcBridge.h index 9d97ed17..4b90d1d5 100644 --- a/src/fsfw/tmtcservices/TmTcBridge.h +++ b/src/fsfw/tmtcservices/TmTcBridge.h @@ -22,9 +22,9 @@ class TmTcBridge : public AcceptsTelemetryIF, static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5; static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10; - TmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, - object_id_t tcStoreId); - virtual ~TmTcBridge(); + TmTcBridge(const char* name, object_id_t objectId, object_id_t tcDestination, + object_id_t tmStoreId, object_id_t tcStoreId); + ~TmTcBridge() override; /** * Set number of packets sent per performOperation().Please note that this @@ -57,21 +57,24 @@ class TmTcBridge : public AcceptsTelemetryIF, * Initializes necessary FSFW components for the TMTC Bridge * @return */ - virtual ReturnValue_t initialize() override; + ReturnValue_t initialize() override; /** * @brief Handles TMTC reception */ - virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; + ReturnValue_t performOperation(uint8_t operationCode = 0) override; /** AcceptsTelemetryIF override */ - virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; + MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override; /** AcceptsTelecommandsIF override */ - virtual uint16_t getIdentifier() override; - virtual MessageQueueId_t getRequestQueue() override; + uint32_t getIdentifier() const override; + MessageQueueId_t getRequestQueue() const override; + const char* getName() const override; protected: + const char* name = ""; + //! Cached for initialize function. object_id_t tmStoreId = objects::NO_OBJECT; object_id_t tcStoreId = objects::NO_OBJECT; diff --git a/unittests/mocks/AcceptsTmMock.cpp b/unittests/mocks/AcceptsTmMock.cpp index 5b1e0d05..7b997047 100644 --- a/unittests/mocks/AcceptsTmMock.cpp +++ b/unittests/mocks/AcceptsTmMock.cpp @@ -9,3 +9,5 @@ AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn) MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) { return returnedQueue; } + +const char* AcceptsTmMock::getName() const { return "TM Acceptor Mock"; } diff --git a/unittests/mocks/AcceptsTmMock.h b/unittests/mocks/AcceptsTmMock.h index a9422eb4..d6cc7f85 100644 --- a/unittests/mocks/AcceptsTmMock.h +++ b/unittests/mocks/AcceptsTmMock.h @@ -10,6 +10,7 @@ class AcceptsTmMock : public SystemObject, public AcceptsTelemetryIF { explicit AcceptsTmMock(MessageQueueId_t queueToReturn); MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override; + const char* getName() const override; MessageQueueId_t returnedQueue; }; From 237e29cc593ade15dc7ef942eab091257e601685 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Sep 2022 20:21:03 +0200 Subject: [PATCH 03/14] all necessary modifications --- src/fsfw/osal/common/TcpTmTcBridge.cpp | 2 +- src/fsfw/osal/common/UdpTmTcBridge.cpp | 2 +- src/fsfw/tcdistribution/CCSDSDistributor.cpp | 4 +- src/fsfw/tcdistribution/CCSDSDistributor.h | 4 +- src/fsfw/tcdistribution/CMakeLists.txt | 4 +- .../tcdistribution/CcsdsPacketChecker.cpp | 8 +- src/fsfw/tcdistribution/PusDistributor.cpp | 97 ++++++++++--------- src/fsfw/tcdistribution/PusDistributor.h | 37 +++---- src/fsfw/tcdistribution/PusPacketChecker.cpp | 8 +- src/fsfw/tcdistribution/definitions.h | 23 ++--- .../tmtcservices/CommandingServiceBase.cpp | 6 +- src/fsfw/tmtcservices/PusServiceBase.cpp | 8 +- 12 files changed, 91 insertions(+), 112 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp index 6b3561ba..f99a8bc1 100644 --- a/src/fsfw/osal/common/TcpTmTcBridge.cpp +++ b/src/fsfw/osal/common/TcpTmTcBridge.cpp @@ -18,7 +18,7 @@ TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId) - : TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { + : TmTcBridge("TCP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) { mutex = MutexFactory::instance()->createMutex(); // Connection is always up, TM is requested by connecting to server and receiving packets registerCommConnect(); diff --git a/src/fsfw/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp index 0a847271..c0848ceb 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.cpp +++ b/src/fsfw/osal/common/UdpTmTcBridge.cpp @@ -22,7 +22,7 @@ const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_POR UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, const std::string &udpServerPort_, object_id_t tmStoreId, object_id_t tcStoreId) - : TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { + : TmTcBridge("UDP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) { if (udpServerPort_.empty()) { udpServerPort = DEFAULT_SERVER_PORT; } else { diff --git a/src/fsfw/tcdistribution/CCSDSDistributor.cpp b/src/fsfw/tcdistribution/CCSDSDistributor.cpp index db408e6d..22cc31cd 100644 --- a/src/fsfw/tcdistribution/CCSDSDistributor.cpp +++ b/src/fsfw/tcdistribution/CCSDSDistributor.cpp @@ -59,7 +59,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() { } } -MessageQueueId_t CCSDSDistributor::getRequestQueue() { return tcQueue->getId(); } +MessageQueueId_t CCSDSDistributor::getRequestQueue() const { return tcQueue->getId(); } ReturnValue_t CCSDSDistributor::registerApplication(AcceptsTelecommandsIF* application) { ReturnValue_t returnValue = returnvalue::OK; @@ -80,7 +80,7 @@ ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid, MessageQueueI return returnValue; } -uint16_t CCSDSDistributor::getIdentifier() { return 0; } +uint32_t CCSDSDistributor::getIdentifier() const { return 0; } ReturnValue_t CCSDSDistributor::initialize() { if (packetChecker == nullptr) { diff --git a/src/fsfw/tcdistribution/CCSDSDistributor.h b/src/fsfw/tcdistribution/CCSDSDistributor.h index d6e4f0e7..a7a54004 100644 --- a/src/fsfw/tcdistribution/CCSDSDistributor.h +++ b/src/fsfw/tcdistribution/CCSDSDistributor.h @@ -35,10 +35,10 @@ class CCSDSDistributor : public TcDistributor, */ ~CCSDSDistributor() override; - MessageQueueId_t getRequestQueue() override; + MessageQueueId_t getRequestQueue() const override; ReturnValue_t registerApplication(uint16_t apid, MessageQueueId_t id) override; ReturnValue_t registerApplication(AcceptsTelecommandsIF* application) override; - uint16_t getIdentifier() override; + uint32_t getIdentifier() const override; ReturnValue_t initialize() override; protected: diff --git a/src/fsfw/tcdistribution/CMakeLists.txt b/src/fsfw/tcdistribution/CMakeLists.txt index bcad563a..2f7ee235 100644 --- a/src/fsfw/tcdistribution/CMakeLists.txt +++ b/src/fsfw/tcdistribution/CMakeLists.txt @@ -1,4 +1,4 @@ target_sources( ${LIB_FSFW_NAME} - PRIVATE CcsdsDistributor.cpp PusDistributor.cpp TcDistributorBase.cpp - PusPacketChecker.cpp TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp) + PRIVATE CCSDSDistributor.cpp PusDistributor.cpp TcDistributor.cpp + TcPacketCheckCFDP.cpp CcsdsPacketChecker.cpp) diff --git a/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp b/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp index 977a90a2..08ec1811 100644 --- a/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp +++ b/src/fsfw/tcdistribution/CcsdsPacketChecker.cpp @@ -10,19 +10,19 @@ ReturnValue_t CcsdsPacketChecker::checkPacket(const SpacePacketReader& currentPa size_t packetLen) { if (checkApid) { if (currentPacket.getApid() != apid) { - return tmtcdistrib::INVALID_APID; + return tcdistrib::INVALID_APID; } } if (currentPacket.getVersion() != ccsdsVersion) { - return tmtcdistrib::INVALID_CCSDS_VERSION; + return tcdistrib::INVALID_CCSDS_VERSION; } if (currentPacket.getPacketType() != packetType) { - return tmtcdistrib::INVALID_PACKET_TYPE; + return tcdistrib::INVALID_PACKET_TYPE; } // This assumes that the getFullPacketLen version uses the space packet data length field if (currentPacket.getFullPacketLen() != packetLen) { - return tmtcdistrib::INCOMPLETE_PACKET; + return tcdistrib::INCOMPLETE_PACKET; } return returnvalue::OK; } diff --git a/src/fsfw/tcdistribution/PusDistributor.cpp b/src/fsfw/tcdistribution/PusDistributor.cpp index 7599114b..eb6850e5 100644 --- a/src/fsfw/tcdistribution/PusDistributor.cpp +++ b/src/fsfw/tcdistribution/PusDistributor.cpp @@ -3,14 +3,14 @@ #include "definitions.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/CcsdsDistributorIF.h" +#include "fsfw/tcdistribution/CCSDSDistributorIF.h" #include "fsfw/tmtcservices/PusVerificationReport.h" #define PUS_DISTRIBUTOR_DEBUGGING 0 PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, - CcsdsDistributorIF* distributor, StorageManagerIF* store_) - : TcDistributorBase(setObjectId), + CCSDSDistributorIF* distributor, StorageManagerIF* store_) + : TcDistributor(setObjectId), store(store_), checker(setApid, ccsds::PacketType::TC), ccsdsDistributor(distributor), @@ -18,59 +18,61 @@ PusDistributor::PusDistributor(uint16_t setApid, object_id_t setObjectId, PusDistributor::~PusDistributor() = default; -ReturnValue_t PusDistributor::selectDestination(MessageQueueId_t& destId) { +PusDistributor::TcMqMapIter PusDistributor::selectDestination() { #if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1 store_address_t storeId = currentMessage.getStorageId(); sif::debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", " << storeId.packetIndex << std::endl; #endif + auto queueMapIt = queueMap.end(); // TODO: Need to set the data const uint8_t* packetPtr = nullptr; size_t packetLen = 0; - ReturnValue_t result = - store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK; - if (result != returnvalue::OK) { - tcStatus = PACKET_LOST; - return result; + if (store->getData(currentMessage.getStorageId(), &packetPtr, &packetLen) != returnvalue::OK) { + return queueMapIt; } - result = reader.setReadOnlyData(packetPtr, packetLen); + ReturnValue_t result = reader.setReadOnlyData(packetPtr, packetLen); if (result != returnvalue::OK) { tcStatus = PACKET_LOST; - return result; + return queueMapIt; } // CRC check done by checker result = reader.parseDataWithoutCrcCheck(); if (result != returnvalue::OK) { tcStatus = PACKET_LOST; - return result; + return queueMapIt; } - if (reader.getFullData() != nullptr) { tcStatus = checker.checkPacket(reader, reader.getFullPacketLen()); if (tcStatus != returnvalue::OK) { checkerFailurePrinter(); } - uint8_t pusId = reader.getService(); - auto iter = receiverMap.find(pusId); - if (iter == receiverMap.end()) { - tcStatus = DESTINATION_NOT_FOUND; -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl; -#else - sif::printDebug("PUSDistributor::handlePacket: Destination not found\n"); -#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif - } - destId = iter->second.destId; + uint32_t queue_id = reader.getService(); + queueMapIt = queueMap.find(queue_id); } else { tcStatus = PACKET_LOST; } - return tcStatus; + + if (queueMapIt == this->queueMap.end()) { + tcStatus = DESTINATION_NOT_FOUND; +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl; +#else + sif::printDebug("PUSDistributor::handlePacket: Destination not found\n"); +#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif + } + + if (tcStatus != returnvalue::OK) { + return this->queueMap.end(); + } else { + return queueMapIt; + } } -ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& service) { - uint16_t serviceId = service.getIdentifier(); +ReturnValue_t PusDistributor::registerService(AcceptsTelecommandsIF* service) { + uint16_t serviceId = service->getIdentifier(); #if PUS_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Service ID: " << static_cast(serviceId) << std::endl; @@ -78,8 +80,8 @@ ReturnValue_t PusDistributor::registerService(const AcceptsTelecommandsIF& servi sif::printInfo("Service ID: %d\n", static_cast(serviceId)); #endif #endif - MessageQueueId_t queue = service.getRequestQueue(); - auto returnPair = receiverMap.emplace(serviceId, ServiceInfo(service.getName(), queue)); + MessageQueueId_t queue = service->getRequestQueue(); + auto returnPair = queueMap.emplace(serviceId, queue); if (not returnPair.second) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -128,7 +130,7 @@ ReturnValue_t PusDistributor::initialize() { 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"); + sif::printError("Make sure it exists and implements CCSDSDistributorIF\n"); #endif return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -139,29 +141,28 @@ ReturnValue_t PusDistributor::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } } - return ccsdsDistributor->registerApplication(CcsdsDistributorIF::DestInfo(*this, false)); + return ccsdsDistributor->registerApplication(this); } void PusDistributor::checkerFailurePrinter() const { #if FSFW_VERBOSE_LEVEL >= 1 - const char* reason = "Unknown reason"; - if (tcStatus == tmtcdistrib::INCORRECT_CHECKSUM) { - reason = "Checksum Error"; - } else if (tcStatus == tmtcdistrib::INCORRECT_PRIMARY_HEADER) { - reason = "Incorrect Primary Header"; - } else if (tcStatus == tmtcdistrib::INVALID_APID) { - reason = "Illegal APID"; - } else if (tcStatus == tmtcdistrib::INCORRECT_SECONDARY_HEADER) { - reason = "Incorrect Secondary Header"; - } else if (tcStatus == tmtcdistrib::INCOMPLETE_PACKET) { - reason = "Incomplete packet"; + const char* keyword = "unnamed error"; + if (tcStatus == tcdistrib::INCORRECT_CHECKSUM) { + keyword = "checksum"; + } else if (tcStatus == tcdistrib::INCORRECT_PRIMARY_HEADER) { + keyword = "incorrect primary header"; + } else if (tcStatus == tcdistrib::INVALID_APID) { + keyword = "illegal APID"; + } else if (tcStatus == tcdistrib::INCORRECT_SECONDARY_HEADER) { + keyword = "incorrect secondary header"; + } else if (tcStatus == tcdistrib::INCOMPLETE_PACKET) { + keyword = "incomplete packet"; } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "PUSDistributor::handlePacket: Check failed: " << reason << std::endl; + sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error" + << std::endl; #else - sif::printWarning("PUSDistributor::handlePacket: Check failed: %s\n", reason); + sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, %s error\n", keyword); #endif #endif } - -const char* PusDistributor::getName() const { return "PUS Distributor"; } diff --git a/src/fsfw/tcdistribution/PusDistributor.h b/src/fsfw/tcdistribution/PusDistributor.h index 206f112a..39a50d9a 100644 --- a/src/fsfw/tcdistribution/PusDistributor.h +++ b/src/fsfw/tcdistribution/PusDistributor.h @@ -1,17 +1,15 @@ #ifndef FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ #define FSFW_TCDISTRIBUTION_PUSDISTRIBUTOR_H_ -#include - -#include "PusDistributorIF.h" +#include "PUSDistributorIF.h" #include "PusPacketChecker.h" -#include "TcDistributorBase.h" +#include "TcDistributor.h" #include "fsfw/returnvalues/returnvalue.h" #include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" #include "fsfw/tmtcservices/VerificationReporter.h" -class CcsdsDistributorIF; +class CCSDSDistributorIF; /** * This class accepts PUS Telecommands and forwards them to Application @@ -19,9 +17,7 @@ class CcsdsDistributorIF; * sends acceptance success or failure messages. * @ingroup tc_distribution */ -class PusDistributor : public TcDistributorBase, - public PusDistributorIF, - public AcceptsTelecommandsIF { +class PusDistributor : public TcDistributor, public PUSDistributorIF, public AcceptsTelecommandsIF { public: /** * The ctor passes @c set_apid to the checker class and calls the @@ -29,31 +25,20 @@ class PusDistributor : public TcDistributorBase, * @param setApid The APID of this receiving Application. * @param setObjectId Object ID of the distributor itself * @param setPacketSource Object ID of the source of TC packets. - * Must implement CcsdsDistributorIF. + * Must implement CCSDSDistributorIF. */ - PusDistributor(uint16_t setApid, object_id_t setObjectId, CcsdsDistributorIF* packetSource, + PusDistributor(uint16_t setApid, object_id_t setObjectId, CCSDSDistributorIF* packetSource, StorageManagerIF* store = nullptr); - [[nodiscard]] const char* getName() const override; /** * The destructor is empty. */ ~PusDistributor() override; - ReturnValue_t registerService(const AcceptsTelecommandsIF& service) override; - [[nodiscard]] MessageQueueId_t getRequestQueue() const override; + ReturnValue_t registerService(AcceptsTelecommandsIF* service) override; + MessageQueueId_t getRequestQueue() const override; ReturnValue_t initialize() override; - [[nodiscard]] uint32_t getIdentifier() const override; + uint32_t getIdentifier() const override; protected: - struct ServiceInfo { - ServiceInfo(const char* name, MessageQueueId_t destId) : name(name), destId(destId) {} - - const char* name; - MessageQueueId_t destId; - }; - /// PUS recipient map. The key value will generally be the PUS Service - using PusReceiverMap = std::map; - - PusReceiverMap receiverMap; StorageManagerIF* store; /** * This attribute contains the class, that performs a formal packet check. @@ -65,7 +50,7 @@ class PusDistributor : public TcDistributorBase, */ VerificationReporterIF* verifyChannel = nullptr; //! Cached for initialization - CcsdsDistributorIF* ccsdsDistributor = nullptr; + CCSDSDistributorIF* ccsdsDistributor = nullptr; PusTcReader reader; /** @@ -82,7 +67,7 @@ class PusDistributor : public TcDistributorBase, * @return Iterator to map entry of found service id * or iterator to @c map.end(). */ - ReturnValue_t selectDestination(MessageQueueId_t& destId) override; + TcMqMapIter selectDestination() override; /** * The callback here handles the generation of acceptance * success/failure messages. diff --git a/src/fsfw/tcdistribution/PusPacketChecker.cpp b/src/fsfw/tcdistribution/PusPacketChecker.cpp index 55a7934c..dc5b9ab9 100644 --- a/src/fsfw/tcdistribution/PusPacketChecker.cpp +++ b/src/fsfw/tcdistribution/PusPacketChecker.cpp @@ -12,17 +12,17 @@ PusPacketChecker::PusPacketChecker(uint16_t apid, ccsds::PacketType packetType_, ReturnValue_t PusPacketChecker::checkPacket(const PusTcReader& pusPacket, size_t packetLen) { // Other primary header fields are checked by base class if (not pusPacket.hasSecHeader()) { - return tmtcdistrib::INVALID_SEC_HEADER_FIELD; + return tcdistrib::INVALID_SEC_HEADER_FIELD; } uint16_t calculated_crc = CRC::crc16ccitt(pusPacket.getFullData(), pusPacket.getFullPacketLen()); if (calculated_crc != 0) { - return tmtcdistrib::INCORRECT_CHECKSUM; + return tcdistrib::INCORRECT_CHECKSUM; } if (pusPacket.getApid() != apid) { - return tmtcdistrib::INVALID_APID; + return tcdistrib::INVALID_APID; } if (pusPacket.getPusVersion() != pusVersion) { - return tmtcdistrib::INVALID_PUS_VERSION; + return tcdistrib::INVALID_PUS_VERSION; } return returnvalue::OK; } diff --git a/src/fsfw/tcdistribution/definitions.h b/src/fsfw/tcdistribution/definitions.h index 01fc3085..3d455077 100644 --- a/src/fsfw/tcdistribution/definitions.h +++ b/src/fsfw/tcdistribution/definitions.h @@ -3,19 +3,16 @@ #include -#include "fsfw/events/Event.h" -#include "fsfw/events/fwSubsystemIdRanges.h" #include "fsfw/returnvalues/FwClassIds.h" #include "fsfw/returnvalues/returnvalue.h" -namespace tmtcdistrib { -static const uint8_t INTERFACE_ID = CLASS_ID::TMTC_DISTRIBUTION; -static constexpr ReturnValue_t NO_DESTINATION_FOUND = returnvalue::makeCode(INTERFACE_ID, 0); -static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(1); -static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(2); -static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(3); -static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(4); -static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(5); +namespace tcdistrib { +static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK; +static constexpr ReturnValue_t INVALID_CCSDS_VERSION = MAKE_RETURN_CODE(0); +static constexpr ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(1); +static constexpr ReturnValue_t INVALID_PACKET_TYPE = MAKE_RETURN_CODE(2); +static constexpr ReturnValue_t INVALID_SEC_HEADER_FIELD = MAKE_RETURN_CODE(3); +static constexpr ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE(4); static constexpr ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE(5); static constexpr ReturnValue_t INVALID_PUS_VERSION = MAKE_RETURN_CODE(6); @@ -23,9 +20,5 @@ static constexpr ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE(7); static constexpr ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE(8); static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(9); -static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION; -//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues -static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW); - -}; // namespace tmtcdistrib +}; // namespace tcdistrib #endif // FSFW_TMTCPACKET_DEFINITIONS_H diff --git a/src/fsfw/tmtcservices/CommandingServiceBase.cpp b/src/fsfw/tmtcservices/CommandingServiceBase.cpp index 1ec5c0d8..ae7771d8 100644 --- a/src/fsfw/tmtcservices/CommandingServiceBase.cpp +++ b/src/fsfw/tmtcservices/CommandingServiceBase.cpp @@ -3,7 +3,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/PusDistributorIF.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" #include "fsfw/tmtcpacket/pus/tc.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/TmTcMessage.h" @@ -70,7 +70,7 @@ ReturnValue_t CommandingServiceBase::initialize() { if (packetSource == objects::NO_OBJECT) { packetSource = defaultPacketSource; } - auto* distributor = ObjectManager::instance()->get(packetSource); + auto* distributor = ObjectManager::instance()->get(packetSource); if (packetForwarding == nullptr or distributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -81,7 +81,7 @@ ReturnValue_t CommandingServiceBase::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - distributor->registerService(*this); + distributor->registerService(this); requestQueue->setDefaultDestination(packetForwarding->getReportReceptionQueue()); ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); diff --git a/src/fsfw/tmtcservices/PusServiceBase.cpp b/src/fsfw/tmtcservices/PusServiceBase.cpp index 9598e536..d0c3b905 100644 --- a/src/fsfw/tmtcservices/PusServiceBase.cpp +++ b/src/fsfw/tmtcservices/PusServiceBase.cpp @@ -3,7 +3,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/tcdistribution/PusDistributorIF.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" #include "fsfw/timemanager/CdsShortTimeStamper.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/PusVerificationReport.h" @@ -111,7 +111,7 @@ ReturnValue_t PusServiceBase::initialize() { } if (psbParams.pusDistributor == nullptr) { - psbParams.pusDistributor = ObjectManager::instance()->get(PUS_DISTRIBUTOR); + psbParams.pusDistributor = ObjectManager::instance()->get(PUS_DISTRIBUTOR); if (psbParams.pusDistributor != nullptr) { registerService(*psbParams.pusDistributor); } @@ -193,8 +193,8 @@ void PusServiceBase::setVerificationReporter(VerificationReporterIF& reporter) { psbParams.verifReporter = &reporter; } -ReturnValue_t PusServiceBase::registerService(PusDistributorIF& distributor) { - return distributor.registerService(*this); +ReturnValue_t PusServiceBase::registerService(PUSDistributorIF& distributor) { + return distributor.registerService(this); } void PusServiceBase::setTmReceiver(AcceptsTelemetryIF& tmReceiver_) { From ab7c3480f58009afb2feb584f684870a158b97e6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:30:22 +0200 Subject: [PATCH 04/14] storage manager update --- .../storagemanager/ConstStorageAccessor.cpp | 8 +-- .../storagemanager/ConstStorageAccessor.h | 13 ++-- src/fsfw/storagemanager/LocalPool.cpp | 59 ++++++++----------- src/fsfw/storagemanager/LocalPool.h | 24 ++++---- src/fsfw/storagemanager/PoolManager.h | 8 +-- src/fsfw/storagemanager/StorageAccessor.cpp | 4 +- src/fsfw/storagemanager/StorageAccessor.h | 7 ++- src/fsfw/storagemanager/StorageManagerIF.h | 56 ++++++++++++++---- 8 files changed, 103 insertions(+), 76 deletions(-) diff --git a/src/fsfw/storagemanager/ConstStorageAccessor.cpp b/src/fsfw/storagemanager/ConstStorageAccessor.cpp index f64334f7..e39fa36b 100644 --- a/src/fsfw/storagemanager/ConstStorageAccessor.cpp +++ b/src/fsfw/storagemanager/ConstStorageAccessor.cpp @@ -19,7 +19,7 @@ ConstStorageAccessor::~ConstStorageAccessor() { } } -ConstStorageAccessor::ConstStorageAccessor(ConstStorageAccessor&& other) +ConstStorageAccessor::ConstStorageAccessor(ConstStorageAccessor&& other) noexcept : constDataPointer(other.constDataPointer), storeId(other.storeId), size_(other.size_), @@ -30,7 +30,7 @@ ConstStorageAccessor::ConstStorageAccessor(ConstStorageAccessor&& other) other.store = nullptr; } -ConstStorageAccessor& ConstStorageAccessor::operator=(ConstStorageAccessor&& other) { +ConstStorageAccessor& ConstStorageAccessor::operator=(ConstStorageAccessor&& other) noexcept { constDataPointer = other.constDataPointer; storeId = other.storeId; store = other.store; @@ -84,7 +84,7 @@ void ConstStorageAccessor::print() const { arrayprinter::print(constDataPointer, size_); } -void ConstStorageAccessor::assignStore(StorageManagerIF* store) { +void ConstStorageAccessor::assignStore(StorageManagerIF* store_) { internalState = AccessState::ASSIGNED; - this->store = store; + store = store_; } diff --git a/src/fsfw/storagemanager/ConstStorageAccessor.h b/src/fsfw/storagemanager/ConstStorageAccessor.h index 9cad346c..0911c6d9 100644 --- a/src/fsfw/storagemanager/ConstStorageAccessor.h +++ b/src/fsfw/storagemanager/ConstStorageAccessor.h @@ -23,6 +23,7 @@ class ConstStorageAccessor { //! StorageManager classes have exclusive access to private variables. friend class PoolManager; friend class LocalPool; + friend class StorageManagerIF; public: /** @@ -30,7 +31,7 @@ class ConstStorageAccessor { * entry to access. * @param storeId */ - ConstStorageAccessor(store_address_t storeId); + explicit ConstStorageAccessor(store_address_t storeId); ConstStorageAccessor(store_address_t storeId, StorageManagerIF* store); /** @@ -43,7 +44,7 @@ class ConstStorageAccessor { * @brief Returns a pointer to the read-only data * @return */ - const uint8_t* data() const; + [[nodiscard]] const uint8_t* data() const; /** * @brief Copies the read-only data to the supplied pointer @@ -61,13 +62,13 @@ class ConstStorageAccessor { * Get the size of the data * @return */ - size_t size() const; + [[nodiscard]] size_t size() const; /** * Get the storage ID. * @return */ - store_address_t getId() const; + [[nodiscard]] store_address_t getId() const; void print() const; @@ -79,8 +80,8 @@ class ConstStorageAccessor { * @param * @return */ - ConstStorageAccessor& operator=(ConstStorageAccessor&&); - ConstStorageAccessor(ConstStorageAccessor&&); + ConstStorageAccessor& operator=(ConstStorageAccessor&&) noexcept; + ConstStorageAccessor(ConstStorageAccessor&&) noexcept; //! The copy ctor and copy assignemnt should be deleted implicitely //! according to https://foonathan.net/2019/02/special-member-functions/ diff --git a/src/fsfw/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp index d907a9b3..970b05f5 100644 --- a/src/fsfw/storagemanager/LocalPool.cpp +++ b/src/fsfw/storagemanager/LocalPool.cpp @@ -29,7 +29,7 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, } } -LocalPool::~LocalPool(void) {} +LocalPool::~LocalPool() = default; ReturnValue_t LocalPool::addData(store_address_t* storageId, const uint8_t* data, size_t size, bool ignoreFault) { @@ -48,22 +48,6 @@ ReturnValue_t LocalPool::getData(store_address_t packetId, const uint8_t** packe return status; } -ReturnValue_t LocalPool::getData(store_address_t storeId, ConstStorageAccessor& storeAccessor) { - uint8_t* tempData = nullptr; - ReturnValue_t status = modifyData(storeId, &tempData, &storeAccessor.size_); - storeAccessor.assignStore(this); - storeAccessor.constDataPointer = tempData; - return status; -} - -ConstAccessorPair LocalPool::getData(store_address_t storeId) { - uint8_t* tempData = nullptr; - ConstStorageAccessor constAccessor(storeId, this); - ReturnValue_t status = modifyData(storeId, &tempData, &constAccessor.size_); - constAccessor.constDataPointer = tempData; - return ConstAccessorPair(status, std::move(constAccessor)); -} - ReturnValue_t LocalPool::getFreeElement(store_address_t* storageId, const size_t size, uint8_t** pData, bool ignoreFault) { ReturnValue_t status = reserveSpace(size, storageId, ignoreFault); @@ -75,20 +59,6 @@ ReturnValue_t LocalPool::getFreeElement(store_address_t* storageId, const size_t return status; } -AccessorPair LocalPool::modifyData(store_address_t storeId) { - StorageAccessor accessor(storeId, this); - ReturnValue_t status = modifyData(storeId, &accessor.dataPointer, &accessor.size_); - accessor.assignConstPointer(); - return AccessorPair(status, std::move(accessor)); -} - -ReturnValue_t LocalPool::modifyData(store_address_t storeId, StorageAccessor& storeAccessor) { - storeAccessor.assignStore(this); - ReturnValue_t status = modifyData(storeId, &storeAccessor.dataPointer, &storeAccessor.size_); - storeAccessor.assignConstPointer(); - return status; -} - ReturnValue_t LocalPool::modifyData(store_address_t storeId, uint8_t** packetPtr, size_t* size) { ReturnValue_t status = returnvalue::FAILED; if (storeId.poolIndex >= NUMBER_OF_SUBPOOLS) { @@ -197,8 +167,7 @@ void LocalPool::clearStore() { } } -ReturnValue_t LocalPool::reserveSpace(const size_t size, store_address_t* storeId, - bool ignoreFault) { +ReturnValue_t LocalPool::reserveSpace(size_t size, store_address_t* storeId, bool ignoreFault) { ReturnValue_t status = getSubPoolIndex(size, &storeId->poolIndex); if (status != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -349,3 +318,27 @@ bool LocalPool::hasDataAtId(store_address_t storeId) const { } return false; } + +ReturnValue_t LocalPool::getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) { + return StorageManagerIF::getFreeElement(storeId, size, pData); +} + +ConstAccessorPair LocalPool::getData(store_address_t storeId) { + return StorageManagerIF::getData(storeId); +} + +ReturnValue_t LocalPool::addData(store_address_t* storeId, const uint8_t* data, size_t size) { + return StorageManagerIF::addData(storeId, data, size); +} + +ReturnValue_t LocalPool::getData(store_address_t storeId, ConstStorageAccessor& accessor) { + return StorageManagerIF::getData(storeId, accessor); +} + +ReturnValue_t LocalPool::modifyData(store_address_t storeId, StorageAccessor& accessor) { + return StorageManagerIF::modifyData(storeId, accessor); +} + +AccessorPair LocalPool::modifyData(store_address_t storeId) { + return StorageManagerIF::modifyData(storeId); +} diff --git a/src/fsfw/storagemanager/LocalPool.h b/src/fsfw/storagemanager/LocalPool.h index a82da971..54d704e6 100644 --- a/src/fsfw/storagemanager/LocalPool.h +++ b/src/fsfw/storagemanager/LocalPool.h @@ -87,21 +87,23 @@ class LocalPool : public SystemObject, public StorageManagerIF { * Documentation: See StorageManagerIF.h */ ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size, - bool ignoreFault = false) override; - ReturnValue_t getFreeElement(store_address_t* storeId, const size_t size, uint8_t** pData, - bool ignoreFault = false) override; + bool ignoreFault) override; + ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size) override; + + ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData) override; + ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData, + bool ignoreFault) override; ConstAccessorPair getData(store_address_t storeId) override; - ReturnValue_t getData(store_address_t storeId, ConstStorageAccessor& constAccessor) override; + ReturnValue_t getData(store_address_t storeId, ConstStorageAccessor& accessor) override; ReturnValue_t getData(store_address_t storeId, const uint8_t** packet_ptr, size_t* size) override; AccessorPair modifyData(store_address_t storeId) override; - ReturnValue_t modifyData(store_address_t storeId, StorageAccessor& storeAccessor) override; ReturnValue_t modifyData(store_address_t storeId, uint8_t** packet_ptr, size_t* size) override; + ReturnValue_t modifyData(store_address_t storeId, StorageAccessor& accessor) override; - virtual ReturnValue_t deleteData(store_address_t storeId) override; - virtual ReturnValue_t deleteData(uint8_t* ptr, size_t size, - store_address_t* storeId = nullptr) override; + ReturnValue_t deleteData(store_address_t storeId) override; + ReturnValue_t deleteData(uint8_t* ptr, size_t size, store_address_t* storeId) override; /** * Get the total size of allocated memory for pool data. @@ -131,8 +133,8 @@ class LocalPool : public SystemObject, public StorageManagerIF { * Get number sub pools. Each pool has pages with a specific bucket size. * @return */ - max_subpools_t getNumberOfSubPools() const override; - bool hasDataAtId(store_address_t storeId) const override; + [[nodiscard]] max_subpools_t getNumberOfSubPools() const override; + [[nodiscard]] bool hasDataAtId(store_address_t storeId) const override; protected: /** @@ -142,7 +144,7 @@ class LocalPool : public SystemObject, public StorageManagerIF { * @return - returnvalue::OK on success, * - the return codes of #getPoolIndex or #findEmpty otherwise. */ - virtual ReturnValue_t reserveSpace(const size_t size, store_address_t* address, bool ignoreFault); + virtual ReturnValue_t reserveSpace(size_t size, store_address_t* address, bool ignoreFault); private: /** diff --git a/src/fsfw/storagemanager/PoolManager.h b/src/fsfw/storagemanager/PoolManager.h index 0951a518..eaa978ef 100644 --- a/src/fsfw/storagemanager/PoolManager.h +++ b/src/fsfw/storagemanager/PoolManager.h @@ -27,7 +27,7 @@ class PoolManager : public LocalPool { * @brief In the PoolManager's destructor all allocated memory * is freed. */ - virtual ~PoolManager(); + ~PoolManager() override; /** * Set the default mutex timeout for internal calls. @@ -40,8 +40,7 @@ class PoolManager : public LocalPool { * which wraps LocalPool calls with a mutex protection. */ ReturnValue_t deleteData(store_address_t) override; - ReturnValue_t deleteData(uint8_t* buffer, size_t size, - store_address_t* storeId = nullptr) override; + ReturnValue_t deleteData(uint8_t* buffer, size_t size, store_address_t* storeId) override; /** * The developer is allowed to lock the mutex in case the lock needs @@ -58,8 +57,7 @@ class PoolManager : public LocalPool { //! Default mutex timeout value to prevent permanent blocking. uint32_t mutexTimeoutMs = 20; - ReturnValue_t reserveSpace(const size_t size, store_address_t* address, - bool ignoreFault) override; + ReturnValue_t reserveSpace(size_t size, store_address_t* address, bool ignoreFault) override; /** * @brief The mutex is created in the constructor and makes diff --git a/src/fsfw/storagemanager/StorageAccessor.cpp b/src/fsfw/storagemanager/StorageAccessor.cpp index 8a96dcec..b576a113 100644 --- a/src/fsfw/storagemanager/StorageAccessor.cpp +++ b/src/fsfw/storagemanager/StorageAccessor.cpp @@ -10,7 +10,7 @@ StorageAccessor::StorageAccessor(store_address_t storeId) : ConstStorageAccessor StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* store) : ConstStorageAccessor(storeId, store) {} -StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) { +StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) noexcept { // Call the parent move assignment and also assign own member. dataPointer = other.dataPointer; ConstStorageAccessor::operator=(std::move(other)); @@ -18,7 +18,7 @@ StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) { } // Call the parent move ctor and also transfer own member. -StorageAccessor::StorageAccessor(StorageAccessor&& other) +StorageAccessor::StorageAccessor(StorageAccessor&& other) noexcept : ConstStorageAccessor(std::move(other)), dataPointer(other.dataPointer) {} ReturnValue_t StorageAccessor::getDataCopy(uint8_t* pointer, size_t maxSize) { diff --git a/src/fsfw/storagemanager/StorageAccessor.h b/src/fsfw/storagemanager/StorageAccessor.h index 5e8b25e4..b6c5dc14 100644 --- a/src/fsfw/storagemanager/StorageAccessor.h +++ b/src/fsfw/storagemanager/StorageAccessor.h @@ -12,9 +12,10 @@ class StorageAccessor : public ConstStorageAccessor { //! StorageManager classes have exclusive access to private variables. friend class PoolManager; friend class LocalPool; + friend class StorageManagerIF; public: - StorageAccessor(store_address_t storeId); + explicit StorageAccessor(store_address_t storeId); StorageAccessor(store_address_t storeId, StorageManagerIF* store); /** @@ -25,8 +26,8 @@ class StorageAccessor : public ConstStorageAccessor { * @param * @return */ - StorageAccessor& operator=(StorageAccessor&&); - StorageAccessor(StorageAccessor&&); + StorageAccessor& operator=(StorageAccessor&&) noexcept; + StorageAccessor(StorageAccessor&&) noexcept; ReturnValue_t write(uint8_t* data, size_t size, uint16_t offset = 0); uint8_t* data(); diff --git a/src/fsfw/storagemanager/StorageManagerIF.h b/src/fsfw/storagemanager/StorageManagerIF.h index 228d380b..2845e581 100644 --- a/src/fsfw/storagemanager/StorageManagerIF.h +++ b/src/fsfw/storagemanager/StorageManagerIF.h @@ -67,7 +67,12 @@ class StorageManagerIF { * @returnvalue::FAILED if data could not be added, storageId is unchanged then. */ virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size, - bool ignoreFault = false) = 0; + bool ignoreFault) = 0; + + virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size) { + return addData(storageId, data, size, false); + } + /** * @brief With deleteData, the storageManager frees the memory region * identified by packet_id. @@ -86,9 +91,10 @@ class StorageManagerIF { * @return @li returnvalue::OK on success. * @li failure code if deletion did not work */ - virtual ReturnValue_t deleteData(uint8_t* buffer, size_t size, - store_address_t* storeId = nullptr) = 0; - + virtual ReturnValue_t deleteData(uint8_t* buffer, size_t size, store_address_t* storeId) = 0; + virtual ReturnValue_t deleteData(uint8_t* buffer, size_t size) { + return deleteData(buffer, size, nullptr); + } /** * @brief Access the data by supplying a store ID. * @details @@ -97,7 +103,13 @@ class StorageManagerIF { * @param storeId * @return Pair of return value and a ConstStorageAccessor instance */ - virtual ConstAccessorPair getData(store_address_t storeId) = 0; + virtual ConstAccessorPair getData(store_address_t storeId) { + uint8_t* tempData = nullptr; + ConstStorageAccessor constAccessor(storeId, this); + ReturnValue_t status = modifyData(storeId, &tempData, &constAccessor.size_); + constAccessor.constDataPointer = tempData; + return {status, std::move(constAccessor)}; + } /** * @brief Access the data by supplying a store ID and a helper @@ -106,7 +118,13 @@ class StorageManagerIF { * @param constAccessor Wrapper function to access store data. * @return */ - virtual ReturnValue_t getData(store_address_t storeId, ConstStorageAccessor& constAccessor) = 0; + virtual ReturnValue_t getData(store_address_t storeId, ConstStorageAccessor& accessor) { + uint8_t* tempData = nullptr; + ReturnValue_t status = modifyData(storeId, &tempData, &accessor.size_); + accessor.assignStore(this); + accessor.constDataPointer = tempData; + return status; + } /** * @brief getData returns an address to data and the size of the data @@ -127,7 +145,12 @@ class StorageManagerIF { * @param storeId * @return Pair of return value and StorageAccessor helper */ - virtual AccessorPair modifyData(store_address_t storeId) = 0; + virtual AccessorPair modifyData(store_address_t storeId) { + StorageAccessor accessor(storeId, this); + ReturnValue_t status = modifyData(storeId, &accessor.dataPointer, &accessor.size_); + accessor.assignConstPointer(); + return {status, std::move(accessor)}; + } /** * Modify data by supplying a store ID and a StorageAccessor helper instance. @@ -135,7 +158,12 @@ class StorageManagerIF { * @param accessor Helper class to access the modifiable data. * @return */ - virtual ReturnValue_t modifyData(store_address_t storeId, StorageAccessor& accessor) = 0; + virtual ReturnValue_t modifyData(store_address_t storeId, StorageAccessor& accessor) { + accessor.assignStore(this); + ReturnValue_t status = modifyData(storeId, &accessor.dataPointer, &accessor.size_); + accessor.assignConstPointer(); + return status; + } /** * Get pointer and size of modifiable data by supplying the storeId @@ -154,12 +182,16 @@ class StorageManagerIF { * written to p_data! * @param storageId A pointer to the storageId to retrieve. * @param size The size of the space to be reserved. - * @param p_data A pointer to the element data is returned here. - * @return Returns @li returnvalue::OK if data was added. + * @param dataPtr A pointer to the element data is returned here. + * @return Returns @returnvalue::OK if data was added. * @returnvalue::FAILED if data could not be added, storageId is unchanged then. */ - virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** p_data, - bool ignoreFault = false) = 0; + virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr, + bool ignoreFault) = 0; + + virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) { + return getFreeElement(storageId, size, dataPtr, false); + } [[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0; From b3c0e2461154dcbacbd7ba958dff58fdd9289f44 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:31:55 +0200 Subject: [PATCH 05/14] bump changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe567de..da557d70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). for other modules PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655 which also includes a migration guide +- Move some generic `StorageManagerIF` implementations from `LocalPool` to + interface itself so it can be re-used more easily. Also add new + abstract function `bool hasDataAtId(store_address_t storeId) const`. + PR: # [v5.0.0] 25.07.2022 From e063b44899a3e6a74b0a54b9ae1533af723cec83 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:32:38 +0200 Subject: [PATCH 06/14] add link to PR --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da557d70..476632df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Move some generic `StorageManagerIF` implementations from `LocalPool` to interface itself so it can be re-used more easily. Also add new abstract function `bool hasDataAtId(store_address_t storeId) const`. - PR: + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/685 # [v5.0.0] 25.07.2022 From 1efc0d285541345dedbc22f778c731898ebe178d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:38:40 +0200 Subject: [PATCH 07/14] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe567de..b181fef8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). for other modules PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655 which also includes a migration guide +- Improvements for `AcceptsTelemetryIF` and `AcceptsTelecommandsIF`: + - Make functions `const` where it makes sense + - Add `const char* getName const` abstract function + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/684 # [v5.0.0] 25.07.2022 From 37390dfc746f09ab63e456e881ac669055a0f3ba Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:42:35 +0200 Subject: [PATCH 08/14] add missing changelog entry --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe567de..844e15c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [v6.0.0] +## Fixes + +- Bugfix for Serial Buffer Stream: Setting `doActive` to false now + actually fully disables printing. + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680/files + ## Added - Add new `UnsignedByteField` class From 2e310fca8d8adc987248fcd2e54a978e6ec2b379 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:43:45 +0200 Subject: [PATCH 09/14] add another missing changelog entry --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 844e15c3..6a5c40f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Bugfix for Serial Buffer Stream: Setting `doActive` to false now actually fully disables printing. - PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680/files + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680 ## Added @@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). for other modules PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655 which also includes a migration guide +- Bump Catch2 dependency to regular version `v3.1.0` + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/678 # [v5.0.0] 25.07.2022 From 655c944c0e114f8fa6aca6bcbe5d012c0b49600d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:45:35 +0200 Subject: [PATCH 10/14] another missing changelog entry --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5c40f8..40b446b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). which also includes a migration guide - Bump Catch2 dependency to regular version `v3.1.0` PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/678 - +- `SerialBufferAdapter`: Rename `setBuffer` to `setConstBuffer` and update + API to expect `const uint8_t*` accordingly. + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/677 + # [v5.0.0] 25.07.2022 ## Changes From 9a181aa6a8246e3d813b319f919e2f687e58ec34 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:47:50 +0200 Subject: [PATCH 11/14] another missing changelog entry --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b446b3..08690560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `SerialBufferAdapter`: Rename `setBuffer` to `setConstBuffer` and update API to expect `const uint8_t*` accordingly. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/677 - +- Remove the following user includes from `fsfw/events/Event.h` and + `fsfw/returnvalues/returnvalue.h`: + - `#include "events/subsystemIdRanges.h"` + - `#include "returnvalues/classIds.h"` + The user has to include those themselves now + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/675 + # [v5.0.0] 25.07.2022 ## Changes From 53638681207e43f44333fea994787f2074300c75 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:54:45 +0200 Subject: [PATCH 12/14] added another missing changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08690560..c239b819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Bugfix for Serial Buffer Stream: Setting `doActive` to false now actually fully disables printing. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680 +- `TcpTmTcServer.cpp`: The server was actually not able to handle + CCSDS packets which were clumped together. This has been fixed now. + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/673 ## Added From 8df6d934d7a42f4ca4b9c4c7732a718c5e22913f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:56:52 +0200 Subject: [PATCH 13/14] another missing changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c239b819..b676e953 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `#include "returnvalues/classIds.h"` The user has to include those themselves now PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/675 +- `DeviceHandlerBase`: Set command sender before calling `buildCommandFromCommand`. + This allows finishing action commands immediately inside the function. + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/672 # [v5.0.0] 25.07.2022 From 1a833e2d450ffb36598f8ef94b8d3a342b959d41 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Sep 2022 10:59:10 +0200 Subject: [PATCH 14/14] another missing changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b676e953..03cc0613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `DeviceHandlerBase`: Set command sender before calling `buildCommandFromCommand`. This allows finishing action commands immediately inside the function. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/672 +- `DeviceHandlerBase`: New signature of `handleDeviceTm` which expects + a `const SerializeIF&` and additional helper variant which expects `const uint8_t*` + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/671 # [v5.0.0] 25.07.2022