Merge remote-tracking branch 'origin/develop' into irini
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-08-29 15:49:23 +02:00
commit aa0da618ca
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
310 changed files with 3048 additions and 18269 deletions

3
.gitmodules vendored
View File

@ -22,3 +22,6 @@
[submodule "thirdparty/rapidcsv"]
path = thirdparty/rapidcsv
url = https://github.com/d99kris/rapidcsv.git
[submodule "thirdparty/gomspace-sw"]
path = thirdparty/gomspace-sw
url = https://egit.irs.uni-stuttgart.de/eive/gomspace-sw.git

View File

@ -12,6 +12,12 @@ list yields a list of all related PRs for each release.
# [v1.14.0]
- Update for FSFW: `HasReturnvaluesIF` class replaced by namespace `returnvalue`
- Add some GomSpace clients as a submodule dependency. Use this dependency to deserialize the
GomSpace TM tables
- Add API to retrieve GomSpace device parameter tables
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287
# [v1.13.0] 24.08.2022
- Added first version of ACS Controller with gathers MGM data in a set

View File

@ -173,6 +173,9 @@ set(LIB_ETL_TARGET etl::etl)
set(LIB_CSP_NAME libcsp)
set(LIB_LWGPS_NAME lwgps)
set(LIB_ARCSEC wire)
set(LIB_GOMSPACE_CLIENTS gs_clients)
set(LIB_GOMSPACE_CSP gs_csp)
set(THIRD_PARTY_FOLDER thirdparty)
set(LIB_CXX_FS -lstdc++fs)
set(LIB_CATCH2 Catch2)
@ -185,6 +188,7 @@ set(FSFW_PATH fsfw)
set(TEST_PATH test)
set(UNITTEST_PATH unittest)
set(LINUX_PATH linux)
set(LIB_GOMSPACE_PATH ${THIRD_PARTY_FOLDER}/gomspace-sw)
set(COMMON_PATH common)
set(DUMMY_PATH dummies)
set(WATCHDOG_PATH watchdog)
@ -192,7 +196,6 @@ set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
set(LIB_EIVE_MISSION_PATH mission)
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
@ -220,7 +223,8 @@ if(TGT_BSP)
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE)
set(ADD_GOMSPACE_CSP TRUE)
set(ADD_GOMSPACE_CLIENTS TRUE)
set(FSFW_HAL_ADD_LINUX ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
@ -283,31 +287,6 @@ set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
# global compiler options need to be set before adding executables
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(
"-Wall"
"-Wextra"
"-Wimplicit-fallthrough=1"
"-Wno-unused-parameter"
"-Wno-psabi"
"-Wduplicated-cond" # check for duplicate conditions
"-Wduplicated-branches" # check for duplicate branches
"-Wlogical-op" # Search for bitwise operations instead of logical
"-Wnull-dereference" # Search for NULL dereference
"-Wundef" # Warn if undefind marcos are used
"-Wformat=2" # Format string problem detection
"-Wformat-overflow=2" # Formatting issues in printf
"-Wformat-truncation=2" # Formatting issues in printf
"-Wformat-security" # Search for dangerous printf operations
"-Wstrict-overflow=3" # Warn if integer overflows might happen
"-Warray-bounds=2" # Some array bounds violations will be found
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use with
# Wconversion to find more implicit conversions -fanalyzer # Should be used
# to look through problems
)
# Remove unused sections.
add_compile_options("-ffunction-sections" "-fdata-sections")
@ -325,6 +304,37 @@ add_library(${LIB_DUMMIES})
add_executable(${OBSW_NAME})
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS
"-Wall"
"-Wextra"
"-Wimplicit-fallthrough=1"
"-Wno-unused-parameter"
"-Wno-psabi"
"-Wduplicated-cond" # check for duplicate conditions
"-Wduplicated-branches" # check for duplicate branches
"-Wlogical-op" # Search for bitwise operations instead of logical
"-Wnull-dereference" # Search for NULL dereference
"-Wundef" # Warn if undefind marcos are used
"-Wformat=2" # Format string problem detection
"-Wformat-overflow=2" # Formatting issues in printf
"-Wformat-truncation=2" # Formatting issues in printf
"-Wformat-security" # Search for dangerous printf operations
"-Wstrict-overflow=3" # Warn if integer overflows might happen
"-Warray-bounds=2" # Some array bounds violations will be found
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use
# with Wconversion to find more implicit conversions -fanalyzer # Should
# be used to look through problems
)
target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS})
target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS})
target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS})
endif()
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
# Watchdog
@ -360,10 +370,7 @@ if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})
if(ADD_CSP_LIB)
add_subdirectory(${LIB_CSP_PATH})
endif()
add_subdirectory(${LIB_GOMSPACE_PATH})
add_subdirectory(${COMMON_PATH})
add_subdirectory(${DUMMY_PATH})
@ -448,15 +455,15 @@ if(TGT_BSP MATCHES "arm/q7s")
endif()
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
rapidcsv ${LIB_DUMMIES})
rapidcsv ${LIB_DUMMIES} ${LIB_GOMSPACE_CLIENTS})
if(TGT_BSP MATCHES "arm/egse")
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
endif()
if(ADD_CSP_LIB)
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_CSP_NAME})
endif()
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS})
target_link_libraries(${LIB_EIVE_MISSION} PRIVATE ${LIB_GOMSPACE_CLIENTS})
target_link_libraries(${LIB_DUMMIES} PRIVATE ${LIB_GOMSPACE_CLIENTS})
if(EIVE_ADD_ETL_LIB)
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})

View File

@ -2,7 +2,7 @@
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
@ -40,7 +40,7 @@ void initmission::initMission() {
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (factory == nullptr) {
/* Should never happen ! */
return;
@ -55,28 +55,28 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Polling failed" << std::endl;
}
@ -88,7 +88,7 @@ void initmission::initTasks() {
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstUart(pst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
pstTasks.push_back(pst);
@ -96,7 +96,7 @@ void initmission::initTasks() {
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = strHelperTask->addComponent(objects::STR_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
}
pstTasks.push_back(strHelperTask);
@ -125,11 +125,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
taskVec.push_back(pusVerification);
@ -137,11 +137,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
@ -149,11 +149,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
@ -161,19 +161,19 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
taskVec.push_back(pusMedPrio);
@ -181,11 +181,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);

View File

@ -4,7 +4,7 @@
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
@ -56,15 +56,15 @@ void initmission::initTasks() {
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
@ -72,13 +72,13 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
@ -86,89 +86,89 @@ void initmission::initTasks() {
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = eventHandling->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("EVENT_MNGR", objects::EVENT_MANAGER);
}
result = eventHandling->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
}
result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
}
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER);
}
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask(
"DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = dummy_pst::pst(pstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl;
}
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */

View File

@ -129,9 +129,7 @@ ArduinoComIF::~ArduinoComIF() {
CloseHandle(hCom);
#endif
}
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) { return returnvalue::OK; }
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
@ -142,10 +140,10 @@ ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, s
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
}
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; }
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
@ -158,7 +156,7 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buff
*buffer = arduinoCookie->replyBuffer.data();
*size = arduinoCookie->receivedDataLen;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
@ -178,14 +176,14 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
ReturnValue_t result =
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
currentPosition += encodedLen;
@ -199,7 +197,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
result =
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
currentPosition += encodedLen;
@ -207,7 +205,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
// encoding the actual data
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
currentPosition += encodedLen;
@ -224,7 +222,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
result =
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
currentPosition += encodedLen;
@ -241,16 +239,16 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
if (writtenlen < 0) {
// we could try to find out what happened...
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (writtenlen != encodedLen) {
// the OS failed us, we do not try to block until everything is written, as
// we can not block the whole system here
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
#elif WIN32
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
#endif
}
@ -297,7 +295,7 @@ void ArduinoComIF::handleSerialPortRx() {
packet, sizeof(packet), &packetLen);
size_t toDelete = firstSTXinRawData;
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
handlePacket(packet, packetLen);
// after handling the packet, we can delete it from the raw stream,

View File

@ -5,7 +5,7 @@
#include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <cstdint>
#include <map>

View File

@ -129,12 +129,12 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
if (thisSequence->checkSequence() == returnvalue::OK) {
return returnvalue::OK;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
}

View File

@ -1,7 +1,7 @@
#ifndef POLLINGSEQUENCEFACTORY_H_
#define POLLINGSEQUENCEFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
class FixedTimeslotTaskIF;

View File

@ -3,7 +3,7 @@
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
@ -37,7 +37,7 @@ void initmission::initMission() {
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (factory == nullptr) {
/* Should never happen ! */
return;
@ -52,15 +52,15 @@ void initmission::initTasks() {
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
@ -68,13 +68,13 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Polling failed" << std::endl;
}
@ -155,11 +155,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
taskVec.push_back(pusVerification);
@ -167,11 +167,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
@ -179,11 +179,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
@ -191,19 +191,19 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
taskVec.push_back(pusMedPrio);
@ -211,11 +211,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);
@ -224,7 +224,7 @@ void initmission::createPusTasks(TaskFactory& factory,
void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
@ -242,28 +242,28 @@ void initmission::createPstTasks(TaskFactory& factory,
void initmission::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif /* RPI_ADD_SPI_TEST == 1 */
#if RPI_ADD_GPIO_TEST == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
}
#endif /* RPI_ADD_GPIO_TEST == 1 */
#if OBSW_ADD_UART_TEST_CODE == 1
result = testTask->addComponent(objects::UART_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
}
PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask(
@ -282,7 +282,7 @@ void initmission::createTestTasks(TaskFactory& factory,
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
result = pst::pstTest(pstTestTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
startTestPst = false;
}

View File

@ -40,14 +40,14 @@ void rpi::gpio::initSpiCsDecoder(GpioIF* gpioComIF) {
for (const auto& info : muxInfo) {
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
Direction::OUT, Levels::LOW);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
return;
}
}
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}

View File

@ -116,7 +116,6 @@
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@
#ifdef __cplusplus
#include "objects/systemObjectList.h"

View File

@ -3,9 +3,12 @@
#include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h>
#include <bsp_q7s/xadc/Xadc.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <gps.h>
#include <libgpsmm.h>
#include <param/param_string.h>
#include <param/rparam_client.h>
#include <cstdio>
#include <ctime>
@ -18,6 +21,7 @@
#include "bsp_q7s/memory/scratchApi.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/timemanager/Stopwatch.h"
#include "p60pdu.h"
#include "test/DummyParameter.h"
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
@ -35,6 +39,33 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
if (doTestScratchApi) {
testScratchApi();
}
if (DO_TEST_GOMSPACE_API) {
uint8_t p60pdu_node = 3;
uint8_t hk_mem[P60PDU_HK_SIZE];
param_index_t p60pdu_hk{};
p60pdu_hk.physaddr = hk_mem;
if (!p60pdu_get_hk(&p60pdu_hk, p60pdu_node, 1000)) {
printf("Error getting p60pdu hk\n");
} else {
param_list(&p60pdu_hk, 1);
}
}
if (DO_TEST_GOMSPACE_GET_CONFIG) {
uint8_t p60pdu_node = 3;
param_index_t requestStruct{};
requestStruct.table = p60pdu_config;
requestStruct.mem_id = P60PDU_PARAM;
uint8_t hk_mem[P60PDU_PARAM_SIZE];
requestStruct.count = p60pdu_config_count;
requestStruct.size = P60PDU_PARAM_SIZE;
requestStruct.physaddr = hk_mem;
int result = rparam_get_full_table(&requestStruct, p60pdu_node, P60_PORT_RPARAM,
requestStruct.mem_id, 1000);
param_list(&requestStruct, 1);
return (result == 0);
}
// testJsonLibDirect();
// testDummyParams();
if (doTestProtHandler) {
@ -95,23 +126,23 @@ void Q7STestTask::fileTests() {
void Q7STestTask::testScratchApi() {
ReturnValue_t result = scratch::writeNumber("TEST", 1);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
}
int number = 0;
result = scratch::readNumber("TEST", number);
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST\": " << number << std::endl;
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
}
result = scratch::writeString("TEST2", "halloWelt");
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "Q7STestTask::scratchApiTest: Writing string failed" << std::endl;
}
std::string string;
result = scratch::readString("TEST2", string);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
}
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST2\": " << string << std::endl;
@ -143,7 +174,7 @@ void Q7STestTask::testDummyParams() {
}
ReturnValue_t result = param.readJsonFile();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
}
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
@ -154,13 +185,13 @@ void Q7STestTask::testDummyParams() {
int test = 0;
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl;
}
std::string test2;
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl;
}
@ -179,18 +210,18 @@ ReturnValue_t Q7STestTask::initialize() {
void Q7STestTask::testProtHandler() {
bool opPerformed = false;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
// If any chips are unlocked, lock them here
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
opPerformed, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
// unlock own copy
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
opPerformed, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if (not opPerformed) {
@ -204,7 +235,7 @@ void Q7STestTask::testProtHandler() {
// lock own copy
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
opPerformed, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if (not opPerformed) {
@ -218,7 +249,7 @@ void Q7STestTask::testProtHandler() {
// unlock specific copy
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
opPerformed, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if (not opPerformed) {
@ -232,7 +263,7 @@ void Q7STestTask::testProtHandler() {
// lock specific copy
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
opPerformed, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if (not opPerformed) {
@ -341,24 +372,24 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
<< std::endl;
}
FileSystemHandler::FsCommandCfg cfg = {};
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
// Lambda for common code
auto createNonEmptyTmpDir = [&]() {
if (not std::filesystem::exists("/tmp/test")) {
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
// Creating sample files
sif::info << "Creating sample files in directory" << std::endl;
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return result;
@ -383,7 +414,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
}
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "File removed successfully" << std::endl;
} else {
sif::warning << "File removal failed!" << std::endl;
@ -396,7 +427,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
sif::info << "Creating empty file in /tmp folder" << std::endl;
// Do not delete file, user can check existence in shell
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Directory created successfully" << std::endl;
} else {
sif::warning << "Directory creation failed!" << std::endl;
@ -413,7 +444,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
std::remove("/tmp/test/*");
}
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Directory removed successfully" << std::endl;
} else {
sif::warning << "Directory removal failed!" << std::endl;
@ -422,11 +453,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
}
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
result = createNonEmptyTmpDir();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Directory removed recursively successfully" << std::endl;
} else {
sif::warning << "Recursive directory removal failed!" << std::endl;
@ -435,11 +466,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
}
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
result = createNonEmptyTmpDir();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::info << "Directory removal attempt failed as expected" << std::endl;
} else {
sif::warning << "Directory removal worked when it should not have!" << std::endl;
@ -478,7 +509,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
}
void Q7STestTask::xadcTest() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
float temperature = 0;
float vccPint = 0;
float vccPaux = 0;
@ -490,39 +521,39 @@ void Q7STestTask::xadcTest() {
float vrefn = 0;
Xadc xadc;
result = xadc.getTemperature(temperature);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
}
result = xadc.getVccPint(vccPint);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
}
result = xadc.getVccPaux(vccPaux);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
}
result = xadc.getVccInt(vccInt);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
}
result = xadc.getVccAux(vccAux);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
}
result = xadc.getVccBram(vccBram);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
}
result = xadc.getVccOddr(vccOddr);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
}
result = xadc.getVrefp(vrefp);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
}
result = xadc.getVrefn(vrefn);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
}
}

View File

