From 43060b3be7114813947d82e6eca55d069181988d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Jul 2022 11:33:40 +0200 Subject: [PATCH] changes for updated TMTC API --- example/controller/FsfwTestController.cpp | 8 +++---- example/core/GenericFactory.cpp | 29 ++++++++++++----------- example/utility/TmFunnel.cpp | 15 +++++++----- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/example/controller/FsfwTestController.cpp b/example/controller/FsfwTestController.cpp index 2c4e911..218f7e8 100644 --- a/example/controller/FsfwTestController.cpp +++ b/example/controller/FsfwTestController.cpp @@ -137,7 +137,7 @@ void FsfwTestController::handleChangedDataset(sid_t sid, if (verboseLevel >= 1) { char const *printout = nullptr; - if (storeId == storeId::INVALID_STORE_ADDRESS) { + if (storeId == store_address_t::invalid()) { printout = "Notification"; } else { printout = "Snapshot"; @@ -156,7 +156,7 @@ void FsfwTestController::handleChangedDataset(sid_t sid, printout, sid.objectId, sid.ownerSetId); #endif - if (storeId == storeId::INVALID_STORE_ADDRESS) { + if (storeId == store_address_t::invalid()) { if (sid.objectId == device0Id) { PoolReadGuard readHelper(&deviceDataset0.testFloat3Vec); float floatVec[3]; @@ -189,7 +189,7 @@ void FsfwTestController::handleChangedPoolVariable(gp_id_t globPoolId, if (verboseLevel >= 1) { char const *printout = nullptr; - if (storeId == storeId::INVALID_STORE_ADDRESS) { + if (storeId == store_address_t::invalid()) { printout = "Notification"; } else { printout = "Snapshot"; @@ -209,7 +209,7 @@ void FsfwTestController::handleChangedPoolVariable(gp_id_t globPoolId, printout, globPoolId.objectId, globPoolId.localPoolId); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - if (storeId == storeId::INVALID_STORE_ADDRESS) { + if (storeId == store_address_t::invalid()) { if (globPoolId.objectId == device0Id) { PoolReadGuard readHelper(&deviceDataset0.testUint8Var); #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/example/core/GenericFactory.cpp b/example/core/GenericFactory.cpp index 322c43a..f1082f0 100644 --- a/example/core/GenericFactory.cpp +++ b/example/core/GenericFactory.cpp @@ -21,7 +21,7 @@ #include "fsfw/pus/Service8FunctionManagement.h" #include "fsfw/pus/Service9TimeManagement.h" #include "fsfw/tcdistribution/CCSDSDistributor.h" -#include "fsfw/tcdistribution/PUSDistributor.h" +#include "fsfw/tcdistribution/PusDistributor.h" #include "fsfw/timemanager/CdsShortTimeStamper.h" #include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw_tests/integration/assemblies/TestAssembly.h" @@ -39,10 +39,10 @@ void ObjectFactory::produceGenericObjects() { new EventManager(objects::EVENT_MANAGER); new HealthTable(objects::HEALTH_TABLE); new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); - new TimeStamper(objects::TIME_STAMPER); + new CdsShortTimeStamper(objects::TIME_STAMPER); auto *ccsdsDistrib = new CCSDSDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR); - new PUSDistributor(apid::APID, objects::PUS_DISTRIBUTOR, + new PusDistributor(apid::APID, objects::PUS_DISTRIBUTOR, objects::CCSDS_DISTRIBUTOR); new TmFunnel(objects::TM_FUNNEL); #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ @@ -56,19 +56,19 @@ void ObjectFactory::produceGenericObjects() { pus::PUS_SERVICE_2, 3, 10); new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::APID, pus::PUS_SERVICE_3); - new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::APID, - pus::PUS_SERVICE_5, 50); + new Service5EventReporting(PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::APID, + pus::PUS_SERVICE_5), 20 , 40); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::APID, pus::PUS_SERVICE_8, 3, 10); - new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::APID, - pus::PUS_SERVICE_9); - new Service17Test(objects::PUS_SERVICE_17_TEST, apid::APID, - pus::PUS_SERVICE_17); + new Service9TimeManagement(PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::APID, + pus::PUS_SERVICE_9)); + new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, apid::APID, + pus::PUS_SERVICE_17)); new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::APID, pus::PUS_SERVICE_20); #if OBSW_ADD_CORE_COMPONENTS == 1 new Service11TelecommandScheduling( - objects::PUS_SERVICE_11_TC_SCHEDULER, apid::APID, pus::PUS_SERVICE_11, + PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, apid::APID, pus::PUS_SERVICE_11), ccsdsDistrib); #endif new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::APID, @@ -151,13 +151,14 @@ void Factory::setStaticFrameworkObjectIds() { // No storage object for now. TmFunnel::storageDestination = objects::NO_OBJECT; - PusServiceBase::packetSource = objects::PUS_DISTRIBUTOR; - PusServiceBase::packetDestination = objects::TM_FUNNEL; + PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_DISTRIBUTOR; + PusServiceBase::PACKET_DESTINATION = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketSource = objects::PUS_DISTRIBUTOR; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; - VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + VerificationReporter::DEFAULT_REPORTER = objects::TC_VERIFICATOR; + VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION; - TmPacketBase::timeStamperId = objects::TIME_STAMPER; + // TmPacketBase::timeStamperId = objects::TIME_STAMPER; } diff --git a/example/utility/TmFunnel.cpp b/example/utility/TmFunnel.cpp index d8a0b1b..abbe68b 100644 --- a/example/utility/TmFunnel.cpp +++ b/example/utility/TmFunnel.cpp @@ -1,6 +1,7 @@ #include "TmFunnel.h" #include +#include "fsfw/tmtcpacket/pus/tm.h" #include #include #include @@ -48,12 +49,14 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - TmPacketPusC packet(packetData); - packet.setPacketSequenceCount(this->sourceSequenceCount); - sourceSequenceCount++; - sourceSequenceCount = - sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT; - packet.setErrorControl(); + PusTmZeroCopyWriter packet(packetData, size); + result = packet.parseDataWithoutCrcCheck(); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + packet.setSequenceCount(sourceSequenceCount++); + sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT; + packet.updateErrorControl(); result = tmQueue->sendToDefault(message); if (result != HasReturnvaluesIF::RETURN_OK) {