From 847228911fb13143b7df31617be4c2a505e1e903 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Nov 2024 18:04:36 +0100 Subject: [PATCH 1/3] add option to add Catch2 for library users --- CMakeLists.txt | 5 ++--- contrib/fsfw_contrib/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eee2c6b7..dfa85fd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,7 @@ endif() option(FSFW_BUILD_TESTS "Build unittest binary in addition to static library. Requires Catch2" OFF) +option(FSFW_ADD_CATCH2 "Add Catch2 unittest framework dependency" OFF) option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF) option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF) if(FSFW_BUILD_TESTS) @@ -141,9 +142,7 @@ if(FSFW_BUILD_TESTS) configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) project(${FSFW_TEST_TGT} CXX C) - add_executable( - ${FSFW_TEST_TGT} - ) + add_executable(${FSFW_TEST_TGT}) if(IPO_SUPPORTED AND FSFW_ENABLE_IPO) set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/contrib/fsfw_contrib/CMakeLists.txt b/contrib/fsfw_contrib/CMakeLists.txt index a987f2df..3c5d12ad 100644 --- a/contrib/fsfw_contrib/CMakeLists.txt +++ b/contrib/fsfw_contrib/CMakeLists.txt @@ -11,6 +11,6 @@ if(FSFW_ADD_SGP4_PROPAGATOR) endif() add_subdirectory(etl-20.39.4) -if(FSFW_BUILD_TESTS) +if(FSFW_BUILD_TESTS OR FSFW_ADD_CATCH2) add_subdirectory(Catch2-3.7.1) -endif() \ No newline at end of file +endif() From 7b01b6655feecb37cfbeb3c40a1eea6b13d7e2f4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Nov 2024 11:07:24 +0100 Subject: [PATCH 2/3] added missing include --- src/fsfw/timemanager/TimeReaderIF.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/timemanager/TimeReaderIF.h b/src/fsfw/timemanager/TimeReaderIF.h index aa64b754..6735b10f 100644 --- a/src/fsfw/timemanager/TimeReaderIF.h +++ b/src/fsfw/timemanager/TimeReaderIF.h @@ -3,6 +3,7 @@ #include #include +#include #include "fsfw/platform.h" From 393773ffe73bd07c3735b7e95f0196b41e704705 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Nov 2024 15:03:17 +0100 Subject: [PATCH 3/3] cond code to string converter --- src/fsfw/cfdp/definitions.h | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/fsfw/cfdp/definitions.h b/src/fsfw/cfdp/definitions.h index adab1d0f..af204f51 100644 --- a/src/fsfw/cfdp/definitions.h +++ b/src/fsfw/cfdp/definitions.h @@ -158,6 +158,53 @@ enum class ProxyOpMessageType : uint8_t { CLOSURE = 0x0b }; +static inline const char* conditionCodeString(ConditionCode code) { + switch (code) { + case (ConditionCode::NO_ERROR): { + return "No Error"; + } + case (ConditionCode::POSITIVE_ACK_LIMIT_REACHED): { + return "Positive ACK limit reached"; + } + case (ConditionCode::KEEP_ALIVE_LIMIT_REACHED): { + return "Keep alive limit reached"; + } + case (ConditionCode::INVALID_TRANSMISSION_MODE): { + return "Invalid transmission mode"; + } + case (ConditionCode::FILESTORE_REJECTION): { + return "Filestore rejection"; + } + case (ConditionCode::FILE_CHECKSUM_FAILURE): { + return "File checksum failure"; + } + case (ConditionCode::FILE_SIZE_ERROR): { + return "File size error"; + } + case (ConditionCode::NAK_LIMIT_REACHED): { + return "NAK limit reached"; + } + case (ConditionCode::INACTIVITY_DETECTED): { + return "Inactivity detected"; + } + case (ConditionCode::CHECK_LIMIT_REACHED): { + return "Check limit reached"; + } + case (ConditionCode::UNSUPPORTED_CHECKSUM_TYPE): { + return "Unsupported checksum type"; + } + case (ConditionCode::SUSPEND_REQUEST_RECEIVED): { + return "Suspend request received"; + } + case (ConditionCode::CANCEL_REQUEST_RECEIVED): { + return "Cancel request received"; + } + default: { + return "Invalid condition code value"; + } + } +} + } // namespace cfdp #endif /* FSFW_SRC_FSFW_CFDP_PDU_DEFINITIONS_H_ */