unittest builds now
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-09-29 13:20:05 +02:00
parent 26dc4ba56e
commit 1463963532
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
8 changed files with 29 additions and 27 deletions

View File

@ -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,

View File

@ -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.

View File

@ -4,10 +4,9 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#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"
/**

View File

@ -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)

View File

@ -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;
}

View File

@ -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();

2
tmtc

@ -1 +1 @@
Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423
Subproject commit debbe9813b1ff0d395cccabad84ee4afe10f64e5

View File

@ -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);
}