v1.14.0 #304

Merged
muellerr merged 366 commits from develop into main 2022-10-10 17:46:38 +02:00
Showing only changes of commit 26dc4ba56e - Show all commits

View File

@ -24,7 +24,7 @@ GlobalConfigHandler::GlobalConfigHandler(object_id_t objectId, std::string confi
} }
ReturnValue_t GlobalConfigHandler::initialize() { ReturnValue_t GlobalConfigHandler::initialize() {
ReturnValue_t result = SystemObject::initialize(); ReturnValue_t result = SystemObject::initialize();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with " sif::info << "GlobalConfigHandler::initialize: SystemObject::initialize() failed with "
<< result << std::endl; << result << std::endl;
@ -33,13 +33,13 @@ ReturnValue_t GlobalConfigHandler::initialize() {
} }
result = ReadConfigFile(); result = ReadConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName() sif::info << "GlobalConfigHandler::initialize: Creating JSON file at " << getFullName()
<< std::endl; << std::endl;
#endif #endif
result = ResetConfigFile(); result = ResetConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
return result; return result;
} }
} }
@ -52,29 +52,29 @@ ReturnValue_t GlobalConfigHandler::initialize() {
GlobalConfigHandler::~GlobalConfigHandler() {} GlobalConfigHandler::~GlobalConfigHandler() {}
ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) { ReturnValue_t GlobalConfigHandler::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
sif::debug << "GlobalConfigHandler::performOperation" << std::endl; sif::debug << "GlobalConfigHandler::performOperation" << std::endl;
return result; return result;
} }
ReturnValue_t GlobalConfigHandler::lockConfigFile() { ReturnValue_t GlobalConfigHandler::lockConfigFile() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10); result = configLock->lockMutex(MutexIF::TimeoutType::WAITING, 10);
return result; return result;
} }
ReturnValue_t GlobalConfigHandler::unlockConfigFile() { ReturnValue_t GlobalConfigHandler::unlockConfigFile() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
result = configLock->unlockMutex(); result = configLock->unlockMutex();
return result; return result;
} }
template <typename T> template <typename T>
ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) { ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
ReturnValue_t resultSet = RETURN_OK; ReturnValue_t resultSet = returnvalue::OK;
result = lockConfigFile(); result = lockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #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; << std::endl;
@ -93,11 +93,11 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data)
<< " not found!" << std::endl; << " not found!" << std::endl;
#endif #endif
triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0); triggerEvent(SET_CONFIGFILEVALUE_FAILED, 1, 0);
return RETURN_FAILED; return returnvalue::FAILED;
} }
resultSet = setValue(PARAM_KEY_MAP[paramID], data); resultSet = setValue(PARAM_KEY_MAP[paramID], data);
if (resultSet != RETURN_OK) { if (resultSet != returnvalue::OK) {
triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0); triggerEvent(SET_CONFIGFILEVALUE_FAILED, 0, 0);
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet sif::info << "GlobalConfigHandler::setConfigFileValue set json failed with " << resultSet
@ -106,7 +106,7 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data)
} }
result = unlockConfigFile(); result = unlockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result sif::info << "GlobalConfigHandler::setConfigFileValue unlock mutex failed with " << result
<< std::endl; << std::endl;
@ -118,11 +118,11 @@ ReturnValue_t GlobalConfigHandler::setConfigFileValue(ParamIds paramID, T data)
} }
template <typename T> template <typename T>
ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) { ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
ReturnValue_t resultGet = RETURN_OK; ReturnValue_t resultGet = returnvalue::OK;
result = lockConfigFile(); result = lockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result sif::info << "GlobalConfigHandler::getConfigFileValue lock mutex failed with " << result
<< std::endl; << std::endl;
@ -131,7 +131,7 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data)
} }
resultGet = getValue(PARAM_KEY_MAP[paramID], data); resultGet = getValue(PARAM_KEY_MAP[paramID], data);
if (resultGet != RETURN_OK) { if (resultGet != returnvalue::OK) {
triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0); triggerEvent(GET_CONFIGFILEVALUE_FAILED, 0, 0);
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet sif::info << "GlobalConfigHandler::getConfigFileValue getValue failed with " << resultGet
@ -139,7 +139,7 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data)
#endif #endif
} }
result = unlockConfigFile(); result = unlockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result sif::info << "GlobalConfigHandler::getConfigFileValue unlock mutex failed with " << result
<< std::endl; << std::endl;
@ -151,9 +151,9 @@ ReturnValue_t GlobalConfigHandler::getConfigFileValue(ParamIds paramID, T& data)
} }
ReturnValue_t GlobalConfigHandler::resetConfigFileValues() { ReturnValue_t GlobalConfigHandler::resetConfigFileValues() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
result = lockConfigFile(); result = lockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result sif::info << "GlobalConfigHandler::resetConfigFileValues lock mutex failed with " << result
<< std::endl; << std::endl;
@ -164,7 +164,7 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() {
insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT); insertValue(PARAM_KEY_MAP[PARAM1], PARAM1_DEFAULT);
result = unlockConfigFile(); result = unlockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result sif::info << "GlobalConfigHandler::resetConfigFileValues unlock mutex failed with " << result
<< std::endl; << std::endl;
@ -174,10 +174,10 @@ ReturnValue_t GlobalConfigHandler::resetConfigFileValues() {
return result; return result;
} }
ReturnValue_t GlobalConfigHandler::WriteConfigFile() { ReturnValue_t GlobalConfigHandler::WriteConfigFile() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
ReturnValue_t resultWrite = RETURN_OK; ReturnValue_t resultWrite = returnvalue::OK;
result = lockConfigFile(); result = lockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result sif::info << "GlobalConfigHandler::WriteConfigFile lock mutex failed with " << result
<< std::endl; << std::endl;
@ -186,7 +186,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() {
} }
resultWrite = writeJsonFile(); resultWrite = writeJsonFile();
if (resultWrite != RETURN_OK) { if (resultWrite != returnvalue::OK) {
triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0); triggerEvent(WRITE_CONFIGFILE_FAILED, 0, 0);
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite sif::info << "GlobalConfigHandler::WriteConfigFile write json failed with " << resultWrite
@ -195,7 +195,7 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() {
} }
result = unlockConfigFile(); result = unlockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result sif::info << "GlobalConfigHandler::WriteConfigFile unlock mutex failed with " << result
<< std::endl; << std::endl;
@ -205,10 +205,10 @@ ReturnValue_t GlobalConfigHandler::WriteConfigFile() {
return resultWrite; return resultWrite;
} }
ReturnValue_t GlobalConfigHandler::ReadConfigFile() { ReturnValue_t GlobalConfigHandler::ReadConfigFile() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
ReturnValue_t resultRead = RETURN_OK; ReturnValue_t resultRead = returnvalue::OK;
result = lockConfigFile(); result = lockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result sif::info << "GlobalConfigHandler::ReadConfigFile lock mutex failed with " << result
<< std::endl; << std::endl;
@ -217,7 +217,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() {
} }
resultRead = readJsonFile(); resultRead = readJsonFile();
if (resultRead != RETURN_OK) { if (resultRead != returnvalue::OK) {
triggerEvent(READ_CONFIGFILE_FAILED, 0, 0); triggerEvent(READ_CONFIGFILE_FAILED, 0, 0);
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead sif::info << "GlobalConfigHandler::ReadConfigFile read json failed with " << resultRead
@ -226,7 +226,7 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() {
} }
result = unlockConfigFile(); result = unlockConfigFile();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result sif::info << "GlobalConfigHandler::ReadConfigFile unlock mutex failed with " << result
<< std::endl; << std::endl;
@ -237,9 +237,9 @@ ReturnValue_t GlobalConfigHandler::ReadConfigFile() {
return resultRead; return resultRead;
} }
ReturnValue_t GlobalConfigHandler::ResetConfigFile() { ReturnValue_t GlobalConfigHandler::ResetConfigFile() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
result = resetConfigFileValues(); result = resetConfigFileValues();
if (result != RETURN_OK) { if (result != returnvalue::OK) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl; sif::info << "GlobalConfigHandler::ResetConfigFile failed with " << result << std::endl;
#endif #endif
@ -250,7 +250,7 @@ ReturnValue_t GlobalConfigHandler::ResetConfigFile() {
} }
ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName) { ReturnValue_t GlobalConfigHandler::setConfigFileName(std::string configFileName) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = returnvalue::OK;
setFullName(configFileName); setFullName(configFileName);
result = ResetConfigFile(); result = ResetConfigFile();
return result; return result;