diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index e0efbce7..0e69a581 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -20,6 +20,7 @@ enum commonObjects : uint32_t { THERMAL_CONTROLLER = 0x43400001, ACS_CONTROLLER = 0x43000002, CORE_CONTROLLER = 0x43000003, + GLOBAL_JSON_CFG = 0x43000006, /* 0x44 ('D') for device handlers */ MGM_0_LIS3_HANDLER = 0x44120006, diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index aa5c663a..9c5a85af 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -4,8 +4,8 @@ #include "AxiPtmeConfig.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/returnvalues/returnvalue.h" -#include "returnvalues/classIds.h" #include "linux/obc/PtmeConfig.h" +#include "returnvalues/classIds.h" /** * @brief Class to configure donwlink specific parameters in the PTME IP core. diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index 94673c40..5645c47d 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -4,10 +4,9 @@ #include #include "devicedefinitions/SusDefinitions.h" +#include "events/subsystemIdRanges.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "mission/devices/max1227.h" - -#include "events/subsystemIdRanges.h" #include "returnvalues/classIds.h" /** diff --git a/mission/utility/CMakeLists.txt b/mission/utility/CMakeLists.txt index cdda4407..e2459ed1 100644 --- a/mission/utility/CMakeLists.txt +++ b/mission/utility/CMakeLists.txt @@ -1,2 +1,3 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE Timestamp.cpp ProgressPrinter.cpp - Filenaming.cpp GlobalConfigHandler.cpp) +target_sources( + ${LIB_EIVE_MISSION} PRIVATE Timestamp.cpp ProgressPrinter.cpp Filenaming.cpp + GlobalConfigHandler.cpp) diff --git a/mission/utility/GlobalConfigHandler.cpp b/mission/utility/GlobalConfigHandler.cpp index fc92714e..bb4b3d7d 100644 --- a/mission/utility/GlobalConfigHandler.cpp +++ b/mission/utility/GlobalConfigHandler.cpp @@ -13,13 +13,14 @@ #include "fsfw/serviceinterface/ServiceInterface.h" -MutexIF* GlobalConfigHandler::configLock = nullptr; +MutexIF* GlobalConfigHandler::CONFIG_LOCK = nullptr; + GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string configFilePath) : SystemObject(objectId), NVMParameterBase(configFilePath), commandQueue(QueueFactory::instance()->createMessageQueue(20)) { - if (configLock == nullptr) { - configLock = MutexFactory::instance()->createMutex(); + if (CONFIG_LOCK == nullptr) { + CONFIG_LOCK = MutexFactory::instance()->createMutex(); } } ReturnValue_t GlobalConfigHandler::initialize() { @@ -59,12 +60,12 @@ ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { ReturnValue_t GlobalConfigHandler::lockConfigFile() { ReturnValue_t result = returnvalue::OK; - result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10); + result = CONFIG_LOCK->lockMutex(MutexIF::TimeoutType::WAITING, 10); return result; } ReturnValue_t GlobalConfigHandler::unlockConfigFile() { ReturnValue_t result = returnvalue::OK; - result = configLock->unlockMutex(); + result = CONFIG_LOCK->unlockMutex(); return result; } diff --git a/mission/utility/GlobalConfigHandler.h b/mission/utility/GlobalConfigHandler.h index 18a6ec60..80e141c6 100644 --- a/mission/utility/GlobalConfigHandler.h +++ b/mission/utility/GlobalConfigHandler.h @@ -63,7 +63,7 @@ class GlobalConfigHandler : public SystemObject, std::string getConfigFileName(); private: - static MutexIF* configLock; + static MutexIF* CONFIG_LOCK; ReturnValue_t lockConfigFile(); ReturnValue_t unlockConfigFile(); diff --git a/tmtc b/tmtc index 603b7e85..debbe981 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423 +Subproject commit debbe9813b1ff0d395cccabad84ee4afe10f64e5 diff --git a/unittest/controller/testConfigFileHandler.cpp b/unittest/controller/testConfigFileHandler.cpp index 0f994fba..5445a558 100644 --- a/unittest/controller/testConfigFileHandler.cpp +++ b/unittest/controller/testConfigFileHandler.cpp @@ -14,52 +14,52 @@ TEST_CASE("Configfile Handler", "[ConfigHandler]") { sif::debug << "Testcase config file handler" << std::endl; testEnvironment::initialize(); // Init handler - GlobalConfigHandler confighandler = GlobalConfigHandler(objects::CONFIG_TEST, "JSON.config"); - REQUIRE(confighandler.initialize() == HasReturnvaluesIF::RETURN_OK); + GlobalConfigHandler confighandler = GlobalConfigHandler(objects::GLOBAL_JSON_CFG, "JSON.config"); + REQUIRE(confighandler.initialize() == returnvalue::OK); // Reset handler - REQUIRE(confighandler.ResetConfigFile() == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.ResetConfigFile() == returnvalue::OK); // Get and set double as well as int values double doubleData = 0.0; - REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleData) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleData) == returnvalue::OK); REQUIRE(doubleData == 5.0); doubleData = 55.9; double doubleDataRead = 0; - REQUIRE(confighandler.setConfigFileValue(PARAM0, doubleData) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.setConfigFileValue(PARAM0, doubleData) == returnvalue::OK); - REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleDataRead) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleDataRead) == returnvalue::OK); REQUIRE(doubleDataRead == doubleData); - REQUIRE(confighandler.WriteConfigFile() == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.WriteConfigFile() == returnvalue::OK); int intData = 0; - REQUIRE(confighandler.getConfigFileValue(PARAM1, intData) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.getConfigFileValue(PARAM1, intData) == returnvalue::OK); REQUIRE(intData == 905); intData = 1337; int intDataRead = 0; - REQUIRE(confighandler.setConfigFileValue(PARAM1, intData) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.setConfigFileValue(PARAM1, intData) == returnvalue::OK); - REQUIRE(confighandler.getConfigFileValue(PARAM1, intDataRead) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.getConfigFileValue(PARAM1, intDataRead) == returnvalue::OK); REQUIRE(intDataRead == intData); - REQUIRE(confighandler.WriteConfigFile() == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.WriteConfigFile() == returnvalue::OK); // Check file name REQUIRE(confighandler.getConfigFileName() == "JSON.config"); // Reset and check if it worked - REQUIRE(confighandler.ResetConfigFile() == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.ResetConfigFile() == returnvalue::OK); doubleData = 0.0; - REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleData) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(confighandler.getConfigFileValue(PARAM0, doubleData) == returnvalue::OK); REQUIRE(doubleData == 5.0); // Test invalid Parameter REQUIRE(confighandler.getConfigFileValue(PARAM2, doubleData) != - HasReturnvaluesIF::RETURN_OK); // NVMParameterBase::KEY_NOT_EXISTS is private, why? - REQUIRE(confighandler.setConfigFileValue(PARAM2, doubleData) != HasReturnvaluesIF::RETURN_OK); + returnvalue::OK); // NVMParameterBase::KEY_NOT_EXISTS is private, why? + REQUIRE(confighandler.setConfigFileValue(PARAM2, doubleData) != returnvalue::OK); }