From 22585773e7b31975a0335344036d3b6baa4d0fcb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Sep 2022 15:31:34 +0200 Subject: [PATCH] bugfix in fsfw --- config/common/definitions.h | 12 +++++++++++ config/commonConfig.h.in | 13 ----------- example/core/GenericFactory.cpp | 38 ++++++++++++++++++--------------- example/core/GenericFactory.h | 4 +++- 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/config/common/definitions.h b/config/common/definitions.h index a7095fb..f518d5c 100644 --- a/config/common/definitions.h +++ b/config/common/definitions.h @@ -19,3 +19,15 @@ enum ServiceIds : uint8_t { PUS_SERVICE_200 = 200 }; } + +namespace common { + +/** + * The APID is a 14 bit identifier which can be used to distinguish processes and applications + * on a spacecraft. For more details, see the related ECSS/CCSDS standards. + * For this example, we are going to use a constant APID + */ +static constexpr uint16_t COMMON_PUS_APID = 0xEF; +static constexpr uint16_t COMMON_CFDP_APID = 0xF0; + +} // namespace common diff --git a/config/commonConfig.h.in b/config/commonConfig.h.in index 79e6db3..db19370 100644 --- a/config/commonConfig.h.in +++ b/config/commonConfig.h.in @@ -36,21 +36,8 @@ #define OBSW_ADD_CONTROLLER_DEMO 1 #define OBSW_CONTROLLER_PRINTOUT 1 -/** - * The APID is a 14 bit identifier which can be used to distinguish processes and applications - * on a spacecraft. For more details, see the related ECSS/CCSDS standards. - * For this example, we are going to use a constant APID -*/ -static const uint16_t COMMON_APID = 0xEF; - #ifdef __cplusplus -namespace cfg { - -static constexpr uint32_t OBSW_MAX_SCHEDULED_TCS = @OBSW_MAX_SCHEDULED_TCS@; - -} - #endif /* __cplusplus */ #endif /* COMMON_COMMONCONFIG_H_ */ diff --git a/example/core/GenericFactory.cpp b/example/core/GenericFactory.cpp index 21d0cb9..882bc61 100644 --- a/example/core/GenericFactory.cpp +++ b/example/core/GenericFactory.cpp @@ -2,6 +2,7 @@ #include "OBSWConfig.h" #include "common/definitions.h" +#include "definitions.h" #include "example/test/FsfwExampleTask.h" #include "example/test/FsfwReaderTask.h" #include "example/utility/TmFunnel.h" @@ -33,9 +34,9 @@ #include "fsfw_tests/integration/devices/TestEchoComIF.h" #include "fsfw_tests/internal/InternalUnitTester.h" #include "objects/systemObjectList.h" -#include "tmtc/apid.h" -void ObjectFactory::produceGenericObjects(TmFunnel **tmFunnel, StorageManagerIF &tcStore) { +void ObjectFactory::produceGenericObjects(TmFunnel **tmFunnel, CcsdsDistributor **ccsdsDistrib, + StorageManagerIF &tcStore) { #if OBSW_ADD_CORE_COMPONENTS == 1 /* Framework objects */ new EventManager(objects::EVENT_MANAGER); @@ -43,33 +44,36 @@ void ObjectFactory::produceGenericObjects(TmFunnel **tmFunnel, StorageManagerIF new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); auto *stamperAndReader = new CdsShortTimeStamper(objects::TIME_STAMPER); new VerificationReporter(); - auto *ccsdsDistrib = new CcsdsDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR); - new PusDistributor(apid::APID, objects::PUS_DISTRIBUTOR, ccsdsDistrib); + *ccsdsDistrib = new CcsdsDistributor(common::COMMON_PUS_APID, objects::CCSDS_DISTRIBUTOR, &tcStore); + new PusDistributor(common::COMMON_PUS_APID, objects::PUS_DISTRIBUTOR, *ccsdsDistrib); *tmFunnel = new TmFunnel(*stamperAndReader, objects::TM_FUNNEL); #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ /* PUS stack */ #if OBSW_ADD_PUS_STACK == 1 - new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::APID, + new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, common::COMMON_PUS_APID, pus::PUS_SERVICE_1, objects::TM_FUNNEL, 5); - new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, apid::APID, pus::PUS_SERVICE_2, 3, - 10); - new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::APID, pus::PUS_SERVICE_3); - 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, + new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, common::COMMON_PUS_APID, + pus::PUS_SERVICE_2, 3, 10); + new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, common::COMMON_PUS_APID, + pus::PUS_SERVICE_3); + new Service5EventReporting(PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, + common::COMMON_PUS_APID, pus::PUS_SERVICE_5), + 20, 40); + new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, common::COMMON_PUS_APID, pus::PUS_SERVICE_8, 3, 10); 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, + PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, common::COMMON_PUS_APID, pus::PUS_SERVICE_9)); + new Service17Test( + PsbParams(objects::PUS_SERVICE_17_TEST, common::COMMON_PUS_APID, pus::PUS_SERVICE_17)); + new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, common::COMMON_PUS_APID, pus::PUS_SERVICE_20); #if OBSW_ADD_CORE_COMPONENTS == 1 new Service11TelecommandScheduling( - PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, apid::APID, pus::PUS_SERVICE_11), - ccsdsDistrib); + PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, common::COMMON_PUS_APID, pus::PUS_SERVICE_11), + *ccsdsDistrib); #endif - new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::APID, + new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, common::COMMON_PUS_APID, pus::PUS_SERVICE_200); #endif /* OBSW_ADD_PUS_STACK == 1 */ diff --git a/example/core/GenericFactory.h b/example/core/GenericFactory.h index f51b20e..7f33d7e 100644 --- a/example/core/GenericFactory.h +++ b/example/core/GenericFactory.h @@ -6,6 +6,7 @@ #include "fsfw/storagemanager/StorageManagerIF.h" class TmFunnel; +class CcsdsDistributor; namespace ObjectFactory { @@ -13,7 +14,8 @@ namespace ObjectFactory { * @brief Produce hardware independant objects. Called by bsp specific * object factory. */ -void produceGenericObjects(TmFunnel** funnel, StorageManagerIF& tcStore); +void produceGenericObjects(TmFunnel** funnel, CcsdsDistributor** ccsdsDistributor, + StorageManagerIF& tcStore); } // namespace ObjectFactory