added local parameter handler
This commit is contained in:
parent
a13ae7abcc
commit
7dae81c122
@ -31,7 +31,8 @@ class LocalParameterHandler : public NVMParameterBase {
|
||||
ReturnValue_t initialize();
|
||||
|
||||
/**
|
||||
* @brief Function to add parameter to json file
|
||||
* @brief Function to add parameter to json file. If the json file does
|
||||
* not yet exist it will be created here.
|
||||
*
|
||||
* @param key The string to identify the parameter
|
||||
* @param value The value to set for this parameter
|
||||
@ -43,6 +44,17 @@ class LocalParameterHandler : public NVMParameterBase {
|
||||
*/
|
||||
template<typename T> ReturnValue_t addParameter(std::string key, T value);
|
||||
|
||||
/**
|
||||
* @brief Function will update a parameter which already exists in the json
|
||||
* file
|
||||
*
|
||||
* @param key The unique string to identify the parameter to update
|
||||
* @param value The new new value to set
|
||||
*
|
||||
* @return OK if successful, otherwise error return value
|
||||
*/
|
||||
template<typename T> ReturnValue_t updateParameter(std::string key, T value);
|
||||
|
||||
private:
|
||||
|
||||
// Name relative to mount point of SD card where parameters will be stored
|
||||
@ -63,4 +75,16 @@ template<typename T> inline ReturnValue_t LocalParameterHandler::addParameter(st
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
template<typename T> inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) {
|
||||
ReturnValue_t result = setValue(key, value);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = writeJsonFile();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
#endif /* BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ */
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit dac2d210b597adfaf45bd5ae6a4c027599927601
|
||||
Subproject commit c8469ca6473f64676e007e2e2f1c733fe6252053
|
@ -1,28 +1,65 @@
|
||||
#include "PdecConfig.h"
|
||||
|
||||
#include "fsfw/filesystem/HasFileSystemIF.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "pdecconfigdefs.h"
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
PdecConfig::PdecConfig()
|
||||
: localParameterHandler("conf/pdecconfig", SdCardManager::instance()) {
|
||||
}
|
||||
PdecConfig::PdecConfig() : localParameterHandler("conf/pdecconfig", SdCardManager::instance()) {}
|
||||
|
||||
PdecConfig::~PdecConfig() {}
|
||||
|
||||
void PdecConfig::setMemoryBaseAddress(uint32_t* memoryBaseAddress_) {
|
||||
memoryBaseAddress = memoryBaseAddress_;
|
||||
memoryBaseAddress = memoryBaseAddress_;
|
||||
}
|
||||
|
||||
ReturnValue_t PdecConfig::write() {
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::write: Memory base address not set" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::write: Memory base address not set" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
ReturnValue_t result = initializePersistentParameters();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = writeFrameHeaderFirstOctet();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = writeFrameHeaderSecondOctet();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
writeMapConfig();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
writeFrameHeaderFirstOctet();
|
||||
writeFrameHeaderSecondOctet();
|
||||
writeMapConfig();
|
||||
return returnvalue::FAILED;
|
||||
ReturnValue_t PdecConfig::initializePersistentParameters() {
|
||||
ReturnValue_t result = localParameterHandler.initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
if (result == HasFileSystemIF::FILE_DOES_NOT_EXIST) {
|
||||
result = createPersistentConfig();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PdecConfig::createPersistentConfig() {
|
||||
ReturnValue_t result = localParameterHandler.addParameter(
|
||||
pdecconfigdefs::paramkeys::POSITIVE_WINDOW, pdecconfigdefs::defaultvalue::positiveWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PdecConfig::createPersistentConfig: Failed to set positive window" << std::endl;
|
||||
return result;
|
||||
}
|
||||
ReturnValue_t result = localParameterHandler.addParameter(
|
||||
pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, pdecconfigdefs::defaultvalue::negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PdecConfig::createPersistentConfig: Failed to set negative window" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint32_t PdecConfig::getImrReg() {
|
||||
@ -31,83 +68,110 @@ uint32_t PdecConfig::getImrReg() {
|
||||
}
|
||||
|
||||
ReturnValue_t PdecConfig::setPositiveWindow(uint8_t pw) {
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::setPositiveWindow: Memory base address not set"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
positiveWindow = pw;
|
||||
// Rewrite second config word which contains the positive window parameter
|
||||
writeFrameHeaderSecondOctet();
|
||||
return returnvalue::OK;
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::setPositiveWindow: Memory base address not set" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.updateParameter(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, pw);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
// Rewrite second config word which contains the positive window parameter
|
||||
writeFrameHeaderSecondOctet();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PdecConfig::setNegativeWindow(uint8_t nw) {
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::setPositiveWindow: Memory base address not set"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
negativeWindow = nw;
|
||||
// Rewrite second config word which contains the negative window parameter
|
||||
writeFrameHeaderSecondOctet();
|
||||
return returnvalue::OK;
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
sif::error << "PdecConfig::setPositiveWindow: Memory base address not set" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.updateParameter(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, nw);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
// Rewrite second config word which contains the negative window parameter
|
||||
writeFrameHeaderSecondOctet();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint8_t PdecConfig::getPositiveWindow() {
|
||||
return positiveWindow;
|
||||
ReturnValue_t PdecConfig::getPositiveWindow(uint8_t& positiveWindow) {
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint8_t PdecConfig::getNegativeWindow() {
|
||||
return negativeWindow;
|
||||
ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) {
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PdecConfig::writeFrameHeaderFirstOctet() {
|
||||
uint32_t word = 0;
|
||||
word |= (VERSION_ID << 30);
|
||||
ReturnValue_t PdecConfig::writeFrameHeaderFirstOctet() {
|
||||
uint32_t word = 0;
|
||||
word |= (VERSION_ID << 30);
|
||||
|
||||
// Setting the bypass flag and the control command flag should not have any
|
||||
// implication on the operation of the PDEC IP Core
|
||||
word |= (BYPASS_FLAG << 29);
|
||||
word |= (CONTROL_COMMAND_FLAG << 28);
|
||||
// Setting the bypass flag and the control command flag should not have any
|
||||
// implication on the operation of the PDEC IP Core
|
||||
word |= (BYPASS_FLAG << 29);
|
||||
word |= (CONTROL_COMMAND_FLAG << 28);
|
||||
|
||||
word |= (RESERVED_FIELD_A << 26);
|
||||
word |= (SPACECRAFT_ID << 16);
|
||||
word |= (VIRTUAL_CHANNEL << 10);
|
||||
word |= (DUMMY_BITS << 8);
|
||||
word |= localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW,
|
||||
pdecconfigdefs::defaultvalue::positiveWindow);
|
||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = word;
|
||||
word |= (RESERVED_FIELD_A << 26);
|
||||
word |= (SPACECRAFT_ID << 16);
|
||||
word |= (VIRTUAL_CHANNEL << 10);
|
||||
word |= (DUMMY_BITS << 8);
|
||||
uint8_t negativeWindow = 0;
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
word |= negativeWindow;
|
||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = word;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PdecConfig::writeFrameHeaderSecondOctet() {
|
||||
uint8_t negativeWindow = localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW,
|
||||
pdecconfigdefs::defaultvalue::negativeWindow);
|
||||
uint32_t word = 0;
|
||||
word = 0;
|
||||
word |= (negativeWindow << 24);
|
||||
word |= (HIGH_AU_MAP_ID << 16);
|
||||
word |= (ENABLE_DERANDOMIZER << 8);
|
||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = word;
|
||||
ReturnValue_t PdecConfig::writeFrameHeaderSecondOctet() {
|
||||
uint8_t negativeWindow = 0;
|
||||
ReturnValue_t result =
|
||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
uint32_t word = 0;
|
||||
word = 0;
|
||||
word |= (negativeWindow << 24);
|
||||
word |= (HIGH_AU_MAP_ID << 16);
|
||||
word |= (ENABLE_DERANDOMIZER << 8);
|
||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = word;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PdecConfig::writeMapConfig() {
|
||||
// Configure all MAP IDs as invalid
|
||||
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
|
||||
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) =
|
||||
NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION;
|
||||
}
|
||||
// Configure all MAP IDs as invalid
|
||||
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
|
||||
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) =
|
||||
NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION;
|
||||
}
|
||||
|
||||
// All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory)
|
||||
uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
|
||||
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + 1) =
|
||||
(NO_DESTINATION << 24) | (NO_DESTINATION << 16) | (NO_DESTINATION << 8) | routeToPm;
|
||||
// All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory)
|
||||
uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
|
||||
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + 1) =
|
||||
(NO_DESTINATION << 24) | (NO_DESTINATION << 16) | (NO_DESTINATION << 8) | routeToPm;
|
||||
|
||||
// Write map id clock frequencies
|
||||
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
|
||||
*(memoryBaseAddress + MAP_CLK_FREQ_OFFSET + idx / 4) =
|
||||
MAP_CLK_FREQ << 24 | MAP_CLK_FREQ << 16 | MAP_CLK_FREQ << 8 | MAP_CLK_FREQ;
|
||||
}
|
||||
// Write map id clock frequencies
|
||||
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
|
||||
*(memoryBaseAddress + MAP_CLK_FREQ_OFFSET + idx / 4) =
|
||||
MAP_CLK_FREQ << 24 | MAP_CLK_FREQ << 16 | MAP_CLK_FREQ << 8 | MAP_CLK_FREQ;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t PdecConfig::calcMapAddrEntry(uint8_t moduleId) {
|
||||
@ -126,6 +190,3 @@ uint8_t PdecConfig::getOddParity(uint8_t number) {
|
||||
parityBit = ~(countBits & 0x1) & 0x1;
|
||||
return parityBit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -45,8 +45,8 @@ class PdecConfig {
|
||||
ReturnValue_t setPositiveWindow(uint8_t pw);
|
||||
ReturnValue_t setNegativeWindow(uint8_t nw);
|
||||
|
||||
uint8_t getPositiveWindow();
|
||||
uint8_t getNegativeWindow();
|
||||
ReturnValue_t getPositiveWindow(uint8_t& positiveWindow);
|
||||
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
|
||||
|
||||
private:
|
||||
|
||||
@ -96,8 +96,15 @@ class PdecConfig {
|
||||
bool enableTcAbortIrq = true;
|
||||
bool enableNewFarIrq = true;
|
||||
|
||||
void writeFrameHeaderFirstOctet();
|
||||
void writeFrameHeaderSecondOctet();
|
||||
ReturnValue_t initializePersistentParameters();
|
||||
/**
|
||||
* @brief If the json file containing the persistent config parameters does
|
||||
* not exist it will be created here.
|
||||
*/
|
||||
ReturnValue_t createPersistentConfig();
|
||||
|
||||
ReturnValue_t writeFrameHeaderFirstOctet();
|
||||
ReturnValue_t writeFrameHeaderSecondOctet();
|
||||
void writeMapConfig();
|
||||
|
||||
/**
|
||||
|
@ -78,12 +78,11 @@ ReturnValue_t PdecHandler::initialize() {
|
||||
}
|
||||
|
||||
globalConfigHandler = ObjectManager::instance()->get<StorageManagerIF>(objects::GLOBAL_JSON_CFG);
|
||||
if (globalConfigHandler == nullptr) {
|
||||
sif::error << "PdecHandler::initialize: Invalid global config handler" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
if (globalConfigHandler == nullptr) {
|
||||
sif::error << "PdecHandler::initialize: Invalid global config handler" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
pdecConfig.setGlobalConfigHandler(globalConfigHandler);
|
||||
result = pdecConfig.write();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PdecHandler::initialize: Failed to write PDEC config" << std::endl;
|
||||
@ -271,19 +270,39 @@ ReturnValue_t PdecHandler::getParameter(uint8_t domainId, uint8_t uniqueIdentifi
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
parameterWrapper->set();
|
||||
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
|
||||
uint8_t positiveWindow = 0;
|
||||
result = pdecConfig.getPositiveWindow(positiveWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PdecHandler::getParameter: Failed to get positive window from pdec config"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
parameterWrapper->set(positiveWindow);
|
||||
result = pdecConfig.setPositiveWindow(newVal);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PdecHandler::getParameter: Failed to set positive window" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
} else if ((domainId == 0) and
|
||||
(uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::TRANSMITTER_TIMEOUT))) {
|
||||
} else if ((domainId == 0) and (uniqueIdentifier == ParameterId::NEGATIVE_WINDOW)) {
|
||||
uint8_t newVal = 0;
|
||||
ReturnValue_t result = newValues->getElement(&newVal);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
parameterWrapper->set(transmitterTimeout);
|
||||
transmitterTimeout = newVal;
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
uint8_t negativeWindow = 0;
|
||||
result = pdecConfig.getNegativeWindow(negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PdecHandler::getParameter: Failed to get negative window from pdec config"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
parameterWrapper->set(negativeWindow);
|
||||
result = pdecConfig.setNegativeWindow(negativeWindow);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PdecHandler::getParameter: Failed to set negative window" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
|
@ -23,24 +23,23 @@ GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string confi
|
||||
CONFIG_LOCK = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t GlobalConfigHandler::initialize() {
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize failed with "
|
||||
sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with "
|
||||
<< result << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
result = readConfigFile();
|
||||
result = ReadConfigFile();
|
||||
if (result != returnvalue::OK) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName()
|
||||
<< std::endl;
|
||||
#endif
|
||||
result = resetConfigFile();
|
||||
result = ResetConfigFile();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -64,7 +63,6 @@ ReturnValue_t GlobalConfigHandler::lockConfigFile() {
|
||||
result = CONFIG_LOCK->lockMutex(MutexIF::TimeoutType::WAITING, 10);
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t GlobalConfigHandler::unlockConfigFile() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
result = CONFIG_LOCK->unlockMutex();
|
||||
@ -72,21 +70,34 @@ ReturnValue_t GlobalConfigHandler::unlockConfigFile() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ReturnValue_t GlobalConfigHandler::setConfigFileValue(std::string paramName, T data) {
|
||||
ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
ReturnValue_t resultSet = returnvalue::OK;
|
||||
|
||||
result = lockConfigFile();
|
||||
if (result != returnvalue::OK) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "GlobalConfigHandler::setConfigFileValue: Lock mutex failed with " << result
|
||||
sif::info << "GlobalConfigHandler::setConfigFileValue lock mutex failed with " << result
|
||||
<< std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
// If value exists it is updated otherwise a new entry will be created
|
||||
resultSet = insertValue(paramName, data);
|
||||
std::string paramString;
|
||||
paramString = PARAM_KEY_MAP[paramID];
|
||||
|
||||
// Check if key exists in map before setting value. No check is done in setValue! Somehow
|
||||
// PARAM_KEY_MAP.count(paramID) == 0 does not work
|
||||
if (paramString.empty() == true) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "GlobalConfigHandler::setConfigFileValue ParamId " << PARAM_KEY_MAP[paramID]
|
||||
<< " not found!" << std::endl;
|
||||
#endif
|
||||
triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0);
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
resultSet = setValue(PARAM_KEY_MAP[paramID], data);
|
||||
if (resultSet != returnvalue::OK) {
|
||||
triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0);
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
@ -106,7 +117,6 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(std::string paramName, T d
|
||||
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
@ -151,10 +161,8 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() {
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
for(const auto& keyMap: PARAM_KEY_MAP) {
|
||||
insertValue(keyMap.second, PARAM0_DEFAULT);
|
||||
}
|
||||
insertValue(PARAM_KEY_MAP[PARAM0], PARAM0_DEFAULT);
|
||||
insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT);
|
||||
|
||||
result = unlockConfigFile();
|
||||
if (result != returnvalue::OK) {
|
||||
@ -166,8 +174,7 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t GlobalConfigHandler::writeConfigFile() {
|
||||
ReturnValue_t GlobalConfigHandler::WriteConfigFile() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
ReturnValue_t resultWrite = returnvalue::OK;
|
||||
result = lockConfigFile();
|
||||
@ -198,8 +205,7 @@ ReturnValue_t GlobalConfigHandler::writeConfigFile() {
|
||||
}
|
||||
return resultWrite;
|
||||
}
|
||||
|
||||
ReturnValue_t GlobalConfigHandler::readConfigFile() {
|
||||
ReturnValue_t GlobalConfigHandler::ReadConfigFile() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
ReturnValue_t resultRead = returnvalue::OK;
|
||||
result = lockConfigFile();
|
||||
@ -231,8 +237,7 @@ ReturnValue_t GlobalConfigHandler::readConfigFile() {
|
||||
|
||||
return resultRead;
|
||||
}
|
||||
|
||||
ReturnValue_t GlobalConfigHandler::resetConfigFile() {
|
||||
ReturnValue_t GlobalConfigHandler::ResetConfigFile() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
result = resetConfigFileValues();
|
||||
if (result != returnvalue::OK) {
|
||||
@ -248,7 +253,7 @@ ReturnValue_t GlobalConfigHandler::resetConfigFile() {
|
||||
ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
setFullName(configFileName);
|
||||
result = resetConfigFile();
|
||||
result = ResetConfigFile();
|
||||
return result;
|
||||
}
|
||||
std::string GlobalConfigHandler::getConfigFileName() { return getFullName(); }
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <fsfw/storagemanager/StorageManagerIF.h>
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
|
||||
#include <utility>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -25,6 +24,10 @@
|
||||
#include "fsfw/parameters/ParameterHelper.h"
|
||||
#include "mission/memory/NVMParameterBase.h"
|
||||
|
||||
static std::map<ParamIds, std::string> PARAM_KEY_MAP = {
|
||||
{PARAM0, "Parameter0"},
|
||||
{PARAM1, "Parameter1"},
|
||||
};
|
||||
/*
|
||||
* Idea: This class is intended to be used as a subclass for the Core Controller.
|
||||
* Its tasks is managing a configuration JSON file containing config values important for various
|
||||
@ -51,12 +54,12 @@ class GlobalConfigHandler : public SystemObject,
|
||||
ReturnValue_t initialize();
|
||||
|
||||
template <typename T>
|
||||
ReturnValue_t setConfigFileValue(std::string paramName, T data);
|
||||
ReturnValue_t setConfigFileValue(ParamIds paramID, T data);
|
||||
template <typename T>
|
||||
ReturnValue_t getConfigFileValue(std::string paramName, T& data);
|
||||
ReturnValue_t getConfigFileValue(ParamIds paramID, T& data);
|
||||
|
||||
ReturnValue_t resetConfigFile();
|
||||
ReturnValue_t writeConfigFile();
|
||||
ReturnValue_t ResetConfigFile();
|
||||
ReturnValue_t WriteConfigFile();
|
||||
std::string getConfigFileName();
|
||||
|
||||
private:
|
||||
@ -68,7 +71,7 @@ class GlobalConfigHandler : public SystemObject,
|
||||
|
||||
ReturnValue_t setConfigFileName(std::string configFileName);
|
||||
|
||||
ReturnValue_t readConfigFile();
|
||||
ReturnValue_t ReadConfigFile();
|
||||
|
||||
MessageQueueIF* commandQueue;
|
||||
};
|
||||
|
2
thirdparty/lwgps
vendored
2
thirdparty/lwgps
vendored
@ -1 +1 @@
|
||||
Subproject commit 52999ddfe5177493b96b55871961a8a97131596d
|
||||
Subproject commit 18ce34faf729ed63c94517b2ae6a3d3741e0a054
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 8d036bcd4fed1211ad5b15ddae7b42e61e22fcfd
|
||||
Subproject commit a3a3aaa8836b425c923eb97e49ed29b452377bf6
|
Loading…
x
Reference in New Issue
Block a user