@ -16,6 +16,8 @@ class Q7STestTask : public TestTask {
private:
bool doTestSdCard = false;
bool doTestScratchApi = false;
static constexpr bool DO_TEST_GOMSPACE_API = false;
static constexpr bool DO_TEST_GOMSPACE_GET_CONFIG = false;
bool doTestGpsShm = false;
bool doTestGpsSocket = false;
bool doTestProtHandler = false;

View File

@ -11,10 +11,10 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo
}
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if (args == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
if (resetArgs->gpioComIF == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
gpioId_t gpioId;
if (actionData[0] == 0) {
@ -25,5 +25,5 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo
resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs);
resetArgs->gpioComIF->pullHigh(gpioId);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -1,7 +1,7 @@
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
struct ResetArgs {

View File

@ -47,7 +47,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
return;
}

View File

@ -29,12 +29,12 @@ void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
size_t sendLen, void* args) {
// Stopwatch watch;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
if (handler == nullptr) {
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
uint8_t writeBuffer[2] = {};
@ -48,13 +48,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == nullptr or gpioIF == nullptr) {
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
int fileDescriptor = 0;
const std::string& dev = comIf->getSpiDev();
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
@ -118,7 +118,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
uint8_t* rxBuf = nullptr;
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return result;
}
@ -130,7 +130,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
usleep(RwDefinitions::SPI_REPLY_DELAY);
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
@ -228,7 +228,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
break;
}
}
result = HasReturnvaluesIF::RETURN_OK;
result = returnvalue::OK;
}
cookie->setTransferSize(decodedFrameLen);
@ -244,7 +244,7 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
int& fd) {
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
return result;
}
@ -258,21 +258,21 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
// Pull SPI CS low. For now, no support for active high given
if (gpioId != gpio::NO_GPIO) {
result = gpioIF->pullLow(gpioId);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
close(fd);
if (gpioId != gpio::NO_GPIO) {
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
if (gpioIF->pullHigh(gpioId) != returnvalue::OK) {
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
}
}
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
if (mutex->unlockMutex() != returnvalue::OK) {
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
;
}

View File

@ -1,7 +1,7 @@
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
#define BSP_Q7S_RW_SPI_CALLBACK_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h"

View File

@ -33,10 +33,10 @@ CoreController::CoreController(object_id_t objectId)
opDivider5(5),
opDivider10(10),
hkSet(this) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
try {
result = initWatchdogFifo();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Watchdog FIFO init failed" << std::endl;
}
sdcMan = SdCardManager::instance();
@ -50,7 +50,7 @@ CoreController::CoreController(object_id_t objectId)
sdStateMachine();
result = initBootCopy();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
}
} catch (const std::filesystem::filesystem_error &e) {
@ -66,7 +66,7 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
void CoreController::performControlOperation() {
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {
switch (event.getEvent()) {
case (GpsHyperion::GPS_FIX_CHANGE): {
@ -93,7 +93,7 @@ ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &local
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
@ -105,11 +105,11 @@ LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
ReturnValue_t CoreController::initialize() {
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Base init failed" << std::endl;
}
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Setting up alloc failure "
"count failed"
<< std::endl;
@ -126,31 +126,31 @@ ReturnValue_t CoreController::initialize() {
<< std::endl;
}
result = eventManager->registerListener(eventQueue->getId());
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Registering as event listener failed" << std::endl;
}
result = eventManager->subscribeToEvent(eventQueue->getId(),
event::getEventId(GpsHyperion::GPS_FIX_CHANGE));
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Subscribing for GPS GPS_FIX_CHANGE event failed" << std::endl;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::initializeAfterTaskCreation() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sdInfo.pref = sdcMan->getPreferredSdCard();
sdcMan->setActiveSdCard(sdInfo.pref);
currMntPrefix = sdcMan->getCurrentMountPrefix();
if (BLOCKING_SD_INIT) {
ReturnValue_t result = initSdCardBlocking();
if (result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
if (result != returnvalue::OK and result != SdCardManager::ALREADY_MOUNTED) {
sif::warning << "CoreController::CoreController: SD card init failed" << std::endl;
}
}
sdStateMachine();
performMountedSdCardOperations();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
}
// Add script folder to path
@ -236,22 +236,22 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::initSdCardBlocking() {
// Create update status file
ReturnValue_t result = sdcMan->updateSdCardStateFile();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
}
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
sif::info << "No SD card initialization will be performed" << std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
#else
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Getting SD card activity status failed" << std::endl;
}
@ -269,14 +269,14 @@ ReturnValue_t CoreController::initSdCardBlocking() {
sdCardSetup(sd::SdCard::SLOT_1, sd::SdState::MOUNTED, "1", false);
// Update status file
sdcMan->updateSdCardStateFile();
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
#endif
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
}
ReturnValue_t CoreController::sdStateMachine() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
SdCardManager::Operations operation;
if (sdInfo.state == SdStates::IDLE) {
@ -324,7 +324,7 @@ ReturnValue_t CoreController::sdStateMachine() {
if (not sdInfo.commandExecuted) {
// Create update status file
result = sdcMan->updateSdCardStateFile();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Updating SD card state file failed"
<< std::endl;
}
@ -343,7 +343,7 @@ ReturnValue_t CoreController::sdStateMachine() {
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
sdInfo.pref = sd::SdCard::SLOT_0;
}
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Getting SD card activity status failed" << std::endl;
}
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
@ -473,7 +473,7 @@ ReturnValue_t CoreController::sdStateMachine() {
sdcMan->setBlocking(true);
// Update status file
result = sdcMan->updateSdCardStateFile();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
}
sdInfo.commandExecuted = false;
@ -497,7 +497,7 @@ ReturnValue_t CoreController::sdStateMachine() {
}
sdInfo.cycleCount++;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void CoreController::executeNextExternalSdCommand() {
@ -628,28 +628,28 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
} else {
sif::warning << "CoreController::sdCardSetup: Invalid state for this call" << std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
if (result != SdCardManager::ALREADY_MOUNTED and result != HasReturnvaluesIF::RETURN_OK) {
if (result != SdCardManager::ALREADY_MOUNTED and result != returnvalue::OK) {
sif::warning << "Setting up preferred card " << sdInfo.otherChar
<< " in cold redundant mode failed" << std::endl;
// Try other SD card and mark set up operation as failed
sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
result = HasReturnvaluesIF::RETURN_FAILED;
result = returnvalue::FAILED;
}
if (result != HasReturnvaluesIF::RETURN_FAILED and sdInfo.otherState != sd::SdState::OFF) {
if (result != returnvalue::FAILED and sdInfo.otherState != sd::SdState::OFF) {
sif::info << "Switching off secondary SD card " << sdInfo.otherChar << std::endl;
// Switch off other SD card in cold redundant mode if setting up preferred one worked
// without issues
ReturnValue_t result2 =
sdcMan->switchOffSdCard(sdInfo.other, sdInfo.otherState, &sdInfo.currentState);
if (result2 != HasReturnvaluesIF::RETURN_OK and result2 != SdCardManager::ALREADY_OFF) {
if (result2 != returnvalue::OK and result2 != SdCardManager::ALREADY_OFF) {
sif::warning << "Switching off secondary SD card " << sdInfo.otherChar
<< " in cold redundant mode failed" << std::endl;
}
@ -660,7 +660,7 @@ ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
ReturnValue_t CoreController::incrementAllocationFailureCount() {
uint32_t count = 0;
ReturnValue_t result = scratch::readNumber(scratch::ALLOC_FAILURE_COUNT, count);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
count++;
@ -698,7 +698,7 @@ ReturnValue_t CoreController::initVersionFile() {
versionFile << fullObswVersionString << std::endl;
versionFile << fullFsfwVersionString << std::endl;
versionFile << systemString << std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
// Check whether any version has changed
@ -745,7 +745,7 @@ ReturnValue_t CoreController::initVersionFile() {
versionFile << systemString << std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
@ -800,7 +800,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
utility::handleSystemError(result, "CoreController::actionListDirectoryIntoFile");
actionHelper.finish(false, commandedBy, actionId);
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::initBootCopy() {
@ -815,7 +815,7 @@ ReturnValue_t CoreController::initBootCopy() {
}
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy &copy) {
@ -829,10 +829,10 @@ void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy &copy) {
ReturnValue_t CoreController::initWatchdogFifo() {
if (not std::filesystem::exists(watchdog::FIFO_NAME)) {
// Still return RETURN_OK for now
// Still return returnvalue::OK for now
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate"
<< " watchdog" << std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
// Open FIFO write only and non-blocking to prevent SW from killing itself.
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
@ -843,10 +843,10 @@ ReturnValue_t CoreController::initWatchdogFifo() {
} else {
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " << errno
<< ": " << strerror(errno) << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void CoreController::initPrint() {
@ -872,7 +872,7 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
int result = std::system("xsc_boot_copy -r");
if (result != 0) {
utility::handleSystemError(result, "CoreController::executeAction");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasActionsIF::EXECUTION_FINISHED;
}
@ -929,14 +929,14 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
default:
break;
}
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
bool protOpPerformed = false;
gracefulShutdownTasks(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, protOpPerformed);
std::system("reboot");
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
@ -948,7 +948,7 @@ ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy co
// If any boot copies are unprotected
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
protOpPerformed, false);
if (result == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
if (result == returnvalue::OK and protOpPerformed) {
// TODO: Would be nice to notify operator. But we can't use the filesystem anymore
// and a reboot is imminent. Use scratch buffer?
sif::info << "Running slot was writeprotected before reboot" << std::endl;
@ -983,9 +983,9 @@ ReturnValue_t CoreController::generateChipStateFile() {
int result = std::system(CHIP_PROT_SCRIPT);
if (result != 0) {
utility::handleSystemError(result, "CoreController::generateChipStateFile");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy,
@ -1003,7 +1003,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
break;
}
case (xsc::Chip::NO_CHIP): {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
case (xsc::Chip::SELF_CHIP): {
selfChip = true;
@ -1020,7 +1020,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
break;
}
case (xsc::Copy::NO_COPY): {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
case (xsc::Copy::SELF_COPY): {
selfCopy = true;
@ -1042,7 +1042,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
if (protOperationPerformed and updateProtFile) {
updateProtInfo();
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy,
@ -1130,28 +1130,28 @@ int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy ta
ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
using namespace std;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (regenerateChipStateFile) {
result = generateChipStateFile();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed"
<< std::endl;
return result;
}
}
if (not filesystem::exists(CHIP_STATE_FILE)) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
ifstream chipStateFile(CHIP_STATE_FILE);
if (not chipStateFile.good()) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
string nextLine;
uint8_t lineCounter = 0;
string word;
while (getline(chipStateFile, nextLine)) {
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" << std::endl;
return result;
}
@ -1162,7 +1162,7 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
<< std::endl;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
@ -1207,7 +1207,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
}
wordIdx++;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void CoreController::performWatchdogControlOperation() {
@ -1274,7 +1274,7 @@ ReturnValue_t CoreController::performSdCardCheck() {
sdcMan->getSdCardsStatus(active);
auto sdCardCheck = [&](sd::SdCard sdCard) {
ReturnValue_t result = sdcMan->isSdCardMountedReadOnly(sdCard, mountedReadOnly);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "CoreController::performSdCardCheck: Could not check "
"read-only mount state"
<< std::endl;
@ -1283,13 +1283,13 @@ ReturnValue_t CoreController::performSdCardCheck() {
if (mountedReadOnly) {
int linuxErrno = 0;
result = sdcMan->performFsck(sdCard, true, linuxErrno);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "CoreController::performSdCardCheck: fsck command on SD Card "
<< static_cast<uint8_t>(sdCard) << " failed with code " << linuxErrno << " | "
<< strerror(linuxErrno);
}
result = sdcMan->remountReadWrite(sdCard);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::warning << "CoreController::performSdCardCheck: Remounted SD Card "
<< static_cast<uint8_t>(sdCard) << " read-write";
} else {
@ -1305,7 +1305,7 @@ ReturnValue_t CoreController::performSdCardCheck() {
sdCardCheck(sd::SdCard::SLOT_1);
}
return RETURN_OK;
return returnvalue::OK;
}
void CoreController::performRebootFileHandling(bool recreateFile) {
@ -1759,7 +1759,7 @@ ReturnValue_t CoreController::timeFileHandler() {
// It is assumed that the system time is set from the GPS time
timeval currentTime = {};
ReturnValue_t result = Clock::getClock_timeval(&currentTime);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::string fileName = currMntPrefix + TIME_FILE;
@ -1767,11 +1767,11 @@ ReturnValue_t CoreController::timeFileHandler() {
if (not timeFile.good()) {
sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreController::initClockFromTimeFile() {
@ -1787,18 +1787,18 @@ ReturnValue_t CoreController::initClockFromTimeFile() {
istringstream iss(nextWord);
iss >> nextWord;
if (iss.bad() or nextWord != "UNIX") {
return RETURN_FAILED;
return returnvalue::FAILED;
}
iss >> nextWord;
if (iss.bad() or nextWord != "SECONDS:") {
return RETURN_FAILED;
return returnvalue::FAILED;
}
iss >> nextWord;
timeval currentTime = {};
char *checkPtr;
currentTime.tv_sec = strtol(nextWord.c_str(), &checkPtr, 10);
if (iss.bad() or *checkPtr) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
#if OBSW_VERBOSE_LEVEL >= 1
time_t timeRaw = currentTime.tv_sec;
@ -1808,30 +1808,30 @@ ReturnValue_t CoreController::initClockFromTimeFile() {
#endif
return Clock::setClock(&currentTime);
}
return RETURN_OK;
return returnvalue::OK;
}
void CoreController::readHkData() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = hkSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
Xadc xadc;
result = xadc.getTemperature(hkSet.temperature.value);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
hkSet.temperature.setValid(false);
} else {
hkSet.temperature.setValid(true);
}
result = xadc.getVccPint(hkSet.psVoltage.value);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
hkSet.psVoltage.setValid(false);
} else {
hkSet.psVoltage.setValid(true);
}
result = xadc.getVccInt(hkSet.plVoltage.value);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
hkSet.plVoltage.setValid(false);
} else {
hkSet.plVoltage.setValid(true);
@ -1840,7 +1840,7 @@ void CoreController::readHkData() {
hkSet.printSet();
#endif /* OBSW_PRINT_CORE_HK == 1 */
result = hkSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
}

View File

@ -10,7 +10,7 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/platform.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
#include "fsfw/tasks/PeriodicTaskIF.h"
@ -55,7 +55,7 @@ void initmission::initMission() {
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (factory == nullptr) {
/* Should never happen ! */
return;
@ -69,7 +69,7 @@ void initmission::initTasks() {
PeriodicTaskIF* coreController = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreController->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
@ -77,15 +77,15 @@ void initmission::initTasks() {
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
}
@ -94,13 +94,13 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
}
#endif
@ -109,7 +109,7 @@ void initmission::initTasks() {
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
@ -119,7 +119,7 @@ void initmission::initTasks() {
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
@ -128,13 +128,13 @@ void initmission::initTasks() {
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
"ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
result = acsTask->addComponent(objects::GPS_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
}
#endif /* OBSW_ADD_ACS_HANDLERS */
acsTask->addComponent(objects::ACS_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER);
}
@ -143,19 +143,19 @@ void initmission::initTasks() {
static_cast<void>(sysTask);
#if OBSW_ADD_ACS_HANDLERS == 1
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
}
#endif /* OBSW_ADD_ACS_HANDLERS */
#if OBSW_ADD_RW == 1
result = sysTask->addComponent(objects::RW_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
}
#endif
#if OBSW_ADD_SUS_BOARD_ASS == 1
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
}
#endif
@ -164,7 +164,7 @@ void initmission::initTasks() {
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
"TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
result = tcsPollingTask->addComponent(objects::SPI_RTD_COM_IF);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
}
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
@ -203,7 +203,7 @@ void initmission::initTasks() {
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
}
@ -211,7 +211,7 @@ void initmission::initTasks() {
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = strHelperTask->addComponent(objects::STR_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
}
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
@ -220,7 +220,7 @@ void initmission::initTasks() {
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
}
#endif /* OBSW_ADD_PLOC_MPSOC */
@ -229,7 +229,7 @@ void initmission::initTasks() {
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
@ -238,7 +238,7 @@ void initmission::initTasks() {
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
@ -310,13 +310,13 @@ void initmission::initTasks() {
void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"MAIN_SPI", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
@ -331,7 +331,7 @@ void initmission::createPstTasks(TaskFactory& factory,
FixedTimeslotTaskIF* rwPstTask = factory.createFixedTimeslotTask(
"RW_SPI", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc);
result = pst::pstSpiRw(rwPstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
@ -345,7 +345,7 @@ void initmission::createPstTasks(TaskFactory& factory,
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
"UART_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstUart(uartPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: UART PST is empty" << std::endl;
} else {
@ -358,7 +358,7 @@ void initmission::createPstTasks(TaskFactory& factory,
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
result = pst::pstGpio(gpioPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
} else {
@ -371,7 +371,7 @@ void initmission::createPstTasks(TaskFactory& factory,
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstI2c(i2cPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: I2C PST is empty" << std::endl;
} else {
@ -386,7 +386,7 @@ void initmission::createPstTasks(TaskFactory& factory,
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstGompaceCan(gomSpacePstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
@ -398,12 +398,12 @@ void initmission::createPstTasks(TaskFactory& factory,
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
/* PUS Services */
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
}
taskVec.push_back(pusVerification);
@ -411,11 +411,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
@ -423,11 +423,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
@ -436,27 +436,27 @@ void initmission::createPusTasks(TaskFactory& factory,
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_11", objects::PUS_SERVICE_11_TC_SCHEDULER);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
}
taskVec.push_back(pusMedPrio);
@ -464,11 +464,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);
@ -478,32 +478,32 @@ void initmission::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
static_cast<void>(result); // supress warning in case it is not used
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif
#if OBSW_ADD_I2C_TEST_CODE == 1
result = testTask->addComponent(objects::I2C_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
}
#endif
#if OBSW_ADD_UART_TEST_CODE == 1
result = testTask->addComponent(objects::UART_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
}
#endif

View File

@ -20,7 +20,6 @@
#include "linux/boardtest/UartTestClass.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
@ -35,6 +34,7 @@
#include "linux/obc/PdecHandler.h"
#include "linux/obc/Ptme.h"
#include "linux/obc/PtmeConfig.h"
#include "mission/csp/CspCookie.h"
#include "mission/system/RwAssembly.h"
#include "mission/system/fdir/AcsBoardFdir.h"
#include "mission/system/fdir/GomspacePowerFdir.h"
@ -158,10 +158,10 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
}
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
P60DockHandler* p60dockhandler =
@ -918,7 +918,7 @@ void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
duallane::A_SIDE);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Sending mode command failed" << std::endl;
}
}

View File

@ -1,7 +1,7 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <string>

View File

@ -35,7 +35,7 @@ ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
void FileSystemHandler::fileSystemHandlerLoop() {
CommandMessage filemsg;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
while (true) {
if (opCounter % 5 == 0) {
if (coreCtrl->sdInitFinished()) {
@ -45,7 +45,7 @@ void FileSystemHandler::fileSystemHandlerLoop() {
result = mq->receiveMessage(&filemsg);
if (result == MessageQueueIF::EMPTY) {
break;
} else if (result != HasReturnvaluesIF::RETURN_FAILED) {
} else if (result != returnvalue::FAILED) {
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
break;
}
@ -91,7 +91,7 @@ void FileSystemHandler::fileSystemCheckup() {
<< " but does not appear to be mounted. Attempting fix.." << std::endl;
// This function will appear to fix the inconsistent state
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
// Oh no.
triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0);
sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl;
@ -114,7 +114,7 @@ ReturnValue_t FileSystemHandler::initialize() {
} else if (preferredSdCard == sd::SdCard::SLOT_1) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename,
@ -129,7 +129,7 @@ ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const
if (not file.good()) {
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename,
@ -144,7 +144,7 @@ ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const ch
if (not file.good()) {
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename,
@ -158,7 +158,7 @@ ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const ch
sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl;
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname,
@ -168,7 +168,7 @@ ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, con
return DIRECTORY_ALREADY_EXISTS;
}
if (std::filesystem::create_directory(path)) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
sif::warning << "Creating directory " << path << " failed" << std::endl;
return GENERIC_FILE_ERROR;
@ -183,7 +183,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
std::error_code err;
if (not deleteRecurively) {
if (std::filesystem::remove(path, err)) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
} else {
// Check error code. Most probably denied permissions because folder is not empty
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
@ -197,7 +197,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
}
} else {
if (std::filesystem::remove_all(path, err)) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
} else {
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
"code "
@ -211,14 +211,14 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename,
const char* newFilename, FileSystemArgsIF* args) {
auto basepath = getInitPath(args) / repositoryPath;
std::filesystem::rename(basepath / oldFilename, basepath / newFilename);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void FileSystemHandler::parseCfg(FsCommandCfg* cfg, bool& useMountPrefix) {

View File

@ -12,7 +12,7 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
SdCardManager* sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
@ -27,12 +27,12 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
return SD_NOT_MOUNTED;
}
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t FilesystemHelper::fileExists(std::string file) {
if (not std::filesystem::exists(file)) {
return FILE_NOT_EXISTS;
}
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -4,14 +4,14 @@
#include <string>
#include "commonClassIds.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief This class implements often used functions related to the file system management.
*
* @author J. Meier
*/
class FilesystemHelper : public HasReturnvaluesIF {
class FilesystemHelper {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
@ -26,7 +26,7 @@ class FilesystemHelper : public HasReturnvaluesIF {
*
* @param path Path to check
*
* @return RETURN_OK if path points to SD card and the appropriate SD card is mounted or if
* @return returnvalue::OK if path points to SD card and the appropriate SD card is mounted or if
* path does not point to SD card.
* Return error code if path points to SD card and the corresponding SD card is not
* mounted.
@ -38,7 +38,7 @@ class FilesystemHelper : public HasReturnvaluesIF {
*
* @param file File to check
*
* @return RETURN_OK if file exists, otherwise return error code.
* @return returnvalue::OK if file exists, otherwise return error code.
*/
static ReturnValue_t fileExists(std::string file);

View File

@ -21,17 +21,17 @@ SdCardManager* SdCardManager::INSTANCE = nullptr;
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
mutex = MutexFactory::instance()->createMutex();
ReturnValue_t result = mutex->lockMutex();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl;
}
uint8_t prefSdRaw = 0;
result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdRaw);
result = mutex->unlockMutex();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "SdCardManager::SdCardManager: Mutex unlock failed" << std::endl;
}
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
if (result == scratch::KEY_NOT_FOUND) {
sif::warning << "CoreController::sdCardInit: "
"Preferred SD card not set. Setting to 0"
@ -65,7 +65,7 @@ SdCardManager* SdCardManager::instance() {
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
SdStatePair* statusPair) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (doMountSdCard) {
if (not blocking) {
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
@ -80,7 +80,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
sdStatusPtr = std::make_unique<SdStatePair>();
statusPair = sdStatusPtr.get();
result = getSdCardsStatus(*statusPair);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -89,7 +89,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
sd::SdState currentState;
@ -113,10 +113,10 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
} else if (currentState == sd::SdState::OFF) {
result = setSdCardState(sdCard, true);
} else {
result = HasReturnvaluesIF::RETURN_FAILED;
result = returnvalue::FAILED;
}
if (result != HasReturnvaluesIF::RETURN_OK or not doMountSdCard) {
if (result != returnvalue::OK or not doMountSdCard) {
return result;
}
@ -127,7 +127,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
SdStatePair* statusPair) {
std::pair<sd::SdState, sd::SdState> active;
ReturnValue_t result = getSdCardsStatus(active);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (doUnmountSdCard) {
@ -142,7 +142,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
if (sdCard == sd::SdCard::SLOT_0) {
if (active.first == sd::SdState::OFF) {
@ -156,7 +156,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
if (doUnmountSdCard) {
result = unmountSdCard(sdCard);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -187,7 +187,7 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
command << "q7hw sd set " << sdstring << " " << statestring;
cmdExecutor.load(command.str(), blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
if (blocking and result != returnvalue::OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState");
}
return result;
@ -212,7 +212,7 @@ ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) {
while (std::getline(sdStatus, line)) {
processSdStatusLine(active, line, idx, currentSd);
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
@ -223,7 +223,7 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
string mountDev;
string mountPoint;
@ -247,7 +247,7 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
cmdExecutor.load(sdMountCommand, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
if (blocking and result != returnvalue::OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
}
return result;
@ -261,7 +261,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
string mountPoint;
if (sdCard == sd::SdCard::SLOT_0) {
@ -285,7 +285,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
}
cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
if (blocking and result != returnvalue::OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard");
}
return result;
@ -293,7 +293,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) {
std::unique_ptr<SdStatePair> sdStatusPtr;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
// Enforce blocking operation for now. Be careful to reset it when returning prematurely!
bool resetNonBlockingState = false;
if (not this->blocking) {
@ -302,7 +302,7 @@ ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard p
}
if (prefSdCard == sd::SdCard::NONE) {
result = getPreferredSdCard();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
}
}
if (statusPair == nullptr) {
@ -382,7 +382,7 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState>& act
sd::SdCard SdCardManager::getPreferredSdCard() const {
MutexGuard mg(mutex);
auto res = mg.getLockResult();
if (res != RETURN_OK) {
if (res != returnvalue::OK) {
sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl;
}
return sdInfo.pref;
@ -391,7 +391,7 @@ sd::SdCard SdCardManager::getPreferredSdCard() const {
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
MutexGuard mg(mutex);
if (sdCard == sd::SdCard::BOTH) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
sdInfo.pref = sdCard;
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
@ -406,7 +406,7 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
if (blocking and result != returnvalue::OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
}
return result;
@ -448,10 +448,10 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) {
case (CommandExecutor::EXECUTION_FINISHED): {
return OpStatus::SUCCESS;
}
case (HasReturnvaluesIF::RETURN_OK): {
case (returnvalue::OK): {
return OpStatus::ONGOING;
}
case (HasReturnvaluesIF::RETURN_FAILED): {
case (returnvalue::FAILED): {
return OpStatus::FAIL;
}
default: {
@ -469,7 +469,7 @@ bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
SdCardManager::SdStatePair active;
ReturnValue_t result = this->getSdCardsStatus(active);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
return false;
}
@ -499,15 +499,15 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
}
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = cmdExecutor.execute();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
int exitStatus = cmdExecutor.getLastError();
if (exitStatus == 1) {
readOnly = false;
return RETURN_OK;
return returnvalue::OK;
}
return result;
}
@ -517,7 +517,7 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
readOnly = false;
}
readOnly = true;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
@ -528,7 +528,7 @@ ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
}
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return cmdExecutor.execute();
@ -542,11 +542,11 @@ ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, in
command << "fsck -y " << SD_1_DEV_NAME;
}
ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = cmdExecutor.execute();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
linuxError = cmdExecutor.getLastError();
}
return result;

View File

@ -12,7 +12,7 @@
#include "events/subsystemIdRanges.h"
#include "fsfw/events/Event.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_hal/linux/CommandExecutor.h"
#include "mission/memory/SdCardMountedIF.h"
#include "mission/memory/definitions.h"
@ -24,7 +24,7 @@ class MutexIF;
* @brief Manages handling of SD cards like switching them on or off or getting the current
* state
*/
class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCardMountedIF {
class SdCardManager : public SystemObject, public SdCardMountedIF {
friend class SdCardAccess;
public:
@ -44,22 +44,17 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
static constexpr ReturnValue_t OP_ONGOING = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t ALREADY_ON = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t ALREADY_MOUNTED =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t ALREADY_OFF = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
static constexpr ReturnValue_t OP_ONGOING = returnvalue::makeCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t ALREADY_ON = returnvalue::makeCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t ALREADY_MOUNTED = returnvalue::makeCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t ALREADY_OFF = returnvalue::makeCode(INTERFACE_ID, 3);
static constexpr ReturnValue_t STATUS_FILE_NEXISTS = returnvalue::makeCode(INTERFACE_ID, 10);
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
static constexpr ReturnValue_t MOUNT_ERROR = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
static constexpr ReturnValue_t UNMOUNT_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
static constexpr ReturnValue_t POPEN_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 15);
returnvalue::makeCode(INTERFACE_ID, 11);
static constexpr ReturnValue_t MOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 12);
static constexpr ReturnValue_t UNMOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 13);
static constexpr ReturnValue_t SYSTEM_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 14);
static constexpr ReturnValue_t POPEN_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 15);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
@ -105,7 +100,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
* @param doMountSdCard Mount the SD card after switching it on, which is necessary
* to use it
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* @return - returnvalue::OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
@ -117,7 +112,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
* the operation safer
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* @return - returnvalue::OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
@ -127,9 +122,9 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
* Update the state file or creates one if it does not exist. You need to call this
* function before calling #sdCardActive
* @return
* - RETURN_OK if the state file was updated successfully
* - returnvalue::OK if the state file was updated successfully
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
* - RETURN_FAILED: blocking command failed
* - returnvalue::FAILED: blocking command failed
*/
ReturnValue_t updateSdCardStateFile();
@ -139,7 +134,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
* the status of the SD cards and set the field of the provided boolean pair.
* @param active Pair of booleans, where the first entry is the state of the first SD card
* and the second one the state of the second SD card
* @return - RETURN_OK if the state was read successfully
* @return - returnvalue::OK if the state was read successfully
* - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user
* should call #updateSdCardStateFile again in that case
* - STATUS_FILE_NEXISTS if the status file does not exist

View File

@ -6,23 +6,23 @@ ReturnValue_t scratch::writeString(std::string name, std::string string) {
int result = std::system(oss.str().c_str());
if (result != 0) {
utility::handleSystemError(result, "scratch::writeString");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t scratch::readString(std::string key, std::string &string) {
std::ifstream file;
std::string filename;
ReturnValue_t result = readToFile(key, file, filename);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::string line;
if (not std::getline(file, line)) {
std::remove(filename.c_str());
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
size_t pos = line.find("=");
@ -35,7 +35,7 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) {
return KEY_NOT_FOUND;
}
string = line.substr(pos + 1);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t scratch::clearValue(std::string key) {
@ -44,7 +44,7 @@ ReturnValue_t scratch::clearValue(std::string key) {
int result = std::system(oss.str().c_str());
if (result != 0) {
utility::handleSystemError(result, "scratch::clearValue");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -7,7 +7,7 @@
#include <sstream>
#include <type_traits>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "linux/utility/utility.h"
#include "returnvalues/classIds.h"
@ -21,7 +21,7 @@ static constexpr char PREFERED_SDC_KEY[] = "PREFSD";
static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR";
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER;
static constexpr ReturnValue_t KEY_NOT_FOUND = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t KEY_NOT_FOUND = returnvalue::makeCode(INTERFACE_ID, 0);
ReturnValue_t clearValue(std::string key);
@ -83,11 +83,11 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
} else {
utility::handleSystemError(result, "scratch::readToFile");
std::remove(filename.c_str());
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
}
file.open(filename);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
} // End of anonymous namespace
@ -99,9 +99,9 @@ inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
int result = std::system(oss.str().c_str());
if (result != 0) {
utility::handleSystemError(result, "scratch::writeNumber");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
@ -110,7 +110,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
ifstream file;
std::string filename;
ReturnValue_t result = readToFile(key, file, filename);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
std::remove(filename.c_str());
return result;
}
@ -118,7 +118,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
string line;
if (not std::getline(file, line)) {
std::remove(filename.c_str());
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
size_t pos = line.find("=");
@ -138,7 +138,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
}
std::remove(filename.c_str());
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
} // namespace scratch

View File

@ -12,20 +12,20 @@ Xadc::Xadc() {}
Xadc::~Xadc() {}
ReturnValue_t Xadc::getTemperature(float& temperature) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
int raw = 0;
int offset = 0;
float scale = 0;
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
temperature = (raw + offset) * scale / 1000;
@ -35,84 +35,84 @@ ReturnValue_t Xadc::getTemperature(float& temperature) {
ReturnValue_t Xadc::getVccPint(float& vccPint) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVccInt(float& vccInt) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVccAux(float& vccAux) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVccBram(float& vccBram) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVrefp(float& vrefp) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::getVrefn(float& vrefn) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
float& voltage) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
float raw = 0;
float scale = 0;
result = readValFromFile(rawFile.c_str(), raw);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = readValFromFile(scaleFile.c_str(), scale);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
voltage = calculateVoltage(raw, scale);
@ -127,7 +127,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
fp = fopen(filename, "r");
if (fp == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
char valstring[MAX_STR_LENGTH] = "";
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
@ -135,10 +135,10 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
<< std::endl;
fclose(fp);
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
std::istringstream valSstream(valstring);
valSstream >> val;
fclose(fp);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -3,7 +3,7 @@
#include <string>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
namespace xadc {
using namespace std;

View File

@ -2,7 +2,7 @@
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
@ -36,7 +36,7 @@ void initmission::initMission() {
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (factory == nullptr) {
/* Should never happen ! */
return;
@ -51,28 +51,28 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Add component TMTC Polling failed" << std::endl;
}
@ -84,7 +84,7 @@ void initmission::initTasks() {
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstUart(pst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
pstTasks.push_back(pst);
@ -93,7 +93,7 @@ void initmission::initTasks() {
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
}
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/
@ -102,7 +102,7 @@ void initmission::initTasks() {
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
@ -111,7 +111,7 @@ void initmission::initTasks() {
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
@ -121,7 +121,7 @@ void initmission::initTasks() {
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
@ -160,11 +160,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
taskVec.push_back(pusVerification);
@ -172,11 +172,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
taskVec.push_back(pusEvents);
@ -184,11 +184,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
@ -196,19 +196,19 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
taskVec.push_back(pusMedPrio);
@ -216,11 +216,11 @@ void initmission::createPusTasks(TaskFactory& factory,
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);

View File

@ -19,16 +19,16 @@ ReturnValue_t AcuDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t AcuDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AcuDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AcuDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void AcuDummy::fillCommandAndReplyMap() {}
@ -37,6 +37,6 @@ uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
return HasReturnvaluesIF::RETURN_OK;
localDataPoolMap.emplace(ACU::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
return returnvalue::OK;
}

View File

@ -19,16 +19,16 @@ ReturnValue_t BpxDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t BpxDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t BpxDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t BpxDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void BpxDummy::fillCommandAndReplyMap() {}
@ -51,5 +51,5 @@ ReturnValue_t BpxDummy::initializeLocalDataPool(localpool::DataPool &localDataPo
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -4,18 +4,18 @@ ComIFDummy::ComIFDummy(object_id_t objectId) : SystemObject(objectId) {}
ComIFDummy::~ComIFDummy() {}
ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return RETURN_OK; }
ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return returnvalue::OK; }
ReturnValue_t ComIFDummy::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; }
ReturnValue_t ComIFDummy::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ComIFDummy::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -14,16 +14,16 @@ ReturnValue_t CoreControllerDummy::initialize() {
if (not done) {
done = true;
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CoreControllerDummy::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
void CoreControllerDummy::performControlOperation() { return; }
@ -33,7 +33,7 @@ ReturnValue_t CoreControllerDummy::initializeLocalDataPool(localpool::DataPool&
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
LocalPoolDataSetBase* CoreControllerDummy::getDataSetHandle(sid_t sid) {
@ -51,5 +51,5 @@ ReturnValue_t CoreControllerDummy::checkModeCommand(Mode_t mode, Submode_t submo
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
return INVALID_MODE;
}
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t GyroAdisDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
ReturnValue_t GyroAdisDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GyroAdisDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GyroAdisDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void GyroAdisDummy::fillCommandAndReplyMap() {}
@ -41,5 +41,5 @@ uint32_t GyroAdisDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { r
ReturnValue_t GyroAdisDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t GyroL3GD20Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *i
ReturnValue_t GyroL3GD20Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GyroL3GD20Dummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GyroL3GD20Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void GyroL3GD20Dummy::fillCommandAndReplyMap() {}
@ -44,5 +44,5 @@ ReturnValue_t GyroL3GD20Dummy::initializeLocalDataPool(localpool::DataPool &loca
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -20,16 +20,16 @@ ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t ImtqDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ImtqDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t ImtqDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void ImtqDummy::fillCommandAndReplyMap() {}
@ -39,5 +39,5 @@ uint32_t ImtqDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { retur
ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t MgmLIS3MDLDummy::buildTransitionDeviceCommand(DeviceCommandId_t *i
ReturnValue_t MgmLIS3MDLDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t MgmLIS3MDLDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t MgmLIS3MDLDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void MgmLIS3MDLDummy::fillCommandAndReplyMap() {}
@ -41,5 +41,5 @@ uint32_t MgmLIS3MDLDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
ReturnValue_t MgmLIS3MDLDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t P60DockDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
ReturnValue_t P60DockDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t P60DockDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t P60DockDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void P60DockDummy::fillCommandAndReplyMap() {}
@ -40,7 +40,7 @@ uint32_t P60DockDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { re
ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
return returnvalue::OK;
}

View File

@ -19,16 +19,16 @@ ReturnValue_t PduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t PduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PduDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void PduDummy::fillCommandAndReplyMap() {}
@ -37,6 +37,6 @@ uint32_t PduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
ReturnValue_t PduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
localDataPoolMap.emplace(PDU::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t PlPcduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t PlPcduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlPcduDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlPcduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void PlPcduDummy::fillCommandAndReplyMap() {}
@ -41,5 +41,5 @@ uint32_t PlPcduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { ret
ReturnValue_t PlPcduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -19,16 +19,16 @@ ReturnValue_t RwDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
ReturnValue_t RwDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t RwDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t RwDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void RwDummy::fillCommandAndReplyMap() {}
@ -71,5 +71,5 @@ ReturnValue_t RwDummy::initializeLocalDataPool(localpool::DataPool &localDataPoo
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t StarTrackerDummy::buildTransitionDeviceCommand(DeviceCommandId_t *
ReturnValue_t StarTrackerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void StarTrackerDummy::fillCommandAndReplyMap() {}
@ -41,5 +41,5 @@ uint32_t StarTrackerDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo)
ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(startracker::MCU_TEMPERATURE, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -25,15 +25,17 @@ ReturnValue_t SusDummy::initialize() {
if (not done) {
done = true;
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) { return RETURN_FAILED; }
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) {
return returnvalue::FAILED;
}
void SusDummy::performControlOperation() {
iteration++;
@ -54,7 +56,7 @@ ReturnValue_t SusDummy::initializeLocalDataPool(localpool::DataPool& localDataPo
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, new PoolEntry<float>({0}, 1, true));
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry<uint16_t>({0}));
return RETURN_OK;
return returnvalue::OK;
}
LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) {
@ -74,5 +76,5 @@ ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode,
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
return INVALID_MODE;
}
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -22,16 +22,16 @@ ReturnValue_t SyrlinksDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
ReturnValue_t SyrlinksDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SyrlinksDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SyrlinksDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return RETURN_OK;
return returnvalue::OK;
}
void SyrlinksDummy::fillCommandAndReplyMap() {}
@ -42,5 +42,5 @@ ReturnValue_t SyrlinksDummy::initializeLocalDataPool(localpool::DataPool &localD
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -32,16 +32,16 @@ ReturnValue_t TemperatureSensorsDummy::initialize() {
if (not done) {
done = true;
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
void TemperatureSensorsDummy::performControlOperation() {
@ -49,7 +49,7 @@ void TemperatureSensorsDummy::performControlOperation() {
value = sin(iteration / 80. * M_PI) * 10;
ReturnValue_t result = max31865Set.read();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
}
max31865Set.rtdValue = value - 5;
@ -73,7 +73,7 @@ ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool(
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::FAULT_BYTE),
new PoolEntry<uint8_t>({0}));
return RETURN_OK;
return returnvalue::OK;
}
LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) {
@ -94,5 +94,5 @@ ReturnValue_t TemperatureSensorsDummy::checkModeCommand(Mode_t mode, Submode_t s
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
return INVALID_MODE;
}
return RETURN_OK;
return returnvalue::OK;
}

2
fsfw

@ -1 +1 @@
Subproject commit 7881f5bab86212035b94f4995551d75e843174b5
Subproject commit 9a590a3fcd81ed4dd48de503522b6d71f64205d2

@ -1 +1 @@
Subproject commit e84be4bb1710e90e97f8e501565106b9e63ef56b
Subproject commit b1e5a2d40a5f41b9020f2beb0b976035f91c6343

View File

@ -340,7 +340,7 @@ void ObjectFactory::createThermalController() {
void ObjectFactory::createAcsController() { new AcsController(objects::ACS_CONTROLLER); }
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
}
}

View File

@ -1,6 +1,6 @@
#pragma once
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <string>

View File

@ -17,20 +17,20 @@ ReturnValue_t I2cTestClass::initialize() {
if (mode == TestModes::BPX_BATTERY) {
battInit();
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t I2cTestClass::performPeriodicAction() {
if (mode == TestModes::BPX_BATTERY) {
battPeriodic();
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void I2cTestClass::battInit() {
sif::info << "I2cTestClass: BPX Initialization" << std::endl;
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
if (fileHelper.getOpenResult() != returnvalue::OK) {
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
return;
}
@ -41,13 +41,13 @@ void I2cTestClass::battInit() {
cmdBuf[1] = 0x42;
sendLen = 2;
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
// Receive back port, error byte and ping reply
recvLen = 3;
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
sif::info << "Ping reply:" << std::endl;
@ -59,7 +59,7 @@ void I2cTestClass::battInit() {
void I2cTestClass::battPeriodic() {
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
if (fileHelper.getOpenResult() != returnvalue::OK) {
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
return;
}
@ -69,13 +69,13 @@ void I2cTestClass::battPeriodic() {
cmdBuf[0] = BpxBattery::PORT_GET_HK;
sendLen = 1;
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
// Receive back HK set
recvLen = 23;
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
sif::info << "HK reply:" << std::endl;
@ -86,16 +86,16 @@ ReturnValue_t I2cTestClass::i2cWrite(int fd, uint8_t* data, size_t len) {
if (write(fd, data, len) != static_cast<ssize_t>(len)) {
sif::error << "Failed to write to I2C bus" << std::endl;
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t I2cTestClass::i2cRead(int fd, uint8_t* data, size_t len) {
if (read(fd, data, len) != static_cast<ssize_t>(len)) {
sif::error << "Failed to read from I2C bus" << std::endl;
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -25,9 +25,9 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
switch (testCase) {
case (TestCases::READ): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
} else {
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = "
<< static_cast<int>(gpioState) << std::endl;
@ -39,23 +39,23 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
}
case (TestCases::BLINK): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (gpioState == gpio::Levels::HIGH) {
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
} else if (gpioState == gpio::Levels::LOW) {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
} else {
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
@ -68,7 +68,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
break;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t LibgpiodTest::performOneShotAction() {
@ -84,44 +84,44 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
}
case (TestCases::LOOPBACK): {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO pulled high successfully for loopback test"
<< std::endl;
} else {
sif::warning << "LibgpiodTest::performOneShotAction: Could not pull GPIO high!"
<< std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::HIGH) {
if (result == returnvalue::OK and gpioState == gpio::Levels::HIGH) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is high"
<< std::endl;
} else {
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not high!"
<< std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO pulled low successfully for loopback test"
<< std::endl;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::LOW) {
if (result == returnvalue::OK and gpioState == gpio::Levels::LOW) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is low"
<< std::endl;
} else {
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not low!"
<< std::endl;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
break;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -53,7 +53,7 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
break;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t SpiTestClass::performPeriodicAction() {
@ -65,7 +65,7 @@ ReturnValue_t SpiTestClass::performPeriodicAction() {
default:
break;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
@ -532,11 +532,11 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
adcCfg.vbatSwitch) {
// This enables the ADC
ReturnValue_t result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
adcCfg.vbatSwitch = false;
@ -878,10 +878,10 @@ uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO) {
int retval = 0;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (chipSelect != gpio::NO_GPIO) {
result = gpioIF->pullLow(chipSelect);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -889,14 +889,14 @@ ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO
retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
if (retval < 0) {
utility::handleIoctlError("SpiTestClass::transfer: ioctl failed");
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
if (chipSelect != gpio::NO_GPIO) {
result = gpioIF->pullHigh(chipSelect);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -47,10 +47,10 @@ ReturnValue_t UartTestClass::initialize() {
} else if (mode == TestModes::SCEX) {
scexInit();
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::RETURN_OK; }
ReturnValue_t UartTestClass::performOneShotAction() { return returnvalue::OK; }
ReturnValue_t UartTestClass::performPeriodicAction() {
if (mode == TestModes::GPS) {
@ -58,7 +58,7 @@ ReturnValue_t UartTestClass::performPeriodicAction() {
} else if (mode == TestModes::SCEX) {
scexPeriodic();
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void UartTestClass::gpsInit() {
@ -368,12 +368,17 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
cmdBuf[1] = 1;
cmdBuf[2] = 1;
uint16_t userDataLen = 0;
cmdBuf[3] = (userDataLen >> 8) & 0xff;
cmdBuf[4] = userDataLen & 0xff;
uint16_t crc = CRC::crc16ccitt(cmdBuf, 5);
cmdBuf[5] = (crc >> 8) & 0xff;
cmdBuf[6] = crc & 0xff;
*len = 7;
tmpCmdBuf[3] = (userDataLen >> 8) & 0xff;
tmpCmdBuf[4] = userDataLen & 0xff;
uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5);
tmpCmdBuf[5] = (crc >> 8) & 0xff;
tmpCmdBuf[6] = crc & 0xff;
ReturnValue_t result =
dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
if (result != returnvalue::OK) {
sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl;
return -1;
}
return 0;
}

View File

@ -1 +1 @@
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp)
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp)

View File

@ -3,8 +3,16 @@
#include <csp/drivers/can_socketcan.h>
#include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <p60acu.h>
#include <p60dock.h>
#include <p60pdu.h>
#include <param/param_string.h>
#include <param/rparam_client.h>
#include "CspCookie.h"
#include "mission/csp/CspCookie.h"
using namespace GOMSPACE;
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
@ -31,7 +39,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
if (csp_init(cspOwnAddress) != CSP_ERR_NONE ||
csp_buffer_init(buf_count, buf_size) != CSP_ERR_NONE) {
sif::error << "Failed to init CSP\r\n" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
int promisc = 0; // Set filter mode on
@ -45,7 +53,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
int result = csp_rtable_set(address, netmask, csp_if_ptr, mac);
if (result != CSP_ERR_NONE) {
sif::error << "Failed to add can interface to router table" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
/* Start the route task */
@ -54,7 +62,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
result = csp_route_start_task(task_stack_size, priority);
if (result != CSP_ERR_NONE) {
sif::error << "Failed to start csp route task" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
sif::info << canInterface << " initialized successfully" << std::endl;
}
@ -63,78 +71,144 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
uint16_t maxReplyLength = cspCookie->getMaxReplyLength();
if (cspDeviceMap.find(cspAddress) == cspDeviceMap.end()) {
/* Insert device information in CSP map */
cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength));
cspDeviceMap.emplace(cspAddress, ReplyInfo(maxReplyLength));
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
int result;
if (cookie == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
if (cookie == nullptr) {
return returnvalue::FAILED;
}
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
if (cspCookie == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
if (cspCookie == nullptr) {
return returnvalue::FAILED;
}
/* Extract csp port and bytes to query from command buffer */
uint8_t cspPort;
uint16_t querySize = 0;
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
if (cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::DEFAULT_COM_IF) {
/* Extract csp port and bytes to query from command buffer */
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
if (result != returnvalue::OK) {
return result;
}
} else {
cspPort = cspCookie->getCspPort();
querySize = cspCookie->getReplyLen();
}
if (querySize > cspCookie->getMaxReplyLength()) {
sif::error << "Query size " << querySize << " is larger than maximum allowed "
<< cspCookie->getMaxReplyLength() << std::endl;
return returnvalue::FAILED;
}
uint8_t cspAddress = cspCookie->getCspAddress();
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return returnvalue::FAILED;
}
switch (cspPort) {
case (Ports::CSP_PING): {
case (CspPorts::CSP_PING): {
initiatePingRequest(cspAddress, querySize);
break;
}
case (Ports::CSP_REBOOT): {
case (CspPorts::CSP_REBOOT): {
csp_reboot(cspAddress);
break;
}
case (Ports::P60_PORT_GNDWDT_RESET):
case (Ports::P60_PORT_RPARAM): {
/* No CSP fixed port was selected. Send data to the specified port and
* wait for querySize number of bytes */
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize);
if (result != HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_FAILED;
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
case (CspPorts::P60_PORT_RPARAM_ENUM): {
if (cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
param_index_t requestStruct{};
requestStruct.physaddr = iter->second.replyBuf.data();
auto req = cspCookie->getRequest();
if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
if (!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
if (!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
if (!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_CONFIG) {
requestStruct.table = p60pdu_config;
requestStruct.mem_id = P60PDU_PARAM;
requestStruct.count = p60pdu_config_count;
requestStruct.size = P60PDU_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
if (result != 0) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_CONFIG) {
requestStruct.table = p60acu_config;
requestStruct.mem_id = P60ACU_PARAM;
requestStruct.count = p60acu_config_count;
requestStruct.size = P60ACU_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
if (result != 0) {
return returnvalue::FAILED;
}
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_CONFIG) {
requestStruct.table = p60dock_config;
requestStruct.mem_id = P60DOCK_PARAM;
requestStruct.count = p60dock_config_count;
requestStruct.size = P60DOCK_PARAM_SIZE;
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
requestStruct.mem_id, cspCookie->getTimeout());
if (result != 0) {
return returnvalue::FAILED;
}
}
} else {
/* No CSP fixed port was selected. Send data to the specified port and
* wait for querySize number of bytes */
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize);
if (result != returnvalue::OK) {
return returnvalue::FAILED;
}
}
replySize = querySize;
iter->second.replyLen = querySize;
break;
}
default:
sif::error << "CspComIF: Invalid port specified" << std::endl;
break;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CspComIF::getSendSuccess(CookieIF* cookie) { return HasReturnvaluesIF::RETURN_OK; }
ReturnValue_t CspComIF::getSendSuccess(CookieIF* cookie) { return returnvalue::OK; }
ReturnValue_t CspComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CspComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
if (cookie == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
if (cspCookie == NULL) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
uint8_t cspAddress = cspCookie->getCspAddress();
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return returnvalue::FAILED;
}
*buffer = iter->second.replyBuf.data();
*size = iter->second.replyLen;
*buffer = cspDeviceMap[cspAddress].data();
*size = replySize;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t* cmdBuffer,
@ -142,13 +216,13 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
uint32_t timeout_ms = 1000;
uint16_t bytesRead = 0;
int32_t expectedSize = static_cast<int32_t>(querySize);
vectorBufferIter iter = cspDeviceMap.find(cspAddress);
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
sif::error << "CSP device with address " << cspAddress << " no found in"
<< " device map" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
uint8_t* replyBuffer = iter->second.data();
uint8_t* replyBuffer = iter->second.replyBuf.data();
csp_conn_t* conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0, CSP_O_NONE);
@ -157,7 +231,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
sif::error << "CspComIF::cspTransfer: Failed to get memory for a csp packet from the csp "
<< "stack" << std::endl;
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
memcpy(commandPacket->data, cmdBuffer, cmdLen);
@ -167,12 +241,12 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
csp_buffer_free(commandPacket);
sif::error << "CspComIF::cspTransfer: Failed to send csp packet" << std::endl;
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
/* Return when no reply is expected */
if (expectedSize == 0) {
return RETURN_OK;
return returnvalue::OK;
}
csp_packet_t* reply;
@ -180,7 +254,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
if (reply == NULL) {
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
memcpy(replyBuffer, reply->data, reply->length);
expectedSize = expectedSize - reply->length;
@ -191,13 +265,13 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
if (reply == NULL) {
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
if ((reply->length + bytesRead) > iter->second.size()) {
if ((reply->length + bytesRead) > iter->second.replyBuf.size()) {
sif::error << "CspComIF::cspTransfer: Reply buffer to short" << std::endl;
csp_buffer_free(reply);
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
memcpy(replyBuffer + bytesRead, reply->data, reply->length);
expectedSize = expectedSize - reply->length;
@ -209,30 +283,30 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
sif::error << "CspComIF::cspTransfer: Received more bytes than requested" << std::endl;
sif::debug << "CspComIF::cspTransfer: Received bytes: " << bytesRead << std::endl;
csp_close(conn);
return RETURN_FAILED;
return returnvalue::FAILED;
}
csp_close(conn);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t CspComIF::getPortAndQuerySize(const uint8_t** sendData, size_t* sendLen,
uint8_t* cspPort, uint16_t* querySize) {
ReturnValue_t result =
SerializeAdapter::deSerialize(cspPort, sendData, sendLen, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "CspComIF: Failed to deserialize CSP port from command "
<< "buffer" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
SerializeAdapter::deSerialize(querySize, sendData, sendLen, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "CspComIF: Failed to deserialize querySize from command "
<< "buffer" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
@ -240,8 +314,12 @@ void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
uint32_t replyTime = csp_ping(cspAddress, timeout_ms, querySize, CSP_O_NONE);
sif::info << "Ping address: " << cspAddress << ", reply after " << replyTime << " ms"
<< std::endl;
auto iter = cspDeviceMap.find(cspAddress);
if (iter == cspDeviceMap.end()) {
return;
}
/* Store reply time in reply buffer * */
uint8_t* replyBuffer = cspDeviceMap[cspAddress].data();
uint8_t* replyBuffer = iter->second.replyBuf.data();
memcpy(replyBuffer, &replyTime, sizeof(replyTime));
replySize = sizeof(replyTime);
iter->second.replyLen = sizeof(replyTime);
}

View File

@ -4,7 +4,7 @@
#include <csp/csp.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/returnvalues/returnvalue.h>
#include <unordered_map>
#include <vector>
@ -42,24 +42,22 @@ class CspComIF : public DeviceCommunicationIF, public SystemObject {
ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t *cmdBuffer,
int cmdLen, uint16_t querySize);
enum Ports { CSP_PING = 1, CSP_REBOOT = 4, P60_PORT_RPARAM = 7, P60_PORT_GNDWDT_RESET = 9 };
typedef uint8_t node_t;
using vectorBuffer = std::vector<uint8_t>;
using VectorBufferMap = std::unordered_map<node_t, vectorBuffer>;
using vectorBufferIter = VectorBufferMap::iterator;
struct ReplyInfo {
ReplyInfo(size_t maxLen) : replyBuf(maxLen){};
std::vector<uint8_t> replyBuf;
size_t replyLen = 0;
};
using VectorBufferMap = std::unordered_map<node_t, ReplyInfo>;
/* In this map assigns reply buffers to a CSP device */
VectorBufferMap cspDeviceMap;
uint16_t replySize = 0;
/* This is the CSP address of the OBC. */
node_t cspOwnAddress = 1;
/* Interface struct for csp protocol stack */
csp_iface_t csp_if;
char canInterface[5] = "can0";
int bitrate = 1000;

View File

@ -1,10 +0,0 @@
#include "CspCookie.h"
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_)
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_) {}
CspCookie::~CspCookie() {}
uint16_t CspCookie::getMaxReplyLength() { return maxReplyLength; }
uint8_t CspCookie::getCspAddress() { return cspAddress; }

View File

@ -1,26 +0,0 @@
#ifndef LINUX_CSP_CSPCOOKIE_H_
#define LINUX_CSP_CSPCOOKIE_H_
#include <fsfw/devicehandlers/CookieIF.h>
#include <cstdint>
/**
* @brief This is the cookie for devices supporting the CSP (CubeSat Space
* Protocol).
* @author J. Meier
*/
class CspCookie : public CookieIF {
public:
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_);
virtual ~CspCookie();
uint16_t getMaxReplyLength();
uint8_t getCspAddress();
private:
uint16_t maxReplyLength;
uint8_t cspAddress;
};
#endif /* LINUX_CSP_CSPCOOKIE_H_ */

View File

@ -50,7 +50,7 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
return HasModesIF::INVALID_MODE;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
@ -68,7 +68,7 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
@ -88,7 +88,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0});
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
@ -99,7 +99,7 @@ void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t
ReturnValue_t GPSHyperionLinuxController::initialize() {
ReturnValue_t result = ExtendedControllerBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
auto openError = [&](const char *type, int error) {
@ -178,11 +178,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
PoolReadGuard pg(&gpsSet);
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
if (pg.getReadResult() != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
#endif
return RETURN_FAILED;
return returnvalue::FAILED;
}
bool validFix = false;
@ -311,7 +311,7 @@ ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
std::tm tm = *std::gmtime(&t);
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
}
return RETURN_OK;
return returnvalue::OK;
}
#endif

View File

@ -24,7 +24,7 @@ Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelCom
ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
using namespace MAX31865;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
static_cast<void>(result);
// Stopwatch watch;
if (periodicInitHandling()) {
@ -34,12 +34,12 @@ ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
#endif
} else {
// No devices usable (e.g. TCS board off)
return RETURN_OK;
return returnvalue::OK;
}
#if OBSW_RTD_AUTO_MODE == 0
result = periodicReadReqHandling();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
// After requesting, 65 milliseconds delay required
@ -59,8 +59,8 @@ bool Max31865RtdReader::rtdIsActive(uint8_t idx) {
bool Max31865RtdReader::periodicInitHandling() {
using namespace MAX31865;
MutexGuard mg(readerMutex);
ReturnValue_t result = RETURN_OK;
if (mg.getLockResult() != RETURN_OK) {
ReturnValue_t result = returnvalue::OK;
if (mg.getLockResult() != returnvalue::OK) {
sif::warning << "Max31865RtdReader::periodicInitHandling: Mutex lock failed" << std::endl;
return false;
}
@ -71,28 +71,28 @@ bool Max31865RtdReader::periodicInitHandling() {
}
if ((rtd->on or rtd->active) and not rtd->configured and rtd->cd.hasTimedOut()) {
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) {
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
break;
}
result = writeCfgReg(rtd->spiCookie, BASE_CFG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeCfgReg");
}
if (rtd->writeLowThreshold) {
result = writeLowThreshold(rtd->spiCookie, rtd->lowThreshold);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeLowThreshold");
}
}
if (rtd->writeHighThreshold) {
result = writeHighThreshold(rtd->spiCookie, rtd->highThreshold);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeHighThreshold");
}
}
result = clearFaultStatus(rtd->spiCookie);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "clearFaultStatus");
}
rtd->configured = true;
@ -123,9 +123,9 @@ bool Max31865RtdReader::periodicInitHandling() {
ReturnValue_t Max31865RtdReader::periodicReadReqHandling() {
using namespace MAX31865;
MutexGuard mg(readerMutex);
if (mg.getLockResult() != RETURN_OK) {
if (mg.getLockResult() != returnvalue::OK) {
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
// Now request one shot config for all active RTDs
for (auto& rtd : rtds) {
@ -134,23 +134,23 @@ ReturnValue_t Max31865RtdReader::periodicReadReqHandling() {
}
if (rtdIsActive(rtd->idx)) {
ReturnValue_t result = writeCfgReg(rtd->spiCookie, BASE_CFG | (1 << CfgBitPos::ONE_SHOT));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "writeCfgReg");
// Release mutex ASAP
return RETURN_FAILED;
return returnvalue::FAILED;
}
}
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::periodicReadHandling() {
using namespace MAX31865;
auto result = RETURN_OK;
auto result = returnvalue::OK;
MutexGuard mg(readerMutex);
if (mg.getLockResult() != RETURN_OK) {
if (mg.getLockResult() != returnvalue::OK) {
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
// Now read the RTD values
for (auto& rtd : rtds) {
@ -161,9 +161,9 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
uint16_t rtdVal = 0;
bool faultBitSet = false;
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
handleSpiError(rtd, result, "readRtdVal");
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (faultBitSet) {
rtd->db.faultBitSet = faultBitSet;
@ -183,7 +183,7 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
}
}
#endif
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
@ -192,7 +192,7 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
}
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
ReturnValue_t result = comIF->initializeInterface(rtdCookie->spiCookie);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (rtdCookie->idx > EiveMax31855::NUM_RTDS) {
@ -203,28 +203,28 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
if (dbLen == 0) {
dbLen = rtdCookie->db.getSerializedSize();
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* sendData,
size_t sendLen) {
if (cookie == nullptr) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
// Empty command.. don't fail for now
if (sendLen < 1) {
return RETURN_OK;
return returnvalue::OK;
}
MutexGuard mg(readerMutex);
if (mg.getLockResult() != RETURN_OK) {
if (mg.getLockResult() != returnvalue::OK) {
sif::warning << "Max31865RtdReader::sendMessage: Mutex lock failed" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
uint8_t cmdRaw = sendData[0];
if (cmdRaw > EiveMax31855::RtdCommands::NUM_CMDS) {
sif::warning << "Max31865RtdReader::sendMessage: Invalid command" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
auto thresholdHandler = [](Max31865ReaderCookie* rtdCookie, const uint8_t* sendData) {
@ -275,7 +275,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
rtdCookie->highThreshold = (sendData[1] << 8) | sendData[2];
rtdCookie->writeHighThreshold = true;
} else {
return RETURN_FAILED;
return returnvalue::FAILED;
}
break;
}
@ -284,7 +284,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
rtdCookie->lowThreshold = (sendData[1] << 8) | sendData[2];
rtdCookie->writeLowThreshold = true;
} else {
return RETURN_FAILED;
return returnvalue::FAILED;
}
break;
}
@ -294,34 +294,37 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
break;
}
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::getSendSuccess(CookieIF* cookie) { return RETURN_OK; }
ReturnValue_t Max31865RtdReader::getSendSuccess(CookieIF* cookie) { return returnvalue::OK; }
ReturnValue_t Max31865RtdReader::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
size_t* size) {
MutexGuard mg(readerMutex);
if (mg.getLockResult() != RETURN_OK) {
if (mg.getLockResult() != returnvalue::OK) {
// TODO: Emit warning
return RETURN_FAILED;
return returnvalue::FAILED;
}
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
if(rtdCookie == nullptr) {
return returnvalue::FAILED;
}
uint8_t* exchangePtr = rtdCookie->exchangeBuf.data();
size_t serLen = 0;
auto result = rtdCookie->db.serialize(&exchangePtr, &serLen, rtdCookie->exchangeBuf.size(),
SerializeIF::Endianness::MACHINE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
// TODO: Emit warning
return RETURN_FAILED;
return returnvalue::FAILED;
}
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
*size = serLen;
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
@ -345,7 +348,7 @@ ReturnValue_t Max31865RtdReader::clearFaultStatus(SpiCookie* cookie) {
// Read back the current configuration to avoid overwriting it when clearing te fault status
uint8_t currentCfg = 0;
auto result = readCfgReg(cookie, currentCfg);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
// Clear bytes 5, 3 and 2 which need to be 0
@ -358,7 +361,7 @@ ReturnValue_t Max31865RtdReader::readCfgReg(SpiCookie* cookie, uint8_t& cfg) {
using namespace MAX31865;
uint8_t* replyPtr = nullptr;
auto result = readNFromReg(cookie, CONFIG, 1, &replyPtr);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
cfg = replyPtr[0];
}
return result;
@ -380,7 +383,7 @@ ReturnValue_t Max31865RtdReader::readLowThreshold(SpiCookie* cookie, uint16_t& l
using namespace MAX31865;
uint8_t* replyPtr = nullptr;
auto result = readNFromReg(cookie, LOW_THRESHOLD, 2, &replyPtr);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
lowThreshold = (replyPtr[0] << 8) | replyPtr[1];
}
return result;
@ -390,7 +393,7 @@ ReturnValue_t Max31865RtdReader::readHighThreshold(SpiCookie* cookie, uint16_t&
using namespace MAX31865;
uint8_t* replyPtr = nullptr;
auto result = readNFromReg(cookie, HIGH_THRESHOLD, 2, &replyPtr);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
highThreshold = (replyPtr[0] << 8) | replyPtr[1];
}
return result;
@ -400,7 +403,7 @@ ReturnValue_t Max31865RtdReader::writeNToReg(SpiCookie* cookie, uint8_t reg, siz
uint8_t** reply) {
using namespace MAX31865;
if (n > cmdBuf.size() - 1) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
cmdBuf[0] = reg | WRITE_BIT;
for (size_t idx = 0; idx < n; idx++) {
@ -413,7 +416,7 @@ ReturnValue_t Max31865RtdReader::readRtdVal(SpiCookie* cookie, uint16_t& val, bo
using namespace MAX31865;
uint8_t* replyPtr = nullptr;
auto result = readNFromReg(cookie, RTD, 2, &replyPtr);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (replyPtr[1] & 0b0000'0001) {
@ -428,27 +431,27 @@ ReturnValue_t Max31865RtdReader::readNFromReg(SpiCookie* cookie, uint8_t reg, si
uint8_t** reply) {
using namespace MAX31865;
if (n > 4) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
// Clear write bit in any case
reg &= ~WRITE_BIT;
cmdBuf[0] = reg;
std::memset(cmdBuf.data() + 1, 0, n);
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
if (result != RETURN_OK) {
return RETURN_FAILED;
if (result != returnvalue::OK) {
return returnvalue::FAILED;
}
size_t dummyLen = 0;
uint8_t* replyPtr = nullptr;
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (reply != nullptr) {
*reply = replyPtr + 1;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Max31865RtdReader::handleSpiError(Max31865ReaderCookie* cookie, ReturnValue_t result,

View File

@ -1,7 +1,7 @@
#ifndef MPSOC_RETURN_VALUES_IF_H_
#define MPSOC_RETURN_VALUES_IF_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
class MPSoCReturnValuesIF {
public:

View File

@ -164,21 +164,21 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
* @param commandData Pointer to command specific data
* @param commandDataLen Length of command data
*
* @return RETURN_OK if packet creation was successful, otherwise error return value
* @return returnvalue::OK if packet creation was successful, otherwise error return value
*/
ReturnValue_t buildPacket(const uint8_t* commandData, size_t commandDataLen) {
payloadStart = spParams.buf + ccsds::HEADER_LEN;
ReturnValue_t res;
if (commandData != nullptr and commandDataLen > 0) {
res = initPacket(commandData, commandDataLen);
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
}
updateSpFields();
res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -192,7 +192,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
* @param commandDataLen Length of received command data
*/
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -213,9 +213,9 @@ class TcMemRead : public TcBase {
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, MEM_ADDRESS_SIZE);
@ -224,7 +224,7 @@ class TcMemRead : public TcBase {
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
result =
SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return result;
@ -239,10 +239,10 @@ class TcMemRead : public TcBase {
uint16_t memLen = 0;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_LENGTH or checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
if (commandDataLen != COMMAND_LENGTH or checkPayloadLen() != returnvalue::OK) {
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -260,16 +260,16 @@ class TcMemWrite : public TcBase {
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint16_t memLen =
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
@ -294,7 +294,7 @@ class TcMemWrite : public TcBase {
<< spParams.maxSize - CRC_SIZE << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -315,7 +315,7 @@ class FlashFopen : public ploc::SpTcBase {
size_t nameSize = filename.size();
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
ReturnValue_t result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, filename.c_str(), nameSize);
@ -341,7 +341,7 @@ class FlashFclose : public ploc::SpTcBase {
size_t nameSize = filename.size();
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
ReturnValue_t result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, filename.c_str(), nameSize);
@ -359,27 +359,27 @@ class TcFlashWrite : public ploc::SpTcBase {
: ploc::SpTcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
writeLen = writeLen_;
if (writeLen > MAX_DATA_SIZE) {
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
size_t serializedSize = ccsds::HEADER_LEN;
result = SerializeAdapter::serialize(&writeLen, payloadStart, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
updateSpFields();
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -401,7 +401,7 @@ class TcFlashDelete : public ploc::SpTcBase {
size_t nameSize = filename.size();
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
auto res = checkPayloadLen();
if (res != HasReturnvaluesIF::RETURN_OK) {
if (res != returnvalue::OK) {
return res;
}
std::memcpy(payloadStart, filename.c_str(), nameSize);
@ -409,7 +409,7 @@ class TcFlashDelete : public ploc::SpTcBase {
updateSpFields();
res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -438,14 +438,14 @@ class TcReplayStart : public TcBase {
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
spParams.setPayloadLen(commandDataLen);
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = checkData(*commandData);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
@ -458,12 +458,11 @@ class TcReplayStart : public TcBase {
static const uint8_t ONCE = 1;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_DATA_LENGTH or
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
if (commandDataLen != COMMAND_DATA_LENGTH or checkPayloadLen() != returnvalue::OK) {
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t checkData(uint8_t replay) {
@ -471,7 +470,7 @@ class TcReplayStart : public TcBase {
sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl;
return INVALID_PARAMETER;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -488,22 +487,22 @@ class TcDownlinkPwrOn : public TcBase {
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = modeCheck(*commandData);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = laneRateCheck(*(commandData + 1));
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
spParams.setPayloadLen(commandDataLen + sizeof(MAX_AMPLITUDE));
result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
@ -529,7 +528,7 @@ class TcDownlinkPwrOn : public TcBase {
sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t modeCheck(uint8_t mode) {
@ -537,7 +536,7 @@ class TcDownlinkPwrOn : public TcBase {
sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl;
return INVALID_MODE;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t laneRateCheck(uint8_t laneRate) {
@ -545,7 +544,7 @@ class TcDownlinkPwrOn : public TcBase {
sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl;
return INVALID_LANE_RATE;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -571,10 +570,10 @@ class TcReplayWriteSeq : public TcBase {
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
spParams.setPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR));
result = lengthCheck(commandDataLen);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
@ -587,12 +586,12 @@ class TcReplayWriteSeq : public TcBase {
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
checkPayloadLen() != returnvalue::OK) {
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
<< std::endl;
return INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -616,7 +615,7 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
if (mpsocFile.size() > MAX_FILENAME_SIZE) {
return MPSOC_FILENAME_TOO_LONG;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
std::string getObcFile() { return obcFile; }
@ -660,7 +659,7 @@ class TcCamcmdSend : public TcBase {
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
auto res = checkPayloadLen();
if (res != HasReturnvaluesIF::RETURN_OK) {
if (res != returnvalue::OK) {
return res;
}
size_t size = ccsds::HEADER_LEN;
@ -669,7 +668,7 @@ class TcCamcmdSend : public TcBase {
std::memcpy(payloadStart + sizeof(dataLen), commandData, commandDataLen);
*(payloadStart + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
private:

View File

@ -101,6 +101,9 @@ static const uint16_t APID_DATA_LOGGER_DATA = 0x20D;
/**
* APIDs of telecommand packets
*/
// 2 bits APID SRC, 00 for OBC, 2 bits APID DEST, 01 for SUPV, 7 bits CMD ID -> Mask 0x080
static constexpr uint16_t APID_TC_SUPV_MASK = 0x080;
static const uint16_t APID_START_MPSOC = 0xA1;
static const uint16_t APID_SHUTWOWN_MPSOC = 0xA2;
static const uint16_t APID_SEL_MPSOC_BOOT_IMAGE = 0xA3;
@ -300,7 +303,7 @@ class ApidOnlyPacket : public ploc::SpTcBase {
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -336,7 +339,7 @@ class MPSoCBootSelect : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(mem, bp0, bp1, bp2);
@ -382,7 +385,7 @@ class EnableNvms : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t nvm01, uint8_t nvm3) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(nvm01, nvm3);
@ -412,11 +415,11 @@ class SetTimeRef : public ploc::SpTcBase {
ReturnValue_t buildPacket(Clock::TimeOfDay_t* time) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
res = initPacket(time);
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -434,37 +437,37 @@ class SetTimeRef : public ploc::SpTcBase {
ReturnValue_t result =
SerializeAdapter::serialize(&milliseconds, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t second = static_cast<uint8_t>(time->second);
result = SerializeAdapter::serialize(&second, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t minute = static_cast<uint8_t>(time->minute);
result = SerializeAdapter::serialize(&minute, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t hour = static_cast<uint8_t>(time->hour);
result = SerializeAdapter::serialize(&hour, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t day = static_cast<uint8_t>(time->day);
result = SerializeAdapter::serialize(&day, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t month = static_cast<uint8_t>(time->month);
result = SerializeAdapter::serialize(&month, &dataFieldPtr, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t year = static_cast<uint8_t>(time->year - 1900);
@ -491,7 +494,7 @@ class SetBootTimeout : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint32_t timeout) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(timeout);
@ -528,7 +531,7 @@ class SetRestartTries : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t restartTries) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(restartTries);
@ -562,7 +565,7 @@ class DisablePeriodicHkTransmission : public ploc::SpTcBase {
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket();
@ -602,7 +605,7 @@ class LatchupAlert : public ploc::SpTcBase {
spParams.creator.setApid(APID_DISABLE_LATCHUP_ALERT);
}
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(latchupId);
@ -636,11 +639,11 @@ class SetAlertlimit : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t latchupId, uint32_t dutycycle) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
res = initPacket(latchupId, dutycycle);
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -679,7 +682,7 @@ class SetAdcEnabledChannels : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint16_t ch) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(ch);
@ -718,7 +721,7 @@ class SetAdcWindowAndStride : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(windowSize, stridingStepSize);
@ -758,7 +761,7 @@ class SetAdcThreshold : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint32_t threshold) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(threshold);
@ -796,7 +799,7 @@ class RunAutoEmTests : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t test) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(test);
@ -844,7 +847,7 @@ class MramCmd : public ploc::SpTcBase {
sif::debug << "WipeMram: Invalid action specified";
}
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(start, stop);
@ -892,7 +895,7 @@ class SetGpio : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(port, pin, val);
@ -936,7 +939,7 @@ class ReadGpio : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t port, uint8_t pin) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(port, pin);
@ -982,7 +985,7 @@ class FactoryReset : public ploc::SpTcBase {
ReturnValue_t buildPacket(Op op) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(op);
@ -1020,7 +1023,7 @@ class SetShutdownTimeout : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint32_t timeout) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(timeout);
@ -1059,7 +1062,7 @@ class CheckMemory : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(memoryId, startAddress, length);
@ -1114,7 +1117,7 @@ class WriteMemory : public ploc::SpTcBase {
spParams.creator.setSeqCount(sequenceCount);
initPacket(memoryId, startAddress, length, updateData);
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
return calcCrc();
@ -1137,7 +1140,7 @@ class WriteMemory : public ploc::SpTcBase {
}
// To avoid crashes in this unexpected case
ReturnValue_t result = checkPayloadLen();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
size_t serializedSize = 6;
@ -1155,7 +1158,7 @@ class WriteMemory : public ploc::SpTcBase {
// a value of zero is added here
data[updateDataLen + 1] = 0;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};
@ -1172,7 +1175,7 @@ class EraseMemory : public ploc::SpTcBase {
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
initPacket(memoryId, startAddress, length);
@ -1214,7 +1217,7 @@ class EnableAutoTm : public ploc::SpTcBase {
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = ENABLE;
@ -1239,7 +1242,7 @@ class DisableAutoTm : public ploc::SpTcBase {
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = DISABLE;
@ -1279,7 +1282,7 @@ class RequestLoggingData : public ploc::SpTcBase {
*/
ReturnValue_t buildPacket(Sa sa, uint8_t tpc = 0) {
auto res = checkSizeAndSerializeHeader();
if (res != result::OK) {
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = static_cast<uint8_t>(sa);
@ -1305,7 +1308,7 @@ class VerificationReport : public ploc::SpTmReader {
const uint8_t* refApidPtr = this->getPacketData();
ReturnValue_t result =
SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
return result;
}
@ -1318,14 +1321,14 @@ class VerificationReport : public ploc::SpTmReader {
const uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
return result;
}
return statusCode;
}
virtual ReturnValue_t checkApid() { return HasReturnvaluesIF::RETURN_FAILED; }
virtual ReturnValue_t checkApid() { return returnvalue::FAILED; }
private:
static const uint8_t OFFSET_STATUS_CODE = 4;
@ -1338,7 +1341,7 @@ class AcknowledgmentReport : public VerificationReport {
ReturnValue_t checkApid() {
uint16_t apid = this->getApid();
if (apid == APID_ACK_SUCCESS) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
} else if (apid == APID_ACK_FAILURE) {
printStatusInformation();
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
@ -1412,7 +1415,7 @@ class ExecutionReport : public VerificationReport {
ReturnValue_t checkApid() {
uint16_t apid = this->getApid();
if (apid == APID_EXE_SUCCESS) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
} else if (apid == APID_EXE_FAILURE) {
printStatusInformation();
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
@ -1844,7 +1847,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
ReturnValue_t parseDataField() {
ReturnValue_t result = lengthCheck();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
const uint8_t* dataFieldPtr = getFullData() + ccsds::HEADER_LEN;
@ -1855,14 +1858,14 @@ class UpdateStatusReport : public ploc::SpTmReader {
SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t verifycrc(uint16_t goodCrc) const {
if (crc != goodCrc) {
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
uint16_t getCrc() const { return crc; }
@ -1883,7 +1886,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
if (getFullPacketLen() != FULL_SIZE) {
return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
};

View File

@ -821,27 +821,27 @@ class ChecksumReply {
*
*/
ChecksumReply(const uint8_t* datafield) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
region = *(datafield);
const uint8_t* addressData = datafield + ADDRESS_OFFSET;
size_t size = sizeof(address);
result = SerializeAdapter::deSerialize(&address, &addressData, &size,
SerializeIF::Endianness::LITTLE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize address" << std::endl;
}
const uint8_t* lengthData = datafield + LENGTH_OFFSET;
size = sizeof(length);
result =
SerializeAdapter::deSerialize(&length, &lengthData, &size, SerializeIF::Endianness::LITTLE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize length" << std::endl;
}
const uint8_t* checksumData = datafield + CHECKSUM_OFFSET;
size = sizeof(checksum);
result = SerializeAdapter::deSerialize(&checksum, &checksumData, &size,
SerializeIF::Endianness::LITTLE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize checksum" << std::endl;
}
}

View File

@ -1,7 +1,7 @@
#ifndef SUPV_RETURN_VALUES_IF_H_
#define SUPV_RETURN_VALUES_IF_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
class SupvReturnValuesIF {
public:

View File

@ -26,9 +26,9 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid
PlocMPSoCHandler::~PlocMPSoCHandler() {}
ReturnValue_t PlocMPSoCHandler::initialize() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = DeviceHandlerBase::initialize();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
@ -46,13 +46,13 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
;
}
result = manager->registerListener(eventQueue->getId());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = manager->subscribeToEventRange(
eventQueue->getId(), event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED),
event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from "
" ploc mpsoc helper"
@ -62,13 +62,13 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
}
result = plocMPSoCHelper->setComIF(communicationInterface);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
plocMPSoCHelper->setComCookie(comCookie);
plocMPSoCHelper->setSequenceCount(&sequenceCount);
result = commandActionHelper.initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return result;
@ -76,7 +76,7 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
void PlocMPSoCHandler::performOperationHook() {
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {
switch (event.getMessageId()) {
case EventMessage::EVENT_MESSAGE:
@ -90,9 +90,9 @@ void PlocMPSoCHandler::performOperationHook() {
}
CommandMessage message;
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
result == returnvalue::OK; result = commandActionHelperQueue->receiveMessage(&message)) {
result = commandActionHelper.handleReply(&message);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
continue;
}
}
@ -100,7 +100,7 @@ void PlocMPSoCHandler::performOperationHook() {
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (actionId) {
case mpsoc::SET_UART_TX_TRISTATE: {
uartIsolatorSwitch.pullLow();
@ -127,12 +127,12 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
}
mpsoc::FlashWritePusCmd flashWritePusCmd;
result = flashWritePusCmd.extractFields(data, size);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
flashWritePusCmd.getMPSoCFile());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
plocMPSoCHelperExecuting = true;
@ -209,7 +209,7 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
const uint8_t* commandData,
size_t commandDataLen) {
spParams.buf = commandBuffer;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (deviceCommand) {
case (mpsoc::TC_MEM_WRITE): {
result = prepareTcMemWrite(commandData, commandDataLen);
@ -262,7 +262,7 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
break;
}
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
/**
* Flushing the receive buffer to make sure there are no data left from a faulty reply.
*/
@ -294,15 +294,15 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
SpacePacketReader spacePacket;
spacePacket.setReadOnlyData(start, remainingSize);
if (spacePacket.isNull()) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
auto res = spacePacket.checkSize();
if (res != RETURN_OK) {
if (res != returnvalue::OK) {
return res;
}
uint16_t apid = spacePacket.getApid();
@ -350,7 +350,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
}
ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (id) {
case mpsoc::ACK_REPORT: {
@ -384,7 +384,7 @@ uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo)
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
@ -402,31 +402,31 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount);
result = tcMemWrite.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcMemWrite.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcMemRead tcMemRead(spParams, sequenceCount);
result = tcMemRead.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcMemRead.getFullPacketLen());
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
@ -434,126 +434,126 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
return MPSoCReturnValuesIF::NAME_TOO_LONG;
}
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
result = tcFlashDelete.buildPacket(
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcFlashDelete.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount);
result = tcReplayStart.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcReplayStart.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount);
result = tcReplayStop.buildPacket();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcReplayStop.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount);
result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcDownlinkPwrOn.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount);
result = tcDownlinkPwrOff.buildPacket();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcReplayWriteSeq.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount);
result = tcModeReplay.buildPacket();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcModeReplay.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount);
result = tcModeIdle.buildPacket();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcModeIdle.getFullPacketLen());
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sequenceCount++;
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
result = tcCamCmdSend.buildPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sequenceCount--;
return result;
}
finishTcPrep(tcCamCmdSend.getFullPacketLen());
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
return RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHandler::finishTcPrep(size_t packetLen) {
@ -566,11 +566,11 @@ ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundL
if (CRC::crc16ccitt(start, foundLen) != 0) {
return MPSoCReturnValuesIF::CRC_FAILURE;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
@ -606,7 +606,7 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
}
default: {
sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
result = RETURN_FAILED;
result = returnvalue::FAILED;
break;
}
}
@ -615,7 +615,7 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
}
ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
@ -649,7 +649,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
}
default: {
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl;
result = RETURN_FAILED;
result = returnvalue::FAILED;
break;
}
}
@ -658,7 +658,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
}
ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
@ -674,7 +674,7 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
}
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
@ -698,7 +698,7 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies, bool useAlternateId,
DeviceCommandId_t alternateReplyID) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint8_t enabledReplies = 0;
@ -718,7 +718,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
mpsoc::TM_MEMORY_READ_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
return result;
@ -729,7 +729,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
mpsoc::TM_CAM_CMD_RPT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
return result;
@ -749,14 +749,14 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
*/
result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::ACK_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT
<< " not in replyMap" << std::endl;
}
result =
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::EXE_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT
<< " not in replyMap" << std::endl;
}
@ -779,7 +779,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
break;
}
return RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHandler::setNextReplyId() {
@ -833,9 +833,9 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
ReturnValue_t PlocMPSoCHandler::doSendReadHook() {
// Prevent DHB from polling UART during commands executed by the mpsoc helper task
if (plocMPSoCHelperExecuting) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
@ -896,7 +896,7 @@ void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (wiretappingMode == RAW) {
/* Data already sent in doGetRead() */
@ -915,7 +915,7 @@ void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
}
result = actionHelper.reportData(queueId, replyId, data, dataSize);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl;
}
}

View File

@ -180,7 +180,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
* @param start Pointer to the first byte of the reply.
* @param foundLen Pointer to the length of the whole packet.
*
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
* @return returnvalue::OK if CRC is ok, otherwise CRC_FAILURE.
*/
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
@ -189,7 +189,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*
* @param data Pointer to the data holding the acknowledgment report.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleAckReport(const uint8_t* data);
@ -198,7 +198,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*
* @param data Pointer to the received data packet.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleExecutionReport(const uint8_t* data);
@ -207,7 +207,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*
* @param data Pointer to the data buffer holding the memory read report.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleMemoryReadReport(const uint8_t* data);

View File

@ -24,14 +24,14 @@ ReturnValue_t PlocMPSoCHelper::initialize() {
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#endif
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
switch (internalState) {
@ -41,7 +41,7 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
}
case InternalState::FLASH_WRITE: {
result = performFlashWrite();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL);
} else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED);
@ -60,9 +60,9 @@ ReturnValue_t PlocMPSoCHelper::setComIF(DeviceCommunicationIF* communicationInte
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
@ -72,14 +72,14 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
}
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
#ifdef XIPHOS_Q7S
result = FilesystemHelper::checkPath(obcFile);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = FilesystemHelper::fileExists(mpsocFile);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -87,7 +87,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#endif
@ -95,14 +95,14 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
flashWrite.mpsocFile = mpsocFile;
internalState = InternalState::FLASH_WRITE;
result = resetHelper();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMPSoCHelper::resetHelper() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
semaphore.release();
spParams.buf = commandBuffer;
terminate = false;
@ -113,9 +113,9 @@ ReturnValue_t PlocMPSoCHelper::resetHelper() {
void PlocMPSoCHelper::stopProcess() { terminate = true; }
ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = flashfopen();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
@ -128,7 +128,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
size_t bytesRead = 0;
while (remainingSize > 0) {
if (terminate) {
return RETURN_OK;
return returnvalue::OK;
}
if (remainingSize > mpsoc::MAX_DATA_SIZE) {
dataLength = mpsoc::MAX_DATA_SIZE;
@ -146,74 +146,74 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
(*sequenceCount)++;
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
result = tc.buildPacket(tempData, dataLength);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(tc);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
result = flashfclose();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMPSoCHelper::flashfopen() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
spParams.buf = commandBuffer;
(*sequenceCount)++;
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(flashFopen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::flashfclose() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
spParams.buf = commandBuffer;
(*sequenceCount)++;
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
result = flashFclose.createPacket(flashWrite.mpsocFile);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(flashFclose);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = sendCommand(tc);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleExe();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
return result;
@ -222,22 +222,22 @@ ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
}
ReturnValue_t PlocMPSoCHelper::handleAck() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = handleTmReception(mpsoc::SIZE_ACK_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
result = checkReceivedTm(tmPacket);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = tmPacket.getApid();
if (apid != mpsoc::apid::ACK_SUCCESS) {
handleAckApidFailure(apid);
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
@ -253,23 +253,23 @@ void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
}
ReturnValue_t PlocMPSoCHelper::handleExe() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = handleTmReception(mpsoc::SIZE_EXE_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
ploc::SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
result = checkReceivedTm(tmPacket);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = tmPacket.getApid();
if (apid != mpsoc::apid::EXE_SUCCESS) {
handleExeApidFailure(apid);
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
@ -285,12 +285,12 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
}
ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
size_t readBytes = 0;
size_t currentBytes = 0;
for (int retries = 0; retries < RETRIES; retries++) {
result = receive(tmBuf.data() + readBytes, &currentBytes, remainingBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
readBytes += currentBytes;
@ -302,21 +302,21 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
if (remainingBytes != 0) {
sif::warning << "PlocMPSoCHelper::handleTmReception: Failed to receive reply" << std::endl;
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
return RETURN_FAILED;
return returnvalue::FAILED;
}
return result;
}
ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
ReturnValue_t result = reader.checkSize();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "PlocMPSoCHelper::handleTmReception: Size check on received TM failed"
<< std::endl;
triggerEvent(MPSOC_TM_SIZE_ERROR);
return result;
}
reader.checkCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
return result;
@ -327,24 +327,24 @@ ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return RETURN_FAILED;
return returnvalue::FAILED;
}
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);

View File

@ -6,7 +6,7 @@
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
@ -20,7 +20,7 @@
* MPSoC and OBC.
* @author J. Meier
*/
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
@ -85,7 +85,7 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public H
* @param obcFile File where to read from the data
* @param mpsocFile The file of the MPSoC where should be written to
*
* @return RETURN_OK if successful, otherwise error return value
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);

View File

@ -19,25 +19,25 @@ PlocMemoryDumper::~PlocMemoryDumper() {}
ReturnValue_t PlocMemoryDumper::initialize() {
ReturnValue_t result = SystemObject::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = commandActionHelper.initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = actionHelper.initialize(commandQueue);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
readCommandQueue();
doStateMachine();
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -78,20 +78,20 @@ MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() { return commandQueue; }
void PlocMemoryDumper::readCommandQueue() {
CommandMessage message;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
for (result = commandQueue->receiveMessage(&message); result == returnvalue::OK;
result = commandQueue->receiveMessage(&message)) {
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
continue;
}
result = actionHelper.handleActionMessage(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
continue;
}
result = commandActionHelper.handleReply(&message);
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
continue;
}
@ -161,7 +161,7 @@ void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue
}
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint32_t tempStartAddress = 0;
uint32_t tempEndAddress = 0;
@ -181,7 +181,7 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
result =
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, &params);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
<< "with start address " << tempStartAddress << " and end address "
<< tempEndAddress << std::endl;

View File

@ -11,7 +11,7 @@
#include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/action/HasActionsIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "linux/fsfwconfig/objects/systemObjectList.h"
@ -26,7 +26,6 @@
class PlocMemoryDumper : public SystemObject,
public HasActionsIF,
public ExecutableObjectIF,
public HasReturnvaluesIF,
public CommandsActionsIF {
public:
static const ActionId_t NONE = 0;

File diff suppressed because it is too large Load Diff

View File

@ -171,7 +171,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
* @param start Pointer to the first byte of the reply.
* @param foundLen Pointer to the length of the whole packet.
*
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
* @return returnvalue::OK if CRC is ok, otherwise CRC_FAILURE.
*/
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
@ -180,7 +180,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*
* @param data Pointer to the data holding the acknowledgment report.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleAckReport(const uint8_t* data);
@ -189,7 +189,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*
* @param data Pointer to the received data packet.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleExecutionReport(const uint8_t* data);
@ -199,7 +199,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*
* @param data Pointer to the data buffer holding the housekeeping read report.
*
* @return RETURN_OK if successful, otherwise an error code.
* @return returnvalue::OK if successful, otherwise an error code.
*/
ReturnValue_t handleHkReport(const uint8_t* data);

View File

@ -30,14 +30,14 @@ ReturnValue_t PlocSupvHelper::initialize() {
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "PlocSupvHelper::initialize: Invalid SD Card Manager" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#endif
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
switch (internalState) {
@ -47,7 +47,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
}
case InternalState::UPDATE: {
result = executeUpdate();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(SUPV_UPDATE_SUCCESSFUL, result);
} else if (result == PROCESS_TERMINATED) {
// Event already triggered
@ -64,7 +64,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
}
case InternalState::CONTINUE_UPDATE: {
result = continueUpdate();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(SUPV_CONTINUE_UPDATE_SUCCESSFUL, result);
} else if (result == PROCESS_TERMINATED) {
// Event already triggered
@ -76,7 +76,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
}
case InternalState::REQUEST_EVENT_BUFFER: {
result = performEventBufferRequest();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL, result);
} else if (result == PROCESS_TERMINATED) {
// Event already triggered
@ -97,10 +97,10 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
ReturnValue_t PlocSupvHelper::setComIF(UartComIF* uartComIF_) {
if (uartComIF_ == nullptr) {
sif::warning << "PlocSupvHelper::initialize: Provided invalid uart com if" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
uartComIF = uartComIF_;
return RETURN_OK;
return returnvalue::OK;
}
void PlocSupvHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
@ -118,16 +118,16 @@ ReturnValue_t PlocSupvHelper::startUpdate(std::string file, uint8_t memoryId,
}
ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
#ifdef XIPHOS_Q7S
result = FilesystemHelper::checkPath(params.file);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::startUpdate: File " << params.file << " does not exist"
<< std::endl;
return result;
}
result = FilesystemHelper::fileExists(params.file);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::startUpdate: The file " << params.file << " does not exist"
<< std::endl;
return result;
@ -137,7 +137,7 @@ ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
if (not std::filesystem::exists(file)) {
sif::warning << "PlocSupvHelper::startUpdate: The file " << file << " does not exist"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#endif
update.file = params.file;
@ -145,7 +145,7 @@ ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
if (params.bytesWritten > update.fullFileSize) {
sif::warning << "Invalid start bytes counter " << params.bytesWritten
<< ", smaller than full file length" << update.fullFileSize << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
update.length = update.fullFileSize - params.bytesWritten;
update.memoryId = params.memId;
@ -178,7 +178,7 @@ ReturnValue_t PlocSupvHelper::performMemCheck(uint8_t memoryId, uint32_t startAd
internalState = InternalState::CHECK_MEMORY;
uartComIF->flushUartTxAndRxBuf(comCookie);
semaphore.release();
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
void PlocSupvHelper::initiateUpdateContinuation() {
@ -189,7 +189,7 @@ void PlocSupvHelper::initiateUpdateContinuation() {
ReturnValue_t PlocSupvHelper::startEventbBufferRequest(std::string path) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = FilesystemHelper::checkPath(path);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -200,7 +200,7 @@ ReturnValue_t PlocSupvHelper::startEventbBufferRequest(std::string path) {
internalState = InternalState::REQUEST_EVENT_BUFFER;
uartComIF->flushUartTxAndRxBuf(comCookie);
semaphore.release();
return RETURN_OK;
return returnvalue::OK;
}
void PlocSupvHelper::stopProcess() { terminate = true; }
@ -210,26 +210,26 @@ void PlocSupvHelper::executeFullCheckMemoryCommand() {
if (update.crcShouldBeChecked) {
sif::info << "PLOC SUPV Mem Check: Calculating Image CRC" << std::endl;
result = calcImageCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
return;
}
}
sif::info << "PLOC SUPV Mem Check: Selecting Memory" << std::endl;
result = selectMemory();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
return;
}
sif::info << "PLOC SUPV Mem Check: Preparing Update" << std::endl;
result = prepareUpdate();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
return;
}
sif::info << "PLOC SUPV Mem Check: Memory Check" << std::endl;
result = handleCheckMemoryCommand();
if (result == HasReturnvaluesIF::RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(SUPV_MEM_CHECK_OK, result);
} else {
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
@ -237,26 +237,26 @@ void PlocSupvHelper::executeFullCheckMemoryCommand() {
}
ReturnValue_t PlocSupvHelper::executeUpdate() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
sif::info << "PLOC SUPV Update MPSoC: Calculating Image CRC" << std::endl;
result = calcImageCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
sif::info << "PLOC SUPV Update MPSoC: Selecting Memory" << std::endl;
result = selectMemory();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
sif::info << "PLOC SUPV Update MPSoC: Preparing Update" << std::endl;
result = prepareUpdate();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (update.deleteMemory) {
sif::info << "PLOC SUPV Update MPSoC: Erasing Memory" << std::endl;
result = eraseMemory();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -265,7 +265,7 @@ ReturnValue_t PlocSupvHelper::executeUpdate() {
ReturnValue_t PlocSupvHelper::continueUpdate() {
ReturnValue_t result = prepareUpdate();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return updateOperation();
@ -274,7 +274,7 @@ ReturnValue_t PlocSupvHelper::continueUpdate() {
ReturnValue_t PlocSupvHelper::updateOperation() {
sif::info << "PlocSupvHelper::performUpdate: Writing Update Packets" << std::endl;
auto result = writeUpdatePackets();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
sif::info << "PlocSupvHelper::performUpdate: Memory Check" << std::endl;
@ -282,7 +282,7 @@ ReturnValue_t PlocSupvHelper::updateOperation() {
}
ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
ProgressPrinter progressPrinter("Supervisor update", update.fullFileSize,
ProgressPrinter::HALF_PERCENT);
@ -338,13 +338,13 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
supv::WriteMemory packet(spParams);
result = packet.buildPacket(seqFlags, update.sequenceCount, update.memoryId,
update.startAddress + update.bytesWritten, dataLength, tempData);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
update.bytesWritten);
return result;
}
result = handlePacketTransmission(packet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
update.bytesWritten);
return result;
@ -366,24 +366,24 @@ uint32_t PlocSupvHelper::buildProgParams1(uint8_t percent, uint16_t seqCount) {
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
using namespace supv;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
resetSpParams();
RequestLoggingData packet(spParams);
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = sendCommand(packet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result =
handleTmReception(ccsds::HEADER_LEN, tmBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
ploc::SpTmReader spReader(tmBuf.data(), tmBuf.size());
@ -397,7 +397,7 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
if (not exeAlreadyReceived) {
result = handleExe();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -407,85 +407,85 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
ReturnValue_t PlocSupvHelper::handleRemainingExeReport(ploc::SpTmReader& reader) {
size_t remBytes = reader.getPacketDataLen() + 1;
ReturnValue_t result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Reading exe failure report failed" << std::endl;
}
result = exeReportHandling();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "Handling exe report failed" << std::endl;
}
return result;
}
ReturnValue_t PlocSupvHelper::selectMemory() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
resetSpParams();
supv::MPSoCBootSelect packet(spParams);
result = packet.buildPacket(update.memoryId);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(packet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::prepareUpdate() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
resetSpParams();
supv::ApidOnlyPacket packet(spParams, supv::APID_PREPARE_UPDATE);
result = packet.buildPacket();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::eraseMemory() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
resetSpParams();
supv::EraseMemory eraseMemory(spParams);
result = eraseMemory.buildPacket(update.memoryId, update.startAddress + update.bytesWritten,
update.length);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::handlePacketTransmission(ploc::SpTcBase& packet,
uint32_t timeoutExecutionReport) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = sendCommand(packet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleExe(timeoutExecutionReport);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
rememberApid = packet.getApid();
result = uartComIF->sendMessage(comCookie, packet.getFullPacket(), packet.getFullPacketLen());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::sendCommand: Failed to send command" << std::endl;
triggerEvent(SUPV_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
return result;
@ -494,10 +494,10 @@ ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
}
ReturnValue_t PlocSupvHelper::handleAck() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = handleTmReception(supv::SIZE_ACK_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
<< std::endl;
@ -505,11 +505,11 @@ ReturnValue_t PlocSupvHelper::handleAck() {
}
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
result = checkReceivedTm(ackReport);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = ackReport.checkApid();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
} else if (result == SupvReturnValuesIF::INVALID_APID) {
@ -517,14 +517,14 @@ ReturnValue_t PlocSupvHelper::handleAck() {
}
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = handleTmReception(supv::SIZE_EXE_REPORT, tmBuf.data(), timeout);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
<< std::endl;
@ -538,11 +538,11 @@ ReturnValue_t PlocSupvHelper::exeReportHandling() {
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
ReturnValue_t result = checkReceivedTm(exeReport);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = exeReport.checkApid();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
} else if (result == SupvReturnValuesIF::INVALID_APID) {
@ -555,7 +555,7 @@ ReturnValue_t PlocSupvHelper::exeReportHandling() {
ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t* readBuf,
uint32_t timeout) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
size_t readBytes = 0;
size_t currentBytes = 0;
Countdown countdown(timeout);
@ -564,7 +564,7 @@ ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t*
}
while (!countdown.hasTimedOut()) {
result = receive(readBuf + readBytes, &currentBytes, remainingBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
readBytes += currentBytes;
@ -576,19 +576,19 @@ ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t*
if (remainingBytes != 0) {
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << std::dec
<< remainingBytes << " remaining bytes" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return result;
}
ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
ReturnValue_t result = reader.checkSize();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
return result;
}
result = reader.checkCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
return result;
}
@ -596,20 +596,20 @@ ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
}
ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::receive: Failed to request reply" << std::endl;
triggerEvent(SUPV_HELPER_REQUESTING_REPLY_FAILED, result,
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return RETURN_FAILED;
return returnvalue::FAILED;
}
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::receive: Failed to read received message" << std::endl;
triggerEvent(SUPV_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
@ -620,13 +620,13 @@ ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t r
}
ReturnValue_t PlocSupvHelper::calcImageCrc() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (update.fullFileSize == 0) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
#ifdef XIPHOS_Q7S
result = FilesystemHelper::checkPath(update.file);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::calcImageCrc: File " << update.file << " does not exist"
<< std::endl;
return result;
@ -666,7 +666,7 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
}
ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
resetSpParams();
// Will hold status report for later processing
std::array<uint8_t, 32> statusReportBuf{};
@ -674,15 +674,15 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
// Verification of update write procedure
supv::CheckMemory packet(spParams);
result = packet.buildPacket(update.memoryId, update.startAddress, update.fullFileSize);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = sendCommand(packet);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
@ -697,14 +697,14 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
size_t remBytes = spReader.getPacketDataLen() + 1;
result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN,
supv::recv_timeout::UPDATE_STATUS_REPORT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
<< std::endl;
return result;
}
result = updateStatusReport.checkCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC check failed" << std::endl;
return result;
}
@ -714,7 +714,7 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
if (not exeAlreadyHandled) {
result = handleExe(CRC_EXECUTION_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
}
@ -722,12 +722,12 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
// Now process the status report
updateStatusReport.setData(statusReportBuf.data(), statusReportBuf.size());
result = updateStatusReport.parseDataField();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (update.crcShouldBeChecked) {
result = updateStatusReport.verifycrc(update.crc);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC failure. Expected CRC 0x"
<< std::setfill('0') << std::hex << std::setw(4)
<< static_cast<uint16_t>(update.crc) << " but received CRC 0x" << std::setw(4)
@ -747,7 +747,7 @@ uint32_t PlocSupvHelper::getFileSize(std::string filename) {
}
ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reader) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
std::string filename = Filenaming::generateAbsoluteFilename(
eventBufferReq.path, eventBufferReq.filename, timestamping);
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
@ -770,14 +770,14 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reade
requestLen -= 6;
}
result = handleTmReception(requestLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
<< " " << packetsRead + 1 << std::endl;
file.close();
return result;
}
ReturnValue_t result = reader.checkCrc();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
return result;
}

View File

@ -7,7 +7,7 @@
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
@ -21,7 +21,7 @@
* the supervisor and the OBC.
* @author J. Meier
*/
class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
class PlocSupvHelper : public SystemObject, public ExecutableObjectIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPV_HELPER;
@ -114,7 +114,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
* @param memoryId ID of the memory where to write to
* @param startAddress Address where to write data
*
* @return RETURN_OK if successful, otherwise error return value
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t performUpdate(const supv::UpdateParams& params);
ReturnValue_t startUpdate(std::string file, uint8_t memoryId, uint32_t startAddress);

View File

@ -34,15 +34,15 @@ ReturnValue_t ArcsecDatalinkLayer::decodeFrame(const uint8_t* rawData, size_t ra
case ARC_DEC_SYNC: {
// Reset length of SLIP struct for next frame
slipInfo.length = 0;
return RETURN_OK;
return returnvalue::OK;
}
default:
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
break;
return RETURN_FAILED;
return returnvalue::FAILED;
}
}
return RETURN_FAILED;
return returnvalue::FAILED;
}
uint8_t ArcsecDatalinkLayer::getReplyFrameType() { return decodedFrame[0]; }

View File

@ -1,7 +1,7 @@
#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
extern "C" {
@ -11,7 +11,7 @@ extern "C" {
/**
* @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
*/
class ArcsecDatalinkLayer : public HasReturnvaluesIF {
class ArcsecDatalinkLayer {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;

View File

@ -5,15 +5,15 @@
ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
ReturnValue_t ArcsecJsonParamBase::create(std::string fullname, uint8_t* buffer) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = init(fullname);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "ArcsecJsonParamBase::create: Failed to init parameter command for set "
<< setName << std::endl;
return result;
}
result = createCommand(buffer);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "ArcsecJsonParamBase::create: Failed to create parameter command for set "
<< setName << std::endl;
}
@ -25,7 +25,7 @@ ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string&
if ((*it)[arcseckeys::NAME] == name) {
value = (*it)[arcseckeys::VALUE];
convertEmpty(value);
return RETURN_OK;
return returnvalue::OK;
}
}
return PARAM_NOT_EXISTS;
@ -68,7 +68,7 @@ void ArcsecJsonParamBase::addSetParamHeader(uint8_t* buffer, uint8_t setId) {
}
ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (not std::filesystem::exists(filename)) {
sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
<< std::endl;
@ -76,10 +76,10 @@ ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
}
createJsonObject(filename);
result = initSet();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
@ -94,7 +94,7 @@ ReturnValue_t ArcsecJsonParamBase::initSet() {
for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
if ((*it)["name"] == setName) {
set = (*it)["fields"];
return RETURN_OK;
return returnvalue::OK;
}
}
sif::warning << "ArcsecJsonParamBase::initSet: Set " << setName << "not present in json file"

View File

@ -5,7 +5,7 @@
#include <fstream>
#include <nlohmann/json.hpp>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
extern "C" {
@ -22,7 +22,7 @@ using json = nlohmann::json;
*
* @author J. Meier
*/
class ArcsecJsonParamBase : public HasReturnvaluesIF {
class ArcsecJsonParamBase {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
//! [EXPORT] : [COMMENT] Specified json file does not exist
@ -32,6 +32,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
//! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
virtual ~ArcsecJsonParamBase() = default;
/**
* @brief Constructor
*
@ -60,7 +61,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
* @param name The name of the parameter
* @param value The string representation of the read value
*
* @return RETURN_OK if successful, otherwise PARAM_NOT_EXISTS
* @return returnvalue::OK if successful, otherwise PARAM_NOT_EXISTS
*/
ReturnValue_t getParam(const std::string name, std::string& value);
@ -129,7 +130,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
* @param setName The name of the set to work on
*
* @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
* RETURN_OK
* returnvalue::OK
*/
ReturnValue_t init(const std::string filename);

View File

@ -53,9 +53,9 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
StarTrackerHandler::~StarTrackerHandler() {}
ReturnValue_t StarTrackerHandler::initialize() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = DeviceHandlerBase::initialize();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
@ -68,13 +68,13 @@ ReturnValue_t StarTrackerHandler::initialize() {
;
}
result = manager->registerListener(eventQueue->getId());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = manager->subscribeToEventRange(eventQueue->getId(),
event::getEventId(StrHelper::IMAGE_UPLOAD_FAILED),
event::getEventId(StrHelper::FIRMWARE_UPDATE_FAILED));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "StarTrackerHandler::initialize: Failed to subscribe to events from "
" str helper"
@ -84,16 +84,16 @@ ReturnValue_t StarTrackerHandler::initialize() {
}
result = strHelper->setComIF(communicationInterface);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
strHelper->setComCookie(comCookie);
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (actionId) {
case (startracker::STOP_IMAGE_LOADER): {
@ -122,12 +122,12 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
result = checkMode(actionId);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = checkCommand(actionId);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
@ -135,14 +135,14 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
switch (actionId) {
case (startracker::UPLOAD_IMAGE): {
result = DeviceHandlerBase::acceptExternalDeviceCommands();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
return FILE_PATH_TOO_LONG;
}
result = strHelper->startImageUpload(std::string(reinterpret_cast<const char*>(data), size));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
@ -150,7 +150,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
case (startracker::DOWNLOAD_IMAGE): {
result = DeviceHandlerBase::acceptExternalDeviceCommands();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (size > MAX_PATH_SIZE) {
@ -158,7 +158,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
result =
strHelper->startImageDownload(std::string(reinterpret_cast<const char*>(data), size));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
@ -166,11 +166,11 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
case (startracker::FLASH_READ): {
result = DeviceHandlerBase::acceptExternalDeviceCommands();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = executeFlashReadCommand(data, size);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
@ -192,7 +192,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
case (startracker::FIRMWARE_UPDATE): {
result = DeviceHandlerBase::acceptExternalDeviceCommands();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
@ -200,7 +200,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
}
result =
strHelper->startFirmwareUpdate(std::string(reinterpret_cast<const char*>(data), size));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
strHelperExecuting = true;
@ -214,7 +214,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
void StarTrackerHandler::performOperationHook() {
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {
switch (event.getMessageId()) {
case EventMessage::EVENT_MESSAGE:
@ -385,56 +385,56 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t
ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (deviceCommand) {
case (startracker::PING_REQUEST): {
preparePingRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_TIME): {
prepareTimeRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::BOOT): {
prepareBootCommand();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_VERSION): {
prepareVersionRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_INTERFACE): {
prepareInterfaceRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_POWER): {
preparePowerRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::SWITCH_TO_BOOTLOADER_PROGRAM): {
prepareSwitchToBootloaderCmd();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::TAKE_IMAGE): {
prepareTakeImageCommand(commandData);
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::SUBSCRIPTION): {
Subscription subscription;
result = prepareParamCommand(commandData, commandDataLen, subscription);
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_SOLUTION): {
prepareSolutionRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_TEMPERATURE): {
prepareTemperatureRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::REQ_HISTOGRAM): {
prepareHistogramRequest();
return RETURN_OK;
return returnvalue::OK;
}
case (startracker::LIMITS): {
Limits limits;
@ -564,7 +564,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
void StarTrackerHandler::fillCommandAndReplyMap() {
@ -662,13 +662,13 @@ ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t
case MODE_NORMAL:
case MODE_RAW:
if (submode == SUBMODE_NONE) {
return RETURN_OK;
return returnvalue::OK;
} else {
return INVALID_SUBMODE;
}
case MODE_ON:
if (submode == SUBMODE_BOOTLOADER || submode == SUBMODE_FIRMWARE) {
return RETURN_OK;
return returnvalue::OK;
} else {
return INVALID_SUBMODE;
}
@ -759,7 +759,7 @@ void StarTrackerHandler::bootBootloader() {
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
size_t bytesLeft = 0;
result = dataLinkLayer.decodeFrame(start, remainingSize, &bytesLeft);
@ -769,7 +769,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
// Need a second doSendRead pass to reaa in whole packet
return IGNORE_REPLY_DATA;
}
case RETURN_OK: {
case returnvalue::OK: {
break;
}
default:
@ -801,7 +801,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
}
default: {
sif::debug << "StarTrackerHandler::scanForReply: Reply has invalid type id" << std::endl;
result = RETURN_FAILED;
result = returnvalue::FAILED;
}
}
@ -812,7 +812,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t* packet) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
switch (id) {
case (startracker::REQ_TIME): {
@ -832,11 +832,11 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
}
case (startracker::REQ_VERSION): {
result = handleTm(versionSet, startracker::VersionSet::SIZE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = checkProgram();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
break;
@ -1209,7 +1209,7 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
localDataPoolMap.emplace(startracker::DEBUG_CAMERA_TEST, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry<uint32_t>({0}));
return RETURN_OK;
return returnvalue::OK;
}
size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
@ -1219,9 +1219,9 @@ size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
ReturnValue_t StarTrackerHandler::doSendReadHook() {
// Prevent DHB from polling UART during commands executed by the image loader task
if (strHelperExecuting) {
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
@ -1230,7 +1230,7 @@ ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t*
}
*numberOfSwitches = 1;
*switches = &powerSwitch;
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
@ -1244,7 +1244,7 @@ ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
break;
}
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId) {
@ -1273,9 +1273,9 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId)
default:
sif::warning << "StarTrackerHandler::scanForActionReply: Unknown parameter reply id"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* foundId) {
@ -1340,9 +1340,9 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo
default:
sif::debug << "StarTrackerHandler::scanForParameterReply: Unknown parameter reply id"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* foundId) {
@ -1406,11 +1406,11 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* fo
}
default: {
sif::warning << "tarTrackerHandler::scanForGetParameterReply: UnkNown ID" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
break;
}
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
@ -1447,11 +1447,11 @@ ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
default: {
sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id: "
<< static_cast<unsigned int>(*reply) << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
break;
}
}
return RETURN_OK;
return returnvalue::OK;
}
void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
@ -1471,7 +1471,7 @@ void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (commandDataLen < FlashReadCmd::MIN_LENGTH) {
sif::warning << "StarTrackerHandler::executeFlashReadCommand: Command too short" << std::endl;
return COMMAND_TOO_SHORT;
@ -1481,7 +1481,7 @@ ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* command
size_t size = sizeof(length);
const uint8_t* lengthPtr = commandData + sizeof(startRegion);
result = SerializeAdapter::deSerialize(&length, lengthPtr, &size, SerializeIF::Endianness::BIG);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "StarTrackerHandler::executeFlashReadCommand: Deserialization of length failed"
<< std::endl;
return result;
@ -1495,7 +1495,7 @@ ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* command
std::string fullname = std::string(reinterpret_cast<const char*>(filePtr),
commandDataLen - sizeof(startRegion) - sizeof(length));
result = strHelper->startFlashRead(fullname, startRegion, length);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return result;
@ -1513,7 +1513,7 @@ void StarTrackerHandler::prepareBootCommand() {
ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandData,
size_t commandDataLen) {
struct ChecksumActionRequest req;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (commandDataLen != ChecksumCmd::LENGTH) {
sif::warning << "StarTrackerHandler::prepareChecksumCommand: Invalid length" << std::endl;
return INVALID_LENGTH;
@ -1523,7 +1523,7 @@ ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandD
const uint8_t* addressPtr = commandData + ChecksumCmd::ADDRESS_OFFSET;
result =
SerializeAdapter::deSerialize(&req.address, addressPtr, &size, SerializeIF::Endianness::BIG);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of address "
<< "failed" << std::endl;
return result;
@ -1532,7 +1532,7 @@ ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandD
const uint8_t* lengthPtr = commandData + ChecksumCmd::LENGTH_OFFSET;
result =
SerializeAdapter::deSerialize(&req.length, lengthPtr, &size, SerializeIF::Endianness::BIG);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of length failed"
<< std::endl;
return result;
@ -1635,20 +1635,20 @@ void StarTrackerHandler::prepareHistogramRequest() {
ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData,
size_t commandDataLen,
ArcsecJsonParamBase& paramSet) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (commandDataLen > MAX_PATH_SIZE) {
return FILE_PATH_TOO_LONG;
}
std::string fullName(reinterpret_cast<const char*>(commandData), commandDataLen);
result = paramSet.create(fullName, commandBuffer);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
dataLinkLayer.encodeFrame(commandBuffer, paramSet.getSize());
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
@ -1657,7 +1657,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
@ -1666,7 +1666,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
@ -1675,7 +1675,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
@ -1684,7 +1684,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
@ -1693,7 +1693,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
@ -1702,7 +1702,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
@ -1711,7 +1711,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
@ -1720,7 +1720,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
@ -1729,7 +1729,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
@ -1738,7 +1738,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
@ -1747,7 +1747,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
@ -1756,7 +1756,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
@ -1765,7 +1765,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
@ -1774,7 +1774,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
@ -1792,7 +1792,7 @@ ReturnValue_t StarTrackerHandler::handleSetParamReply() {
if (internalState != InternalState::IDLE) {
handleStartup(reply + PARAMETER_ID_OFFSET);
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::handleActionReply() {
@ -1805,13 +1805,13 @@ ReturnValue_t StarTrackerHandler::handleActionReply() {
<< static_cast<unsigned int>(status) << std::endl;
return ACTION_FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::handleChecksumReply() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = handleActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
const uint8_t* replyData = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
@ -1834,25 +1834,25 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() {
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
checksumReply.printChecksum();
#endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& dataset, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
const uint8_t* reply = dataLinkLayer.getReply() + PARAMS_OFFSET;
dataset.setValidityBufferGeneration(false);
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StarTrackerHandler::handleParamRequest Deserialization failed" << std::endl;
}
dataset.setValidityBufferGeneration(true);
dataset.setValidity(true, true);
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
@ -1862,7 +1862,7 @@ ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& datas
}
ReturnValue_t StarTrackerHandler::handlePingReply() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint32_t pingId = 0;
const uint8_t* reply = dataLinkLayer.getReply();
uint8_t status = dataLinkLayer.getStatusField();
@ -1916,11 +1916,11 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
<< std::endl;
return INVALID_PROGRAM;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
if (status != startracker::STATUS_OK) {
sif::warning << "StarTrackerHandler::handleTm: Reply error: "
@ -1928,19 +1928,19 @@ ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t
return REPLY_ERROR;
}
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
const uint8_t* reply = dataLinkLayer.getReply() + TICKS_OFFSET;
dataset.setValidityBufferGeneration(false);
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed" << std::endl;
}
dataset.setValidityBufferGeneration(true);
dataset.setValidity(true, true);
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
@ -1950,7 +1950,7 @@ ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t
}
ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
if (status != startracker::STATUS_OK) {
sif::warning << "StarTrackerHandler::handleActionReplySet: Reply error: "
@ -1958,19 +1958,19 @@ ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dat
return REPLY_ERROR;
}
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
const uint8_t* reply = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
dataset.setValidityBufferGeneration(false);
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StarTrackerHandler::handleActionReplySet Deserialization failed" << std::endl;
}
dataset.setValidityBufferGeneration(true);
dataset.setValidity(true, true);
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
@ -2080,5 +2080,5 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
default:
break;
}
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -314,7 +314,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
* @param commandData Pointer to received command data
* @param commandDataLen Size of received command data
*
* @return RETURN_OK if start of execution was successful, otherwise error return value
* @return returnvalue::OK if start of execution was successful, otherwise error return value
*/
ReturnValue_t executeFlashReadCommand(const uint8_t* commandData, size_t commandDataLen);
@ -385,7 +385,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
* @param commandDataLen Length of command
* @param paramSet The object defining the command generation
*
* @return RETURN_OK if successful, otherwise error return Value
* @return returnvalue::OK if successful, otherwise error return Value
*/
ReturnValue_t prepareParamCommand(const uint8_t* commandData, size_t commandDataLen,
ArcsecJsonParamBase& paramSet);
@ -454,7 +454,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
* @param dataset Dataset where reply data will be written to
* @param size Size of the dataset
*
* @return RETURN_OK if successful, otherwise error return value
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t handleTm(LocalPoolDataSetBase& dataset, size_t size);
@ -463,7 +463,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
*
* @param actioId Id of received command
*
* @return RETURN_OK if star tracker is in valid mode, otherwise error return value
* @return returnvalue::OK if star tracker is in valid mode, otherwise error return value
*/
ReturnValue_t checkCommand(ActionId_t actionId);

File diff suppressed because it is too large Load Diff

View File

@ -19,14 +19,14 @@ ReturnValue_t StrHelper::initialize() {
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "StrHelper::initialize: Invalid SD Card Manager" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#endif
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
switch (internalState) {
@ -36,7 +36,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
}
case InternalState::UPLOAD_IMAGE: {
result = performImageUpload();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
} else {
triggerEvent(IMAGE_UPLOAD_FAILED);
@ -46,7 +46,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
}
case InternalState::DOWNLOAD_IMAGE: {
result = performImageDownload();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
} else {
triggerEvent(IMAGE_DOWNLOAD_FAILED);
@ -56,7 +56,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
}
case InternalState::FLASH_READ: {
result = performFlashRead();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(FLASH_READ_SUCCESSFUL);
} else {
triggerEvent(FLASH_READ_FAILED);
@ -66,7 +66,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
}
case InternalState::FIRMWARE_UPDATE: {
result = performFirmwareUpdate();
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
triggerEvent(FIRMWARE_UPDATE_SUCCESSFUL);
} else {
triggerEvent(FIRMWARE_UPDATE_FAILED);
@ -85,9 +85,9 @@ ReturnValue_t StrHelper::setComIF(DeviceCommunicationIF* communicationInterface_
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "StrHelper::initialize: Invalid uart com if" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
@ -95,7 +95,7 @@ void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = checkPath(fullname);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -106,13 +106,13 @@ ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
internalState = InternalState::UPLOAD_IMAGE;
semaphore.release();
terminate = false;
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::startImageDownload(std::string path) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = checkPath(path);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -123,7 +123,7 @@ ReturnValue_t StrHelper::startImageDownload(std::string path) {
internalState = InternalState::DOWNLOAD_IMAGE;
terminate = false;
semaphore.release();
return RETURN_OK;
return returnvalue::OK;
}
void StrHelper::stopProcess() { terminate = true; }
@ -135,7 +135,7 @@ void StrHelper::setFlashReadFilename(std::string filename) { flashRead.filename
ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = checkPath(fullname);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -148,13 +148,13 @@ ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) {
internalState = InternalState::FIRMWARE_UPDATE;
semaphore.release();
terminate = false;
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t startRegion, uint32_t length) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = checkPath(path);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#endif
@ -167,7 +167,7 @@ ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t startRegion, u
internalState = InternalState::FLASH_READ;
semaphore.release();
terminate = false;
return RETURN_OK;
return returnvalue::OK;
}
void StrHelper::disableTimestamping() { timestamping = false; }
@ -192,11 +192,11 @@ ReturnValue_t StrHelper::performImageDownload() {
while (downloadReq.position < ImageDownload::LAST_POSITION) {
if (terminate) {
file.close();
return RETURN_OK;
return returnvalue::OK;
}
arc_pack_download_action_req(&downloadReq, commandBuffer, &size);
result = sendAndRead(size, downloadReq.position);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
uartComIF->flushUartRxBuffer(comCookie);
retries++;
@ -206,7 +206,7 @@ ReturnValue_t StrHelper::performImageDownload() {
return result;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
uartComIF->flushUartRxBuffer(comCookie);
retries++;
@ -216,7 +216,7 @@ ReturnValue_t StrHelper::performImageDownload() {
return result;
}
result = checkReplyPosition(downloadReq.position);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
uartComIF->flushUartRxBuffer(comCookie);
retries++;
@ -234,11 +234,11 @@ ReturnValue_t StrHelper::performImageDownload() {
retries = 0;
}
file.close();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::performImageUpload() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint32_t size = 0;
uint32_t imageSize = 0;
struct UploadActionRequest uploadReq;
@ -247,7 +247,7 @@ ReturnValue_t StrHelper::performImageUpload() {
if (not std::filesystem::exists(uploadImage.uploadFile)) {
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
internalState = InternalState::IDLE;
return RETURN_FAILED;
return returnvalue::FAILED;
}
std::ifstream file(uploadImage.uploadFile, std::ifstream::binary);
// Set position of next character to end of file input stream
@ -260,18 +260,18 @@ ReturnValue_t StrHelper::performImageUpload() {
while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) {
if (terminate) {
file.close();
return RETURN_OK;
return returnvalue::OK;
}
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
file.read(reinterpret_cast<char*>(uploadReq.data), SIZE_IMAGE_PART);
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
result = sendAndRead(size, uploadReq.position);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
file.close();
return RETURN_FAILED;
return returnvalue::FAILED;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
file.close();
return result;
}
@ -288,25 +288,25 @@ ReturnValue_t StrHelper::performImageUpload() {
uploadReq.position++;
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
result = sendAndRead(size, uploadReq.position);
if (result != RETURN_OK) {
return RETURN_FAILED;
if (result != returnvalue::OK) {
return returnvalue::FAILED;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#if OBSW_DEBUG_STARTRACKER == 1
progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART);
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::performFirmwareUpdate() {
using namespace startracker;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = unlockAndEraseRegions(static_cast<uint32_t>(startracker::FirmwareRegions::FIRST),
static_cast<uint32_t>(startracker::FirmwareRegions::LAST));
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = performFlashWrite();
@ -314,7 +314,7 @@ ReturnValue_t StrHelper::performFirmwareUpdate() {
}
ReturnValue_t StrHelper::performFlashWrite() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint32_t size = 0;
uint32_t bytesWritten = 0;
uint32_t fileSize = 0;
@ -322,14 +322,14 @@ ReturnValue_t StrHelper::performFlashWrite() {
if (not std::filesystem::exists(flashWrite.fullname)) {
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
internalState = InternalState::IDLE;
return RETURN_FAILED;
return returnvalue::FAILED;
}
std::ifstream file(flashWrite.fullname, std::ifstream::binary);
file.seekg(0, file.end);
fileSize = file.tellg();
if (fileSize > FLASH_REGION_SIZE * (flashWrite.lastRegion - flashWrite.firstRegion)) {
sif::warning << "StrHelper::performFlashWrite: Invalid file" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#if OBSW_DEBUG_STARTRACKER == 1
ProgressPrinter progressPrinter("Flash write", fileSize);
@ -341,7 +341,7 @@ ReturnValue_t StrHelper::performFlashWrite() {
for (uint32_t idx = 0; idx < fileChunks; idx++) {
if (terminate) {
file.close();
return RETURN_OK;
return returnvalue::OK;
}
file.seekg(idx * CHUNK_SIZE, file.beg);
file.read(reinterpret_cast<char*>(req.data), CHUNK_SIZE);
@ -352,12 +352,12 @@ ReturnValue_t StrHelper::performFlashWrite() {
req.address = bytesWritten;
arc_pack_write_action_req(&req, commandBuffer, &size);
result = sendAndRead(size, req.address);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
file.close();
return result;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
file.close();
return result;
}
@ -379,17 +379,17 @@ ReturnValue_t StrHelper::performFlashWrite() {
bytesWritten += remainingBytes;
arc_pack_write_action_req(&req, commandBuffer, &size);
result = sendAndRead(size, req.address);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
#if OBSW_DEBUG_STARTRACKER == 1
progressPrinter.print(fileSize);
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::performFlashRead() {
@ -412,7 +412,7 @@ ReturnValue_t StrHelper::performFlashRead() {
req.address = 0;
while (bytesRead < flashRead.size) {
if (terminate) {
return RETURN_OK;
return returnvalue::OK;
}
if ((flashRead.size - bytesRead) < CHUNK_SIZE) {
req.length = flashRead.size - bytesRead;
@ -421,7 +421,7 @@ ReturnValue_t StrHelper::performFlashRead() {
}
arc_pack_read_action_req(&req, commandBuffer, &size);
result = sendAndRead(size, req.address);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
uartComIF->flushUartRxBuffer(comCookie);
retries++;
@ -431,7 +431,7 @@ ReturnValue_t StrHelper::performFlashRead() {
return result;
}
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
uartComIF->flushUartRxBuffer(comCookie);
retries++;
@ -454,12 +454,12 @@ ReturnValue_t StrHelper::performFlashRead() {
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
}
file.close();
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t decResult = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
ReturnValue_t decResult = returnvalue::OK;
size_t receivedDataLen = 0;
uint8_t* receivedData = nullptr;
size_t bytesLeft = 0;
@ -467,10 +467,10 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
datalinkLayer.encodeFrame(commandBuffer, size);
result = uartComIF->sendMessage(comCookie, datalinkLayer.getEncodedFrame(),
datalinkLayer.getEncodedLength());
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StrHelper::sendAndRead: Failed to send packet" << std::endl;
triggerEvent(STR_HELPER_SENDING_PACKET_FAILED, result, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
}
decResult = ArcsecDatalinkLayer::DEC_IN_PROGRESS;
while (decResult == ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
@ -479,23 +479,23 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
while (delay.isBusy()) {
}
result = uartComIF->requestReceiveMessage(comCookie, startracker::MAX_FRAME_SIZE * 2 + 2);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StrHelper::sendAndRead: Failed to request reply" << std::endl;
triggerEvent(STR_HELPER_REQUESTING_MSG_FAILED, result, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
}
result = uartComIF->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StrHelper::sendAndRead: Failed to read received message" << std::endl;
triggerEvent(STR_HELPER_READING_REPLY_FAILED, result, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (receivedDataLen == 0 && missedReplies < MAX_POLLS) {
missedReplies++;
continue;
} else if ((receivedDataLen == 0) && (missedReplies >= MAX_POLLS)) {
triggerEvent(STR_HELPER_NO_REPLY, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
} else {
missedReplies = 0;
}
@ -504,14 +504,14 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
// This should never happen
sif::warning << "StrHelper::sendAndRead: Bytes left after decoding" << std::endl;
triggerEvent(STR_HELPER_COM_ERROR, result, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
}
}
if (decResult != RETURN_OK) {
if (decResult != returnvalue::OK) {
triggerEvent(STR_HELPER_DEC_ERROR, decResult, parameter);
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::checkActionReply() {
@ -526,7 +526,7 @@ ReturnValue_t StrHelper::checkActionReply() {
<< static_cast<unsigned int>(status) << std::endl;
return STATUS_ERROR;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
@ -534,9 +534,9 @@ ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
std::memcpy(&receivedPosition, datalinkLayer.getReply() + POS_OFFSET, sizeof(receivedPosition));
if (receivedPosition != expectedPosition) {
triggerEvent(POSITION_MISMATCH, receivedPosition);
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
#ifdef XIPHOS_Q7S
@ -554,12 +554,12 @@ ReturnValue_t StrHelper::checkPath(std::string name) {
return SD_NOT_MOUNTED;
}
}
return RETURN_OK;
return returnvalue::OK;
}
#endif
ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
#if OBSW_DEBUG_STARTRACKER == 1
ProgressPrinter progressPrinter("Unlock and erase", to - from);
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
@ -572,7 +572,7 @@ ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
arc_pack_unlock_action_req(&unlockReq, commandBuffer, &size);
sendAndRead(size, unlockReq.region);
result = checkActionReply();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to unlock region with id "
<< static_cast<unsigned int>(unlockReq.region) << std::endl;
return result;
@ -580,7 +580,7 @@ ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
eraseReq.region = idx;
arc_pack_erase_action_req(&eraseReq, commandBuffer, &size);
result = sendAndRead(size, eraseReq.region, FLASH_ERASE_DELAY);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to erase region with id "
<< static_cast<unsigned int>(eraseReq.region) << std::endl;
return result;

View File

@ -13,7 +13,7 @@
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
@ -27,7 +27,7 @@ extern "C" {
*
* @author J. Meier
*/
class StrHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
class StrHelper : public SystemObject, public ExecutableObjectIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HELPER;
@ -270,7 +270,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
/**
* @brief Performs firmware update
*
* @return RETURN_OK if successful, otherwise error return value
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t performFirmwareUpdate();
@ -289,7 +289,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
*
* @param ID of first region to write to
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
*/
ReturnValue_t performFlashWrite();
@ -307,14 +307,14 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
* @param parameter Parameter 2 of trigger event function
* @param delayMs Delay in milliseconds between send and receive call
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
*/
ReturnValue_t sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs = 0);
/**
* @brief Checks the header (type id and status fields) of the action reply
*
* @return RETURN_OK if reply confirms success of packet transfer, otherwise REUTRN_FAILED
* @return returnvalue::OK if reply confirms success of packet transfer, otherwise REUTRN_FAILED
*/
ReturnValue_t checkActionReply();
@ -323,7 +323,8 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
*
* @param expectedPosition Value of expected position
*
* @return RETURN_OK if received position matches expected position, otherwise RETURN_FAILED
* @return returnvalue::OK if received position matches expected position, otherwise
* returnvalue::FAILED
*/
ReturnValue_t checkReplyPosition(uint32_t expectedPosition);
@ -331,7 +332,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
/**
* @brief Checks if a path points to an sd card and whether the SD card is monuted.
*
* @return SD_NOT_MOUNTED id SD card is not mounted, otherwise RETURN_OK
* @return SD_NOT_MOUNTED id SD card is not mounted, otherwise returnvalue::OK
*/
ReturnValue_t checkPath(std::string name);
#endif

View File

@ -23,12 +23,12 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
if (thisSequence->checkSequence() == returnvalue::OK) {
return returnvalue::OK;
}
sif::error << "PollingSequence::initialize has errors!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
@ -510,13 +510,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
#endif
static_cast<void>(length);
if (uartPstEmpty) {
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
if (thisSequence->checkSequence() != returnvalue::OK) {
sif::error << "UART PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
@ -548,12 +548,12 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
if (thisSequence->checkSequence() != returnvalue::OK) {
sif::error << "GomSpace PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
static_cast<void>(length);
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
@ -583,11 +583,11 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
#endif
static_cast<void>(length);
if (not notEmpty) {
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
if (thisSequence->checkSequence() != returnvalue::OK) {
sif::error << "Test PST initialization failed" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -8,7 +8,7 @@
#include "q7sConfig.h"
#endif
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
class FixedTimeslotTaskIF;

View File

@ -14,106 +14,106 @@ AxiPtmeConfig::AxiPtmeConfig(object_id_t objectId, std::string axiUio, int mapNu
AxiPtmeConfig::~AxiPtmeConfig() {}
ReturnValue_t AxiPtmeConfig::initialize() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
UioMapper uioMapper(axiUio, mapNum);
result = uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = mutex->lockMutex(timeoutType, mutexTimeout);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
*(baseAddress + CADU_BITRATE_REG) = static_cast<uint32_t>(rateVal);
result = mutex->unlockMutex();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to unlock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::enableTxclockManipulator() {
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::disableTxclockManipulator() {
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::EN_TX_CLK_MANIPULATOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::enableTxclockInversion() {
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::INVERT_CLOCK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::disableTxclockInversion() {
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::INVERT_CLOCK);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::writeReg(uint32_t regOffset, uint32_t writeVal) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = mutex->lockMutex(timeoutType, mutexTimeout);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
*(baseAddress + regOffset / ADRESS_DIVIDER) = writeVal;
result = mutex->unlockMutex();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::readReg(uint32_t regOffset, uint32_t* readVal) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = mutex->lockMutex(timeoutType, mutexTimeout);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
*readVal = *(baseAddress + regOffset / ADRESS_DIVIDER);
result = mutex->unlockMutex();
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
return returnvalue::FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t AxiPtmeConfig::writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos) {
uint32_t readVal = 0;
ReturnValue_t result = readReg(regOffset, &readVal);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
uint32_t writeVal =
(readVal & ~(1 << static_cast<uint32_t>(bitPos))) | bitVal << static_cast<uint32_t>(bitPos);
result = writeReg(regOffset, writeVal);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return HasReturnvaluesIF::RETURN_OK;
return returnvalue::OK;
}

View File

@ -5,7 +5,7 @@
#include "fsfw/ipc/MutexIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief Class providing low level access to the configuration interface of the PTME.
@ -94,7 +94,7 @@ class AxiPtmeConfig : public SystemObject {
* @param bitVal The value of the bit to set (1 or 0)
* @param bitPos The position of the bit within the register to set
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
*/
ReturnValue_t writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos);
};

View File

@ -19,22 +19,22 @@ ReturnValue_t PapbVcInterface::initialize() {
}
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
if (pollPapbBusySignal() == RETURN_OK) {
if (pollPapbBusySignal() == returnvalue::OK) {
startPacketTransfer();
}
for (size_t idx = 0; idx < size; idx++) {
if (pollPapbBusySignal() == RETURN_OK) {
if (pollPapbBusySignal() == returnvalue::OK) {
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
} else {
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
}
if (pollPapbBusySignal() == RETURN_OK) {
if (pollPapbBusySignal() == returnvalue::OK) {
endPacketTransfer();
}
return RETURN_OK;
return returnvalue::OK;
}
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
@ -43,30 +43,30 @@ void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
/** Check if PAPB interface is ready to receive data */
result = gpioComIF->readGpio(papbBusyId, papbBusyState);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
if (papbBusyState == gpio::Levels::LOW) {
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
return PAPB_BUSY;
}
return RETURN_OK;
return returnvalue::OK;
}
void PapbVcInterface::isVcInterfaceBufferEmpty() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
gpio::Levels papbEmptyState = gpio::Levels::HIGH;
result = gpioComIF->readGpio(papbEmptyId, papbEmptyState);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
<< std::endl;
return;
@ -90,9 +90,9 @@ ReturnValue_t PapbVcInterface::sendTestFrame() {
}
ReturnValue_t result = write(testPacket, 1105);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}

View File

@ -5,7 +5,7 @@
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include "OBSWConfig.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/obc/VcInterfaceIF.h"
/**
@ -14,7 +14,7 @@
*
* @author J. Meier
*/
class PapbVcInterface : public VcInterfaceIF, public HasReturnvaluesIF {
class PapbVcInterface : public VcInterfaceIF {
public:
/**
* @brief Constructor
@ -93,7 +93,7 @@ class PapbVcInterface : public VcInterfaceIF, public HasReturnvaluesIF {
* interface is ready to receive more data or not. PAPB is ready when
* PAPB_Busy_N == '1'.
*
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
* @return returnvalue::OK when ready to receive data else PAPB_BUSY.
*/
ReturnValue_t pollPapbBusySignal();

View File

@ -3,7 +3,7 @@
#include <cstring>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief This class generates the configuration words for the configuration memory of the PDEC

View File

@ -45,37 +45,37 @@ ReturnValue_t PdecHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
UioMapper regMapper(uioRegisters);
result = regMapper.getMappedAdress(&registerBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
UioMapper configMemMapper(uioConfigMemory);
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
UioMapper ramMapper(uioRamMemory);
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
writePdecConfig();
result = releasePdec();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = actionHelper.initialize(commandQueue);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return result;
}
return RETURN_OK;
return returnvalue::OK;
}
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
@ -110,33 +110,33 @@ ReturnValue_t PdecHandler::resetFarStatFlag() {
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value."
<< " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
#if OBSW_DEBUG_PDEC_HANDLER == 1
sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar
<< std::endl;
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PdecHandler::releasePdec() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
result = gpioComIF->pullHigh(pdecReset);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl;
}
return result;
}
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
readCommandQueue();
switch (state) {
case State::INIT:
resetFarStatFlag();
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
// Requires reconfiguration and reinitialization of PDEC
triggerEvent(INVALID_FAR);
state = State::WAIT_FOR_RECOVERY;
@ -157,17 +157,17 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
break;
}
return RETURN_OK;
return returnvalue::OK;
}
void PdecHandler::readCommandQueue(void) {
CommandMessage commandMessage;
ReturnValue_t result = RETURN_FAILED;
ReturnValue_t result = returnvalue::FAILED;
result = commandQueue->receiveMessage(&commandMessage);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
result = actionHelper.handleActionMessage(&commandMessage);
if (result == RETURN_OK) {
if (result == returnvalue::OK) {
return;
}
CommandMessage reply;
@ -318,11 +318,11 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) {
}
void PdecHandler::handleNewTc() {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
uint32_t tcLength = 0;
result = readTc(tcLength);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return;
}
#if OBSW_DEBUG_PDEC_HANDLER == 1
@ -334,7 +334,7 @@ void PdecHandler::handleNewTc() {
#if OBSW_TC_FROM_PDEC == 1
store_address_t storeId;
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PdecHandler::handleNewTc: Failed to add received space packet to store"
<< std::endl;
return;
@ -343,7 +343,7 @@ void PdecHandler::handleNewTc() {
TmTcMessage message(storeId);
result = MessageQueueSenderIF::sendMessage(tcDestination->getRequestQueue(), &message);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != returnvalue::OK) {
sif::warning << "PdecHandler::handleNewTc: Failed to send message to TC destination"
<< std::endl;
tcStore->deleteData(storeId);
@ -370,7 +370,7 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) {
if (tcLength > MAX_TC_SEGMENT_SIZE) {
sif::warning << "PdecHandler::handleNewTc: Read invalid TC length from PDEC register"
<< std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
uint32_t idx = 0;
@ -401,7 +401,7 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) {
// Backend buffer is handled back to PDEC3
*(registerBaseAddress + PDEC_BFREE_OFFSET) = 0;
return RETURN_OK;
return returnvalue::OK;
}
void PdecHandler::printTC(uint32_t tcLength) {

View File

@ -6,7 +6,7 @@
#include "fsfw/action/ActionHelper.h"
#include "fsfw/action/HasActionsIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
@ -31,10 +31,7 @@
*
* @author J. Meier
*/
class PdecHandler : public SystemObject,
public ExecutableObjectIF,
public HasReturnvaluesIF,
public HasActionsIF {
class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF {
public:
/**
* @brief Constructor

View File

@ -15,11 +15,11 @@ ReturnValue_t Ptme::initialize() {
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
iter->second->initialize();
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t Ptme::writeToVc(uint8_t vcId, const uint8_t* data, size_t size) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
VcInterfaceMapIter vcInterfaceMapIter = vcInterfaceMap.find(vcId);
if (vcInterfaceMapIter == vcInterfaceMap.end()) {
sif::warning << "Ptme::writeToVc: No virtual channel interface found for the virtual "

View File

@ -8,7 +8,7 @@
#include <unordered_map>
#include "OBSWConfig.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "linux/obc/PtmeIF.h"
#include "linux/obc/VcInterfaceIF.h"
@ -18,7 +18,7 @@
* Synchro- nization and channel coding) and CCSDS 132.0-B-2 (TM Space Data Link Protocoll). The IP
* cores are implemented on the programmable logic and are accessible through the linux UIO driver.
*/
class Ptme : public PtmeIF, public SystemObject, public HasReturnvaluesIF {
class Ptme : public PtmeIF, public SystemObject {
public:
using VcId_t = uint8_t;

View File

@ -10,9 +10,9 @@ PtmeConfig::~PtmeConfig() {}
ReturnValue_t PtmeConfig::initialize() {
if (axiPtmeConfig == nullptr) {
sif::warning << "PtmeConfig::initialize: Invalid AxiPtmeConfig object" << std::endl;
return RETURN_FAILED;
return returnvalue::FAILED;
}
return RETURN_OK;
return returnvalue::OK;
}
ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
@ -27,20 +27,20 @@ ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
}
ReturnValue_t PtmeConfig::invertTxClock(bool invert) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (invert) {
result = axiPtmeConfig->enableTxclockInversion();
} else {
result = axiPtmeConfig->disableTxclockInversion();
}
if (result != RETURN_OK) {
if (result != returnvalue::OK) {
return CLK_INVERSION_FAILED;
}
return result;
}
ReturnValue_t PtmeConfig::configTxManipulator(bool enable) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = returnvalue::OK;
if (enable) {
result = axiPtmeConfig->enableTxclockManipulator();
} else {

Some files were not shown because too many files have changed in this diff Show More