diff --git a/CHANGELOG.md b/CHANGELOG.md index 5525389c..9eee73fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ list yields a list of all related PRs for each release. # [v1.14.0] +- Update for FSFW: `HasReturnvaluesIF` class replaced by namespace `returnvalue` + # [v1.13.0] 24.08.2022 - Added first version of ACS Controller with gathers MGM data in a set diff --git a/bsp_egse/InitMission.cpp b/bsp_egse/InitMission.cpp index d6b192c2..5a72f53c 100644 --- a/bsp_egse/InitMission.cpp +++ b/bsp_egse/InitMission.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -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& 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); diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 6ec0ed35..4ee90f70 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -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 */ diff --git a/bsp_hosted/comIF/ArduinoComIF.cpp b/bsp_hosted/comIF/ArduinoComIF.cpp index be136e45..b669233f 100644 --- a/bsp_hosted/comIF/ArduinoComIF.cpp +++ b/bsp_hosted/comIF/ArduinoComIF.cpp @@ -130,7 +130,7 @@ ArduinoComIF::~ArduinoComIF() { #endif } ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) { @@ -142,10 +142,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 +158,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 +178,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 +199,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 +207,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 +224,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 +241,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 +297,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, diff --git a/bsp_hosted/comIF/ArduinoComIF.h b/bsp_hosted/comIF/ArduinoComIF.h index 8476b6b5..af849745 100644 --- a/bsp_hosted/comIF/ArduinoComIF.h +++ b/bsp_hosted/comIF/ArduinoComIF.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp index 18fca7c6..9a92f544 100644 --- a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp +++ b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp @@ -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; } } diff --git a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h index 711e39ba..08bf3ca2 100644 --- a/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h +++ b/bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h @@ -1,7 +1,7 @@ #ifndef POLLINGSEQUENCEFACTORY_H_ #define POLLINGSEQUENCEFACTORY_H_ -#include +#include class FixedTimeslotTaskIF; diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 0fa7a4f6..808fc8be 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -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,15 +51,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; } @@ -67,13 +67,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; } @@ -120,11 +120,11 @@ void initmission::initTasks() { void initmission::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& 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); @@ -132,11 +132,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); @@ -144,11 +144,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); @@ -156,19 +156,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); @@ -176,11 +176,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); @@ -189,12 +189,12 @@ void initmission::createPusTasks(TaskFactory& factory, void initmission::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& 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); result = pst::pstSpi(spiPst); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; } taskVec.push_back(spiPst); @@ -204,28 +204,28 @@ void initmission::createPstTasks(TaskFactory& factory, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& 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); } #endif /* RPI_ADD_GPIO_TEST == 1 */ @@ -237,7 +237,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; } diff --git a/bsp_linux_board/gpioInit.cpp b/bsp_linux_board/gpioInit.cpp index f913db8a..b9229614 100644 --- a/bsp_linux_board/gpioInit.cpp +++ b/bsp_linux_board/gpioInit.cpp @@ -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; } diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 6cf4e734..08a980e7 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -95,23 +95,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 +143,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 +154,13 @@ void Q7STestTask::testDummyParams() { int test = 0; result = param.getValue(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(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 +179,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 +204,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 +218,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 +232,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 +341,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 +383,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 +396,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 +413,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 +422,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 +435,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 +478,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 +490,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; } } diff --git a/bsp_q7s/callbacks/gnssCallback.cpp b/bsp_q7s/callbacks/gnssCallback.cpp index 7e854b6d..22ceb3ae 100644 --- a/bsp_q7s/callbacks/gnssCallback.cpp +++ b/bsp_q7s/callbacks/gnssCallback.cpp @@ -11,10 +11,10 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo } ResetArgs* resetArgs = reinterpret_cast(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; } diff --git a/bsp_q7s/callbacks/gnssCallback.h b/bsp_q7s/callbacks/gnssCallback.h index cd69f5a6..331f97e7 100644 --- a/bsp_q7s/callbacks/gnssCallback.h +++ b/bsp_q7s/callbacks/gnssCallback.h @@ -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 { diff --git a/bsp_q7s/callbacks/q7sGpioCallbacks.cpp b/bsp_q7s/callbacks/q7sGpioCallbacks.cpp index cf222b03..512050e3 100644 --- a/bsp_q7s/callbacks/q7sGpioCallbacks.cpp +++ b/bsp_q7s/callbacks/q7sGpioCallbacks.cpp @@ -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; } diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 0fd2c512..ae23d64d 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -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(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; ; } diff --git a/bsp_q7s/callbacks/rwSpiCallback.h b/bsp_q7s/callbacks/rwSpiCallback.h index 4a5389a3..7390db5b 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.h +++ b/bsp_q7s/callbacks/rwSpiCallback.h @@ -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" diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 25d47b7c..de36b01a 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -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({0})); localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry({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 ©) { @@ -829,10 +829,10 @@ void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::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(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(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(¤tTime); - 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(¤tTime); } - 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; } } diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 80f5fc9e..6e0fce0c 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -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(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& 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& 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& 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(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 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3ac765ff..888ec04d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -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; } } diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index e6a68cf2..0b81c235 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -1,7 +1,7 @@ #ifndef BSP_Q7S_OBJECTFACTORY_H_ #define BSP_Q7S_OBJECTFACTORY_H_ -#include +#include #include diff --git a/bsp_q7s/memory/FileSystemHandler.cpp b/bsp_q7s/memory/FileSystemHandler.cpp index 33849fbe..cb122383 100644 --- a/bsp_q7s/memory/FileSystemHandler.cpp +++ b/bsp_q7s/memory/FileSystemHandler.cpp @@ -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) { diff --git a/bsp_q7s/memory/FilesystemHelper.cpp b/bsp_q7s/memory/FilesystemHelper.cpp index c4b8fa16..91dfa9c5 100644 --- a/bsp_q7s/memory/FilesystemHelper.cpp +++ b/bsp_q7s/memory/FilesystemHelper.cpp @@ -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; } diff --git a/bsp_q7s/memory/FilesystemHelper.h b/bsp_q7s/memory/FilesystemHelper.h index efdf5c6a..8233d4db 100644 --- a/bsp_q7s/memory/FilesystemHelper.h +++ b/bsp_q7s/memory/FilesystemHelper.h @@ -4,14 +4,14 @@ #include #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); diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index cfd4f490..e2702771 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -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(); 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 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 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& 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(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; diff --git a/bsp_q7s/memory/SdCardManager.h b/bsp_q7s/memory/SdCardManager.h index 84d2d97b..796c7ba2 100644 --- a/bsp_q7s/memory/SdCardManager.h +++ b/bsp_q7s/memory/SdCardManager.h @@ -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,22 @@ 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 OP_ONGOING = returnvalue::makeCode(INTERFACE_ID, 0); + static constexpr ReturnValue_t ALREADY_ON = returnvalue::makeCode(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); + returnvalue::makeCode(INTERFACE_ID, 2); + static constexpr ReturnValue_t ALREADY_OFF = returnvalue::makeCode(INTERFACE_ID, 3); static constexpr ReturnValue_t STATUS_FILE_NEXISTS = - HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10); + 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); + returnvalue::makeCode(INTERFACE_ID, 11); + static constexpr ReturnValue_t MOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 12); static constexpr ReturnValue_t UNMOUNT_ERROR = - HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13); + returnvalue::makeCode(INTERFACE_ID, 13); static constexpr ReturnValue_t SYSTEM_CALL_ERROR = - HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14); + returnvalue::makeCode(INTERFACE_ID, 14); static constexpr ReturnValue_t POPEN_CALL_ERROR = - HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 15); + returnvalue::makeCode(INTERFACE_ID, 15); static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM; @@ -105,7 +105,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 +117,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 +127,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 +139,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 diff --git a/bsp_q7s/memory/scratchApi.cpp b/bsp_q7s/memory/scratchApi.cpp index 83bc8239..78f93541 100644 --- a/bsp_q7s/memory/scratchApi.cpp +++ b/bsp_q7s/memory/scratchApi.cpp @@ -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; } diff --git a/bsp_q7s/memory/scratchApi.h b/bsp_q7s/memory/scratchApi.h index cd76fca1..a6b99fa0 100644 --- a/bsp_q7s/memory/scratchApi.h +++ b/bsp_q7s/memory/scratchApi.h @@ -7,7 +7,7 @@ #include #include -#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 ::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 diff --git a/bsp_q7s/xadc/Xadc.cpp b/bsp_q7s/xadc/Xadc.cpp index e1f1a505..34a4e159 100644 --- a/bsp_q7s/xadc/Xadc.cpp +++ b/bsp_q7s/xadc/Xadc.cpp @@ -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(xadc::file::tempRaw.c_str(), raw); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = readValFromFile(xadc::file::tempOffset.c_str(), offset); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = readValFromFile(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; } diff --git a/bsp_q7s/xadc/Xadc.h b/bsp_q7s/xadc/Xadc.h index 92ec2c0c..be6ab704 100644 --- a/bsp_q7s/xadc/Xadc.h +++ b/bsp_q7s/xadc/Xadc.h @@ -3,7 +3,7 @@ #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" namespace xadc { using namespace std; diff --git a/bsp_te0720_1cfa/InitMission.cpp b/bsp_te0720_1cfa/InitMission.cpp index dd6a3aa0..b7c6b683 100644 --- a/bsp_te0720_1cfa/InitMission.cpp +++ b/bsp_te0720_1cfa/InitMission.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -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& 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); diff --git a/dummies/AcuDummy.cpp b/dummies/AcuDummy.cpp index dc0c974d..b1ad6953 100644 --- a/dummies/AcuDummy.cpp +++ b/dummies/AcuDummy.cpp @@ -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() {} @@ -38,5 +38,5 @@ 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(3)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/BpxDummy.cpp b/dummies/BpxDummy.cpp index 974a6a30..525c5c46 100644 --- a/dummies/BpxDummy.cpp +++ b/dummies/BpxDummy.cpp @@ -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; } diff --git a/dummies/ComIFDummy.cpp b/dummies/ComIFDummy.cpp index e1552fca..af40fd51 100644 --- a/dummies/ComIFDummy.cpp +++ b/dummies/ComIFDummy.cpp @@ -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; } diff --git a/dummies/CoreControllerDummy.cpp b/dummies/CoreControllerDummy.cpp index b8aa270c..fd2e3f63 100644 --- a/dummies/CoreControllerDummy.cpp +++ b/dummies/CoreControllerDummy.cpp @@ -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({0})); localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry({0})); localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry({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; } diff --git a/dummies/GyroAdisDummy.cpp b/dummies/GyroAdisDummy.cpp index 6b760e79..de4e7f91 100644 --- a/dummies/GyroAdisDummy.cpp +++ b/dummies/GyroAdisDummy.cpp @@ -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({0.0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/GyroL3GD20Dummy.cpp b/dummies/GyroL3GD20Dummy.cpp index 7023870f..935e32f5 100644 --- a/dummies/GyroL3GD20Dummy.cpp +++ b/dummies/GyroL3GD20Dummy.cpp @@ -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({0.0})); localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry({0.0})); localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry({0.0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/ImtqDummy.cpp b/dummies/ImtqDummy.cpp index 0af9ef83..6dc451b3 100644 --- a/dummies/ImtqDummy.cpp +++ b/dummies/ImtqDummy.cpp @@ -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({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/MgmLIS3MDLDummy.cpp b/dummies/MgmLIS3MDLDummy.cpp index 0fb0edba..ea84c4b2 100644 --- a/dummies/MgmLIS3MDLDummy.cpp +++ b/dummies/MgmLIS3MDLDummy.cpp @@ -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({0.0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/P60DockDummy.cpp b/dummies/P60DockDummy.cpp index 04f5e5af..32df3882 100644 --- a/dummies/P60DockDummy.cpp +++ b/dummies/P60DockDummy.cpp @@ -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() {} @@ -42,5 +42,5 @@ ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDa LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_1, new PoolEntry({0})); localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_2, new PoolEntry({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/PduDummy.cpp b/dummies/PduDummy.cpp index e955d401..a5cc9c33 100644 --- a/dummies/PduDummy.cpp +++ b/dummies/PduDummy.cpp @@ -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() {} @@ -38,5 +38,5 @@ 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({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/PlPcduDummy.cpp b/dummies/PlPcduDummy.cpp index 75f98825..df4acd1b 100644 --- a/dummies/PlPcduDummy.cpp +++ b/dummies/PlPcduDummy.cpp @@ -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({0.0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/RwDummy.cpp b/dummies/RwDummy.cpp index d41728eb..a21e7ab7 100644 --- a/dummies/RwDummy.cpp +++ b/dummies/RwDummy.cpp @@ -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({0})); localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry({0})); localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/StarTrackerDummy.cpp b/dummies/StarTrackerDummy.cpp index 4432bb5e..8e2dd507 100644 --- a/dummies/StarTrackerDummy.cpp +++ b/dummies/StarTrackerDummy.cpp @@ -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({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/SusDummy.cpp b/dummies/SusDummy.cpp index 58b2ac8d..2cddd03e 100644 --- a/dummies/SusDummy.cpp +++ b/dummies/SusDummy.cpp @@ -25,15 +25,15 @@ 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 +54,7 @@ ReturnValue_t SusDummy::initializeLocalDataPool(localpool::DataPool& localDataPo localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, new PoolEntry({0}, 1, true)); localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry({0})); - return RETURN_OK; + return returnvalue::OK; } LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) { @@ -74,5 +74,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; } diff --git a/dummies/SyrlinksDummy.cpp b/dummies/SyrlinksDummy.cpp index 275f194c..49c1319f 100644 --- a/dummies/SyrlinksDummy.cpp +++ b/dummies/SyrlinksDummy.cpp @@ -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({0})); localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/dummies/TemperatureSensorsDummy.cpp b/dummies/TemperatureSensorsDummy.cpp index 129b20bd..49194e91 100644 --- a/dummies/TemperatureSensorsDummy.cpp +++ b/dummies/TemperatureSensorsDummy.cpp @@ -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(MAX31865::PoolIds::FAULT_BYTE), new PoolEntry({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; } diff --git a/fsfw b/fsfw index 7881f5ba..f5866dda 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7881f5bab86212035b94f4995551d75e843174b5 +Subproject commit f5866ddacee6cd0f381fb1a69f1d0cf22b5b310a diff --git a/generators/deps/fsfwgen b/generators/deps/fsfwgen index e84be4bb..b1e5a2d4 160000 --- a/generators/deps/fsfwgen +++ b/generators/deps/fsfwgen @@ -1 +1 @@ -Subproject commit e84be4bb1710e90e97f8e501565106b9e63ef56b +Subproject commit b1e5a2d40a5f41b9020f2beb0b976035f91c6343 diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 494b0baa..a979e4b2 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -328,7 +328,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; } } diff --git a/linux/ObjectFactory.h b/linux/ObjectFactory.h index c88a9eb4..56a5664b 100644 --- a/linux/ObjectFactory.h +++ b/linux/ObjectFactory.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include diff --git a/linux/boardtest/I2cTestClass.cpp b/linux/boardtest/I2cTestClass.cpp index 1bd0aa52..40a66125 100644 --- a/linux/boardtest/I2cTestClass.cpp +++ b/linux/boardtest/I2cTestClass.cpp @@ -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(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(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; } diff --git a/linux/boardtest/LibgpiodTest.cpp b/linux/boardtest/LibgpiodTest.cpp index 66e26e3b..a1cbdc11 100644 --- a/linux/boardtest/LibgpiodTest.cpp +++ b/linux/boardtest/LibgpiodTest.cpp @@ -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(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; } diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index d9eb6b5a..dc5a5e3b 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -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; } diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 9c51ed8a..891959da 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -26,10 +26,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) { @@ -37,7 +37,7 @@ ReturnValue_t UartTestClass::performPeriodicAction() { } else if (mode == TestModes::SCEX) { scexPeriodic(); } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void UartTestClass::gpsInit() { @@ -217,7 +217,7 @@ int UartTestClass::prepareScexPing() { tmpCmdBuf[6] = crc & 0xff; ReturnValue_t result = dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl; return -1; } diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index 9f346405..e6283e99 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -31,7 +31,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 +45,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 +54,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; } @@ -66,24 +66,24 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) { cspDeviceMap.emplace(cspAddress, vectorBuffer(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; + return returnvalue::FAILED; } CspCookie* cspCookie = dynamic_cast(cookie); if (cspCookie == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; + 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) { + if (result != returnvalue::OK) { return result; } uint8_t cspAddress = cspCookie->getCspAddress(); @@ -101,8 +101,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s /* 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; + if (result != returnvalue::OK) { + return returnvalue::FAILED; } replySize = querySize; break; @@ -111,22 +111,22 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s 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(cookie); if (cspCookie == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } uint8_t cspAddress = cspCookie->getCspAddress(); @@ -134,7 +134,7 @@ ReturnValue_t CspComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, *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, @@ -146,7 +146,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u 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(); @@ -157,7 +157,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 +167,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 +180,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 +191,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()) { 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 +209,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) { diff --git a/linux/csp/CspComIF.h b/linux/csp/CspComIF.h index d36bbf4f..81d95169 100644 --- a/linux/csp/CspComIF.h +++ b/linux/csp/CspComIF.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 32e3e40d..556db7ef 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -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()); localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry()); 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 diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index ea038c8b..4869fe39 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -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(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(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(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,34 @@ 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(cookie); 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(rtdCookie->exchangeBuf.data()); *size = serLen; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) { @@ -345,7 +345,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 +358,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 +380,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 +390,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 +400,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 +413,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 +428,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, diff --git a/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h b/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h index ac695ad8..8a1085ca 100644 --- a/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h +++ b/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h @@ -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: diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index 180ee907..3423c54c 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -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(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); @@ -459,11 +459,11 @@ class TcReplayStart : public TcBase { ReturnValue_t lengthCheck(size_t commandDataLen) { if (commandDataLen != COMMAND_DATA_LENGTH or - checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) { + 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 +471,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 +488,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 +529,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 +537,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 +545,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 +571,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 +587,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 +616,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 +660,7 @@ class TcCamcmdSend : public TcBase { uint16_t dataLen = static_cast(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 +669,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: diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index bfe23488..1dbb08c0 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -300,7 +300,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 +336,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 +382,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 +412,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 +434,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(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(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(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(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(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(time->year - 1900); @@ -491,7 +491,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 +528,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 +562,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 +602,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 +636,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 +679,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 +718,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 +758,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 +796,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 +844,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 +892,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 +936,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 +982,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 +1020,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 +1059,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 +1114,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 +1137,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 +1155,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 +1172,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 +1214,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 +1239,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 +1279,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(sa); @@ -1305,7 +1305,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 +1318,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 +1338,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 +1412,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 +1844,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 +1855,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 +1883,7 @@ class UpdateStatusReport : public ploc::SpTmReader { if (getFullPacketLen() != FULL_SIZE) { return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } }; diff --git a/linux/devices/devicedefinitions/StarTrackerDefinitions.h b/linux/devices/devicedefinitions/StarTrackerDefinitions.h index f7059c66..be115a78 100644 --- a/linux/devices/devicedefinitions/StarTrackerDefinitions.h +++ b/linux/devices/devicedefinitions/StarTrackerDefinitions.h @@ -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; } } diff --git a/linux/devices/devicedefinitions/SupvReturnValuesIF.h b/linux/devices/devicedefinitions/SupvReturnValuesIF.h index 307deb0e..f4557735 100644 --- a/linux/devices/devicedefinitions/SupvReturnValuesIF.h +++ b/linux/devices/devicedefinitions/SupvReturnValuesIF.h @@ -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: diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index c56ada07..a192365f 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -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(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(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; } } diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h index 05c2e902..fca65c7b 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -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); diff --git a/linux/devices/ploc/PlocMPSoCHelper.cpp b/linux/devices/ploc/PlocMPSoCHelper.cpp index e9a65d64..965c63e6 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.cpp +++ b/linux/devices/ploc/PlocMPSoCHelper.cpp @@ -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(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(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, ¤tBytes, 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(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(static_cast(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(internalState)); - return RETURN_FAILED; + return returnvalue::FAILED; } if (*readBytes > 0) { std::memcpy(data, buffer, *readBytes); diff --git a/linux/devices/ploc/PlocMPSoCHelper.h b/linux/devices/ploc/PlocMPSoCHelper.h index eb5b4346..3adffa77 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.h +++ b/linux/devices/ploc/PlocMPSoCHelper.h @@ -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); diff --git a/linux/devices/ploc/PlocMemoryDumper.cpp b/linux/devices/ploc/PlocMemoryDumper.cpp index e1fce10e..a5cd04c4 100644 --- a/linux/devices/ploc/PlocMemoryDumper.cpp +++ b/linux/devices/ploc/PlocMemoryDumper.cpp @@ -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, ¶ms); - 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; diff --git a/linux/devices/ploc/PlocMemoryDumper.h b/linux/devices/ploc/PlocMemoryDumper.h index a1b4f8de..b41ee420 100644 --- a/linux/devices/ploc/PlocMemoryDumper.h +++ b/linux/devices/ploc/PlocMemoryDumper.h @@ -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; diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 040fa1de..f683998d 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -41,9 +41,9 @@ PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t u PlocSupervisorHandler::~PlocSupervisorHandler() {} ReturnValue_t PlocSupervisorHandler::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(communicationInterface); @@ -59,13 +59,13 @@ ReturnValue_t PlocSupervisorHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } result = supvHelper->setComIF(uartComIf); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } supvHelper->setComCookie(comCookie); result = eventSubscription(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } return result; @@ -73,7 +73,7 @@ ReturnValue_t PlocSupervisorHandler::initialize() { void PlocSupervisorHandler::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: @@ -91,7 +91,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { using namespace supv; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (actionId) { case TERMINATE_SUPV_HELPER: { @@ -107,7 +107,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, } result = acceptExternalDeviceCommands(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } @@ -118,11 +118,11 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, } UpdateParams params; result = extractUpdateCommand(data, size, params); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = supvHelper->performUpdate(params); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } plocSupvHelperExecuting = true; @@ -136,7 +136,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, case MEMORY_CHECK_WITH_FILE: { UpdateParams params; ReturnValue_t result = extractBaseParams(&data, size, params); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } if (not std::filesystem::exists(params.file)) { @@ -152,7 +152,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, } result = supvHelper->startEventbBufferRequest( std::string(reinterpret_cast(data), size)); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } plocSupvHelperExecuting = true; @@ -217,32 +217,32 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d const uint8_t* commandData, size_t commandDataLen) { using namespace supv; - ReturnValue_t result = RETURN_FAILED; + ReturnValue_t result = returnvalue::FAILED; spParams.buf = commandBuffer; switch (deviceCommand) { case GET_HK_REPORT: { prepareEmptyCmd(APID_GET_HK_REPORT); - result = RETURN_OK; + result = returnvalue::OK; break; } case START_MPSOC: { prepareEmptyCmd(APID_START_MPSOC); - result = RETURN_OK; + result = returnvalue::OK; break; } case SHUTDOWN_MPSOC: { prepareEmptyCmd(APID_SHUTWOWN_MPSOC); - result = RETURN_OK; + result = returnvalue::OK; break; } case SEL_MPSOC_BOOT_IMAGE: { prepareSelBootImageCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case RESET_MPSOC: { prepareEmptyCmd(APID_RESET_MPSOC); - result = RETURN_OK; + result = returnvalue::OK; break; } case SET_TIME_REF: { @@ -251,22 +251,22 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d } case SET_BOOT_TIMEOUT: { prepareSetBootTimeoutCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case SET_MAX_RESTART_TRIES: { prepareRestartTriesCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case DISABLE_PERIOIC_HK_TRANSMISSION: { prepareDisableHk(); - result = RETURN_OK; + result = returnvalue::OK; break; } case GET_BOOT_STATUS_REPORT: { prepareEmptyCmd(APID_GET_BOOT_STATUS_RPT); - result = RETURN_OK; + result = returnvalue::OK; break; } case ENABLE_LATCHUP_ALERT: { @@ -283,32 +283,32 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d } case SET_ADC_ENABLED_CHANNELS: { prepareSetAdcEnabledChannelsCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case SET_ADC_WINDOW_AND_STRIDE: { prepareSetAdcWindowAndStrideCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case SET_ADC_THRESHOLD: { prepareSetAdcThresholdCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case GET_LATCHUP_STATUS_REPORT: { prepareEmptyCmd(APID_GET_LATCHUP_STATUS_REPORT); - result = RETURN_OK; + result = returnvalue::OK; break; } case COPY_ADC_DATA_TO_MRAM: { prepareEmptyCmd(APID_COPY_ADC_DATA_TO_MRAM); - result = RETURN_OK; + result = returnvalue::OK; break; } case REQUEST_ADC_REPORT: { prepareEmptyCmd(APID_REQUEST_ADC_REPORT); - result = RETURN_OK; + result = returnvalue::OK; break; } case RUN_AUTO_EM_TESTS: { @@ -325,23 +325,23 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d break; case SET_GPIO: { prepareSetGpioCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case READ_GPIO: { prepareReadGpioCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case RESTART_SUPERVISOR: { prepareEmptyCmd(APID_RESTART_SUPERVISOR); - result = RETURN_OK; + result = returnvalue::OK; break; } case FACTORY_RESET_CLEAR_ALL: { FactoryReset packet(spParams); result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -350,7 +350,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d case FACTORY_RESET_CLEAR_MIRROR: { FactoryReset packet(spParams); result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -359,7 +359,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d case FACTORY_RESET_CLEAR_CIRCULAR: { FactoryReset packet(spParams); result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -367,23 +367,23 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d } case START_MPSOC_QUIET: { prepareEmptyCmd(APID_START_MPSOC_QUIET); - result = RETURN_OK; + result = returnvalue::OK; break; } case SET_SHUTDOWN_TIMEOUT: { prepareSetShutdownTimeoutCmd(commandData); - result = RETURN_OK; + result = returnvalue::OK; break; } case FACTORY_FLASH: { prepareEmptyCmd(APID_FACTORY_FLASH); - result = RETURN_OK; + result = returnvalue::OK; break; } case ENABLE_AUTO_TM: { EnableAutoTm packet(spParams); result = packet.buildPacket(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -392,7 +392,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d case DISABLE_AUTO_TM: { DisableAutoTm packet(spParams); result = packet.buildPacket(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -401,7 +401,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d case LOGGING_REQUEST_COUNTERS: { RequestLoggingData packet(spParams); result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_COUNTERS); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -410,7 +410,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d case LOGGING_CLEAR_COUNTERS: { RequestLoggingData packet(spParams); result = packet.buildPacket(RequestLoggingData::Sa::CLEAR_COUNTERS); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -420,7 +420,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d uint8_t tpc = *(commandData); RequestLoggingData packet(spParams); result = packet.buildPacket(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { break; } finishTcPrep(packet.getFullPacketLen()); @@ -428,7 +428,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d } case RESET_PL: { prepareEmptyCmd(APID_RESET_PL); - result = RETURN_OK; + result = returnvalue::OK; break; } case ENABLE_NVMS: { @@ -442,7 +442,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d 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. */ @@ -510,7 +510,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite bool useAlternateId, DeviceCommandId_t alternateReplyID) { using namespace supv; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t enabledReplies = 0; @@ -518,7 +518,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite case GET_HK_REPORT: { enabledReplies = 3; result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, HK_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << HK_REPORT << " not in replyMap" << std::endl; } @@ -528,7 +528,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite enabledReplies = 3; result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, BOOT_STATUS_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << BOOT_STATUS_REPORT << " not in replyMap" << std::endl; } @@ -538,7 +538,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite enabledReplies = 3; result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, LATCHUP_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << LATCHUP_REPORT << " not in replyMap" << std::endl; } @@ -548,7 +548,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite enabledReplies = 3; result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, LOGGING_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << LOGGING_REPORT << " not in replyMap" << std::endl; } @@ -557,7 +557,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite case REQUEST_ADC_REPORT: { enabledReplies = 3; result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, ADC_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << ADC_REPORT << " not in replyMap" << std::endl; } @@ -567,7 +567,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, FIRST_MRAM_DUMP); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << FIRST_MRAM_DUMP << " not in replyMap" << std::endl; } @@ -577,7 +577,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, CONSECUTIVE_MRAM_DUMP); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << CONSECUTIVE_MRAM_DUMP << " not in replyMap" << std::endl; } @@ -627,7 +627,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite * replies will be enabled here. */ result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, ACK_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << ACK_REPORT << " not in replyMap" << std::endl; } @@ -635,12 +635,12 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite setExecutionTimeout(command->first); result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, EXE_REPORT); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << EXE_REPORT << " not in replyMap" << std::endl; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize, @@ -654,7 +654,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r return parseMramPackets(start, remainingSize, foundLen); } - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK; @@ -712,13 +712,13 @@ ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches, } *numberOfSwitches = 1; *switches = &powerSwitch; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { using namespace supv; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (id) { case ACK_REPORT: { @@ -861,11 +861,11 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(supv::ADC_ENG_14, new PoolEntry({0})); localDataPoolMap.emplace(supv::ADC_ENG_15, new PoolEntry({0})); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; object_id_t objectId = eventMessage->getReporter(); Event event = eventMessage->getEvent(); switch (objectId) { @@ -880,7 +880,7 @@ void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) { event == PlocSupvHelper::SUPV_MEM_CHECK_FAIL || event == PlocSupvHelper::SUPV_MEM_CHECK_OK) { result = this->executeAction(supv::SHUTDOWN_MPSOC, NO_COMMANDER, nullptr, 0); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { triggerEvent(SUPV_MPSOC_SHUWDOWN_BUILD_FAILED); sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown " "command" @@ -916,28 +916,28 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f if (CRC::crc16ccitt(start, foundLen) != 0) { return SupvReturnValuesIF::CRC_FAILURE; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { using namespace supv; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; AcknowledgmentReport ack(data, SIZE_ACK_REPORT); result = ack.checkSize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = ack.checkCrc(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl; nextReplyId = supv::NONE; replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT); triggerEvent(SUPV_CRC_FAILURE_EVENT); sendFailureReport(supv::ACK_REPORT, SupvReturnValuesIF::CRC_FAILURE); disableAllReplies(); - return RETURN_OK; + return returnvalue::OK; } result = ack.checkApid(); @@ -955,7 +955,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { result = IGNORE_REPLY_DATA; break; } - case RETURN_OK: { + case returnvalue::OK: { setNextReplyId(); break; } @@ -969,7 +969,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { break; default: { sif::error << "PlocSupervisorHandler::handleAckReport: APID parsing failed" << std::endl; - result = RETURN_FAILED; + result = returnvalue::FAILED; break; } } @@ -978,16 +978,16 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) { using namespace supv; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; ExecutionReport exe(data, SIZE_EXE_REPORT); result = exe.checkSize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = exe.checkCrc(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PlocSupervisorHandler::handleExecutionReport: CRC failure" << std::endl; nextReplyId = supv::NONE; return result; @@ -996,18 +996,18 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) result = exe.checkApid(); switch (result) { - case (RETURN_OK): { + case (returnvalue::OK): { handleExecutionSuccessReport(data); break; } case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): { handleExecutionFailureReport(exe.getStatusCode()); - result = RETURN_OK; + result = returnvalue::OK; break; } default: { sif::error << "PlocSupervisorHandler::handleExecutionReport: Unknown APID" << std::endl; - result = RETURN_FAILED; + result = returnvalue::FAILED; break; } } @@ -1016,7 +1016,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) } ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = verifyPacket(data, supv::SIZE_HK_REPORT); @@ -1092,7 +1092,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) { } ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = verifyPacket(data, supv::SIZE_BOOT_STATUS_REPORT); @@ -1158,7 +1158,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) } ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = verifyPacket(data, supv::SIZE_LATCHUP_STATUS_REPORT); @@ -1242,7 +1242,7 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da } ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = verifyPacket(data, supv::SIZE_LOGGING_REPORT); @@ -1254,20 +1254,20 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) { const uint8_t* dataField = data + supv::DATA_FIELD_OFFSET + sizeof(supv::RequestLoggingData::Sa); result = loggingReport.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } loggingReport.setValidityBufferGeneration(false); size_t size = loggingReport.getSerializedSize(); result = loggingReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::handleLoggingReport: Deserialization failed" << std::endl; } loggingReport.setValidityBufferGeneration(true); loggingReport.setValidity(true, true); result = loggingReport.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1 @@ -1278,7 +1278,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) { } ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = verifyPacket(data, supv::SIZE_ADC_REPORT); @@ -1290,19 +1290,19 @@ ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) { const uint8_t* dataField = data + supv::DATA_FIELD_OFFSET; result = adcReport.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adcReport.setValidityBufferGeneration(false); size_t size = adcReport.getSerializedSize(); result = adcReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::handleAdcReport: Deserialization failed" << std::endl; } adcReport.setValidityBufferGeneration(true); adcReport.setValidity(true, true); result = adcReport.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1 @@ -1378,16 +1378,16 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) { ReturnValue_t PlocSupervisorHandler::doSendReadHook() { // Prevent DHB from polling UART during commands executed by the supervisor helper task if (plocSupvHelperExecuting) { - return RETURN_FAILED; + return returnvalue::FAILED; } - return RETURN_OK; + return returnvalue::OK; } void PlocSupervisorHandler::doOffActivity() { startupState = StartupState::OFF; } void PlocSupervisorHandler::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() */ @@ -1406,7 +1406,7 @@ void PlocSupervisorHandler::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 << "PlocSupervisorHandler::handleDeviceTM: Failed to report data" << std::endl; } } @@ -1414,49 +1414,49 @@ void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) { supv::ApidOnlyPacket packet(spParams, apid); ReturnValue_t result = packet.buildPacket(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) { supv::MPSoCBootSelect packet(spParams); ReturnValue_t result = packet.buildPacket(*commandData, *(commandData + 1), *(commandData + 2), *(commandData + 3)); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() { Clock::TimeOfDay_t time; ReturnValue_t result = Clock::getDateAndTime(&time); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::prepareSetTimeRefCmd: Failed to get current time" << std::endl; return SupvReturnValuesIF::GET_TIME_FAILURE; } supv::SetTimeRef packet(spParams); result = packet.buildPacket(&time); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareDisableHk() { supv::DisablePeriodicHkTransmission packet(spParams); ReturnValue_t result = packet.buildPacket(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) { @@ -1464,27 +1464,27 @@ ReturnValue_t PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* com uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 | *(commandData + 3); ReturnValue_t result = packet.buildPacket(timeout); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t* commandData) { uint8_t restartTries = *(commandData); supv::SetRestartTries packet(spParams); ReturnValue_t result = packet.buildPacket(restartTries); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* commandData, DeviceCommandId_t deviceCommand) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t latchupId = *commandData; if (latchupId > 6) { return SupvReturnValuesIF::INVALID_LATCHUP_ID; @@ -1493,7 +1493,7 @@ ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* comm case (supv::ENABLE_LATCHUP_ALERT): { supv::LatchupAlert packet(spParams); result = packet.buildPacket(true, latchupId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); @@ -1502,7 +1502,7 @@ ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* comm case (supv::DISABLE_LATCHUP_ALERT): { supv::LatchupAlert packet(spParams); result = packet.buildPacket(false, latchupId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); @@ -1511,7 +1511,7 @@ ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* comm default: { sif::debug << "PlocSupervisorHandler::prepareLatchupConfigCmd: Invalid command id" << std::endl; - result = RETURN_FAILED; + result = returnvalue::FAILED; break; } } @@ -1529,22 +1529,22 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm } supv::SetAlertlimit packet(spParams); ReturnValue_t result = packet.buildPacket(latchupId, dutycycle); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData) { uint16_t ch = *(commandData) << 8 | *(commandData + 1); supv::SetAdcEnabledChannels packet(spParams); ReturnValue_t result = packet.buildPacket(ch); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) { @@ -1554,11 +1554,11 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8 uint16_t stridingStepSize = *(commandData + offset) << 8 | *(commandData + offset + 1); supv::SetAdcWindowAndStride packet(spParams); ReturnValue_t result = packet.buildPacket(windowSize, stridingStepSize); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) { @@ -1566,11 +1566,11 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* co *(commandData + 3); supv::SetAdcThreshold packet(spParams); ReturnValue_t result = packet.buildPacket(threshold); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* commandData) { @@ -1580,11 +1580,11 @@ ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* command } supv::RunAutoEmTests packet(spParams); ReturnValue_t result = packet.buildPacket(test); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandData) { @@ -1598,11 +1598,11 @@ ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandDa } supv::MramCmd packet(spParams); ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) { @@ -1616,7 +1616,7 @@ ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandDa } supv::MramCmd packet(spParams); ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY; @@ -1626,7 +1626,7 @@ ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandDa receivedMramDumpPackets = 0; finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) { @@ -1635,11 +1635,11 @@ ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandDat uint8_t val = *(commandData + 2); supv::SetGpio packet(spParams); ReturnValue_t result = packet.buildPacket(port, pin, val); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandData) { @@ -1647,11 +1647,11 @@ ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandDa uint8_t pin = *(commandData + 1); supv::ReadGpio packet(spParams); ReturnValue_t result = packet.buildPacket(port, pin); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } void PlocSupervisorHandler::finishTcPrep(size_t packetLen) { @@ -1662,22 +1662,22 @@ void PlocSupervisorHandler::finishTcPrep(size_t packetLen) { ReturnValue_t PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t* commandData) { uint32_t timeout = 0; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; size_t size = sizeof(timeout); result = SerializeAdapter::deSerialize(&timeout, &commandData, &size, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::prepareSetShutdownTimeoutCmd: Failed to deserialize timeout" << std::endl; } supv::SetShutdownTimeout packet(spParams); result = packet.buildPacket(timeout); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData, @@ -1687,11 +1687,11 @@ ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* comman uint8_t tpc = *(commandData + 1); RequestLoggingData packet(spParams); ReturnValue_t result = packet.buildPacket(sa, tpc); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* commandData) { @@ -1700,11 +1700,11 @@ ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* com uint8_t nvm3 = *(commandData + 1); EnableNvms packet(spParams); ReturnValue_t result = packet.buildPacket(nvm01, nvm3); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } finishTcPrep(packet.getFullPacketLen()); - return RETURN_OK; + return returnvalue::OK; } void PlocSupervisorHandler::disableAllReplies() { @@ -1830,18 +1830,18 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, siz } ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) { - ReturnValue_t result = RETURN_FAILED; + ReturnValue_t result = returnvalue::FAILED; // Prepare packet for downlink if (packetInBuffer) { uint16_t packetLen = readSpacePacketLength(spacePacketBuffer); result = verifyPacket(spacePacketBuffer, supv::SPACE_PACKET_HEADER_LENGTH + packetLen + 1); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl; return result; } result = handleMramDumpFile(id); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { DeviceCommandMap::iterator iter = deviceCommandMap.find(id); actionHelper.finish(false, iter->second.sendReplyTo, id, result); disableAllReplies(); @@ -1854,7 +1854,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) nextReplyId = supv::EXE_REPORT; } increaseExpectedMramReplies(id); - return RETURN_OK; + return returnvalue::OK; } return result; } @@ -1914,14 +1914,14 @@ ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() { } ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint16_t packetLen = readSpacePacketLength(spacePacketBuffer); uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer); if (id == supv::FIRST_MRAM_DUMP) { if (sequenceFlags == static_cast(ccsds::SequenceFlags::FIRST_SEGMENT) || (sequenceFlags == static_cast(ccsds::SequenceFlags::UNSEGMENTED))) { result = createMramDumpFile(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } } @@ -1935,7 +1935,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) { file.write(reinterpret_cast(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), packetLen - 1); file.close(); - return RETURN_OK; + return returnvalue::OK; } uint16_t PlocSupervisorHandler::readSpacePacketLength(uint8_t* spacePacket) { @@ -1947,10 +1947,10 @@ uint8_t PlocSupervisorHandler::readSequenceFlags(uint8_t* spacePacket) { } ReturnValue_t PlocSupervisorHandler::createMramDumpFile() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; std::string timeStamp; result = getTimeStampString(timeStamp); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } @@ -1973,13 +1973,13 @@ ReturnValue_t PlocSupervisorHandler::createMramDumpFile() { std::ofstream file(activeMramFile, std::ios_base::out); file.close(); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp) { Clock::TimeOfDay_t time; ReturnValue_t result = Clock::getDateAndTime(&time); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::getTimeStampString: Failed to get current time" << std::endl; return SupvReturnValuesIF::GET_TIME_FAILURE; @@ -1987,7 +1987,7 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp) timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" + std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" + std::to_string(time.minute) + "-" + std::to_string(time.second); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* commandData, size_t size, @@ -1999,11 +1999,11 @@ ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* command sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Data size too big" << std::endl; return SupvReturnValuesIF::INVALID_LENGTH; } - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = extractBaseParams(&commandData, size, params); result = SerializeAdapter::deSerialize(¶ms.bytesWritten, &commandData, &remSize, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Failed to deserialize bytes " "already written" << std::endl; @@ -2011,7 +2011,7 @@ ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* command } result = SerializeAdapter::deSerialize(¶ms.seqCount, &commandData, &remSize, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Failed to deserialize start sequence count" << std::endl; @@ -2020,7 +2020,7 @@ ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* command uint8_t delMemRaw = 0; result = SerializeAdapter::deSerialize(&delMemRaw, &commandData, &remSize, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Failed to deserialize whether to delete " "memory" @@ -2028,7 +2028,7 @@ ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* command return result; } params.deleteMemory = delMemRaw; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PlocSupervisorHandler::extractBaseParams(const uint8_t** commandData, size_t& remSize, @@ -2041,7 +2041,7 @@ ReturnValue_t PlocSupervisorHandler::extractBaseParams(const uint8_t** commandDa } } if (not nullTermFound) { - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } params.file = std::string(reinterpret_cast(*commandData)); if (params.file.size() > (config::MAX_FILENAME_SIZE + config::MAX_PATH_SIZE)) { @@ -2055,7 +2055,7 @@ ReturnValue_t PlocSupervisorHandler::extractBaseParams(const uint8_t** commandDa remSize -= 1; ReturnValue_t result = SerializeAdapter::deSerialize(¶ms.startAddr, commandData, &remSize, SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler::extractBaseParams: Failed to deserialize start address" << std::endl; return result; @@ -2064,7 +2064,7 @@ ReturnValue_t PlocSupervisorHandler::extractBaseParams(const uint8_t** commandDa } ReturnValue_t PlocSupervisorHandler::eventSubscription() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -2074,13 +2074,13 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() { ; } result = manager->registerListener(eventQueue->getId()); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = manager->subscribeToEventRange(eventQueue->getId(), event::getEventId(PlocSupvHelper::SUPV_UPDATE_FAILED), event::getEventId(PlocSupvHelper::SUPV_MEM_CHECK_FAIL)); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "PlocSupervisorHandler::eventSubscritpion: Failed to subscribe to events from " " ploc supervisor helper" @@ -2097,10 +2097,10 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* case supv::READ_GPIO: { supv::ExecutionReport exe(data, supv::SIZE_EXE_REPORT); if (exe.isNull()) { - return RETURN_FAILED; + return returnvalue::FAILED; } ReturnValue_t result = exe.checkSize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } uint16_t gpioState = exe.getStatusCode(); @@ -2109,17 +2109,17 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* #endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */ DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId); if (iter->second.sendReplyTo == NO_COMMAND_ID) { - return RETURN_OK; + return returnvalue::OK; } uint8_t data[sizeof(gpioState)]; size_t size = 0; result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState), SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl; } result = actionHelper.reportData(iter->second.sendReplyTo, commandId, data, sizeof(data)); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "PlocSupervisorHandler: Read GPIO, failed to report data" << std::endl; } break; @@ -2133,7 +2133,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* default: break; } - return RETURN_OK; + return returnvalue::OK; } void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) { diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index bd4b0b9c..82ab4545 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -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); diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp index c6641f6e..c34fdbe3 100644 --- a/linux/devices/ploc/PlocSupvHelper.cpp +++ b/linux/devices/ploc/PlocSupvHelper.cpp @@ -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(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(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(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(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(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, ¤tBytes, 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(static_cast(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(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 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(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; } diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h index fb585e12..82ce7522 100644 --- a/linux/devices/ploc/PlocSupvHelper.h +++ b/linux/devices/ploc/PlocSupvHelper.h @@ -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); diff --git a/linux/devices/startracker/ArcsecDatalinkLayer.cpp b/linux/devices/startracker/ArcsecDatalinkLayer.cpp index 24eab940..bc45d619 100644 --- a/linux/devices/startracker/ArcsecDatalinkLayer.cpp +++ b/linux/devices/startracker/ArcsecDatalinkLayer.cpp @@ -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]; } diff --git a/linux/devices/startracker/ArcsecDatalinkLayer.h b/linux/devices/startracker/ArcsecDatalinkLayer.h index e3da9b6a..ec8caed9 100644 --- a/linux/devices/startracker/ArcsecDatalinkLayer.h +++ b/linux/devices/startracker/ArcsecDatalinkLayer.h @@ -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; diff --git a/linux/devices/startracker/ArcsecJsonParamBase.cpp b/linux/devices/startracker/ArcsecJsonParamBase.cpp index cc8bbc35..05864a3f 100644 --- a/linux/devices/startracker/ArcsecJsonParamBase.cpp +++ b/linux/devices/startracker/ArcsecJsonParamBase.cpp @@ -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" diff --git a/linux/devices/startracker/ArcsecJsonParamBase.h b/linux/devices/startracker/ArcsecJsonParamBase.h index 2d20fcae..75b160b2 100644 --- a/linux/devices/startracker/ArcsecJsonParamBase.h +++ b/linux/devices/startracker/ArcsecJsonParamBase.h @@ -5,7 +5,7 @@ #include #include -#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); diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index 9b3c7721..698887b8 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -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(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(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(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({0})); localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry({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(*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(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(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(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; } diff --git a/linux/devices/startracker/StarTrackerHandler.h b/linux/devices/startracker/StarTrackerHandler.h index 90a30966..beab9d54 100644 --- a/linux/devices/startracker/StarTrackerHandler.h +++ b/linux/devices/startracker/StarTrackerHandler.h @@ -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); diff --git a/linux/devices/startracker/StarTrackerJsonCommands.cpp b/linux/devices/startracker/StarTrackerJsonCommands.cpp index c481c72a..766a1624 100644 --- a/linux/devices/startracker/StarTrackerJsonCommands.cpp +++ b/linux/devices/startracker/StarTrackerJsonCommands.cpp @@ -7,77 +7,77 @@ Limits::Limits() : ArcsecJsonParamBase(arcseckeys::LIMITS) {} size_t Limits::getSize() { return COMMAND_SIZE; } ReturnValue_t Limits::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::LIMITS); offset = 2; result = getParam(arcseckeys::ACTION, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::FPGA18CURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::FPGA25CURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::FPGA10CURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MCUCURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CMOS21CURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CMOSPIXCURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CMOS33CURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CMOSVRESCURRENT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CMOS_TEMPERATURE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MCU_TEMPERATURE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {} @@ -85,35 +85,35 @@ Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {} size_t Tracking::getSize() { return COMMAND_SIZE; } ReturnValue_t Tracking::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::TRACKING); offset = 2; result = getParam(arcseckeys::THIN_LIMIT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::OUTLIER_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::OUTLIER_THRESHOLD_QUEST, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::TRACKER_CHOICE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {} @@ -121,35 +121,35 @@ Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {} size_t Mounting::getSize() { return COMMAND_SIZE; } ReturnValue_t Mounting::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::MOUNTING); offset = 2; result = getParam(arcseckeys::qw, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::qx, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::qy, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::qz, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESSOR) {} @@ -157,41 +157,41 @@ ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESS size_t ImageProcessor::getSize() { return COMMAND_SIZE; } ReturnValue_t ImageProcessor::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::IMAGE_PROCESSOR); offset = 2; result = getParam(arcseckeys::IMAGE_PROCESSOR_MODE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::STORE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::SIGNAL_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint16(param, buffer + offset); offset += sizeof(uint16_t); result = getParam(arcseckeys::IMAGE_PROCESSOR_DARK_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint16(param, buffer + offset); offset += sizeof(uint16_t); result = getParam(arcseckeys::BACKGROUND_COMPENSATION, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {} @@ -199,155 +199,155 @@ Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {} size_t Camera::getSize() { return COMMAND_SIZE; } ReturnValue_t Camera::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::CAMERA); offset = 2; result = getParam(arcseckeys::MODE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::FOCALLENGTH, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::EXPOSURE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::INTERVAL, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::OFFSET, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addint16(param, buffer + offset); offset += sizeof(int16_t); result = getParam(arcseckeys::PGAGAIN, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::ADCGAIN, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_3, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_3, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_4, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_4, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_5, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_5, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_6, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_6, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_7, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_7, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::REG_8, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::VAL_8, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::FREQ_1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint32(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {} @@ -355,89 +355,89 @@ Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {} size_t Centroiding::getSize() { return COMMAND_SIZE; } ReturnValue_t Centroiding::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::CENTROIDING); offset = 2; result = getParam(arcseckeys::ENABLE_FILTER, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::MAX_QUALITY, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::DARK_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MIN_QUALITY, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MAX_INTENSITY, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MIN_INTENSITY, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MAX_MAGNITUDE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::GAUSSIAN_CMAX, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::GAUSSIAN_CMIN, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::TRANSMATRIX_00, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::TRANSMATRIX_01, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::TRANSMATRIX_10, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::TRANSMATRIX_11, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {} @@ -445,96 +445,96 @@ Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {} size_t Lisa::getSize() { return COMMAND_SIZE; } ReturnValue_t Lisa::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::LISA); offset = 2; result = getParam(arcseckeys::LISA_MODE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint32(param, buffer + offset); offset += sizeof(uint32_t); result = getParam(arcseckeys::PREFILTER_DIST_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::PREFILTER_ANGLE_THRESHOLD, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::FOV_WIDTH, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::FOV_HEIGHT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::FLOAT_STAR_LIMIT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::CLOSE_STAR_LIMIT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::RATING_WEIGHT_CLOSE_STAR_COUNT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::RATING_WEIGHT_FRACTION_CLOSE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::RATING_WEIGHT_MEAN_SUM, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::RATING_WEIGHT_DB_STAR_COUNT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MAX_COMBINATIONS, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::NR_STARS_STOP, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::FRACTION_CLOSE_STOP, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); - return RETURN_OK; + return returnvalue::OK; } Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {} @@ -542,23 +542,23 @@ Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {} size_t Matching::getSize() { return COMMAND_SIZE; } ReturnValue_t Matching::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::MATCHING); offset = 2; result = getParam(arcseckeys::SQUARED_DISTANCE_LIMIT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::SQUARED_SHIFT_LIMIT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {} @@ -566,35 +566,35 @@ Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {} size_t Validation::getSize() { return COMMAND_SIZE; } ReturnValue_t Validation::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::VALIDATION); offset = 2; result = getParam(arcseckeys::STABLE_COUNT, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::MAX_DIFFERENCE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MIN_TRACKER_CONFIDENCE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::MIN_MATCHED_STARS, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {} @@ -602,41 +602,41 @@ Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {} size_t Algo::getSize() { return COMMAND_SIZE; } ReturnValue_t Algo::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::ALGO); offset = 2; result = getParam(arcseckeys::MODE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::L2T_MIN_CONFIDENCE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::L2T_MIN_MATCHED, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::T2L_MIN_CONFIDENCE, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } addfloat(param, buffer + offset); offset += sizeof(float); result = getParam(arcseckeys::T2L_MIN_MATCHED, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } LogLevel::LogLevel() : ArcsecJsonParamBase(arcseckeys::LOGLEVEL) {} @@ -644,108 +644,108 @@ LogLevel::LogLevel() : ArcsecJsonParamBase(arcseckeys::LOGLEVEL) {} size_t LogLevel::getSize() { return COMMAND_SIZE; } ReturnValue_t LogLevel::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::LOG_LEVEL); offset = 2; result = getParam(arcseckeys::LOGLEVEL1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL3, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL4, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL5, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL6, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL7, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL8, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL9, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL10, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL11, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL12, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL13, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL14, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL15, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LOGLEVEL16, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } Subscription::Subscription() : ArcsecJsonParamBase(arcseckeys::SUBSCRIPTION) {} @@ -753,107 +753,107 @@ Subscription::Subscription() : ArcsecJsonParamBase(arcseckeys::SUBSCRIPTION) {} size_t Subscription::getSize() { return COMMAND_SIZE; } ReturnValue_t Subscription::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::SUBSCRIPTION); offset = 2; result = getParam(arcseckeys::TELEMETRY_1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_3, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_4, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_5, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_6, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_7, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_8, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_9, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_10, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_11, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_12, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_13, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_14, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_15, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::TELEMETRY_16, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } LogSubscription::LogSubscription() : ArcsecJsonParamBase(arcseckeys::LOG_SUBSCRIPTION) {} @@ -861,35 +861,35 @@ LogSubscription::LogSubscription() : ArcsecJsonParamBase(arcseckeys::LOG_SUBSCRI size_t LogSubscription::getSize() { return COMMAND_SIZE; } ReturnValue_t LogSubscription::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::LOG_SUBSCRIPTION); offset = 2; result = getParam(arcseckeys::LEVEL1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::MODULE1, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::LEVEL2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); offset += sizeof(uint8_t); result = getParam(arcseckeys::MODULE2, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint8(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } DebugCamera::DebugCamera() : ArcsecJsonParamBase(arcseckeys::DEBUG_CAMERA) {} @@ -897,21 +897,21 @@ DebugCamera::DebugCamera() : ArcsecJsonParamBase(arcseckeys::DEBUG_CAMERA) {} size_t DebugCamera::getSize() { return COMMAND_SIZE; } ReturnValue_t DebugCamera::createCommand(uint8_t* buffer) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; uint8_t offset = 0; std::string param; addSetParamHeader(buffer, startracker::ID::DEBUG_CAMERA); offset = 2; result = getParam(arcseckeys::TIMING, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint32(param, buffer + offset); offset += sizeof(uint32_t); result = getParam(arcseckeys::TEST, param); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } adduint32(param, buffer + offset); - return RETURN_OK; + return returnvalue::OK; } diff --git a/linux/devices/startracker/StrHelper.cpp b/linux/devices/startracker/StrHelper.cpp index b2f02f24..bee15d70 100644 --- a/linux/devices/startracker/StrHelper.cpp +++ b/linux/devices/startracker/StrHelper.cpp @@ -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(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(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(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(startracker::FirmwareRegions::FIRST), static_cast(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(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(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(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(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(eraseReq.region) << std::endl; return result; diff --git a/linux/devices/startracker/StrHelper.h b/linux/devices/startracker/StrHelper.h index 63f85233..0e6a912e 100644 --- a/linux/devices/startracker/StrHelper.h +++ b/linux/devices/startracker/StrHelper.h @@ -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,7 @@ 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 +331,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 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 87bd9c51..2535a10e 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -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(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(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(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; } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h index 03b0afb5..960820b5 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h @@ -8,7 +8,7 @@ #include "q7sConfig.h" #endif -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" class FixedTimeslotTaskIF; diff --git a/linux/obc/AxiPtmeConfig.cpp b/linux/obc/AxiPtmeConfig.cpp index 26830d05..7c1f90c6 100644 --- a/linux/obc/AxiPtmeConfig.cpp +++ b/linux/obc/AxiPtmeConfig.cpp @@ -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(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(bitPos))) | bitVal << static_cast(bitPos); result = writeReg(regOffset, writeVal); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/linux/obc/AxiPtmeConfig.h b/linux/obc/AxiPtmeConfig.h index 9a048308..6996988c 100644 --- a/linux/obc/AxiPtmeConfig.h +++ b/linux/obc/AxiPtmeConfig.h @@ -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); }; diff --git a/linux/obc/PapbVcInterface.cpp b/linux/obc/PapbVcInterface.cpp index 643104d7..fc23fed8 100644 --- a/linux/obc/PapbVcInterface.cpp +++ b/linux/obc/PapbVcInterface.cpp @@ -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(*(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; } diff --git a/linux/obc/PapbVcInterface.h b/linux/obc/PapbVcInterface.h index 0d6382e3..6162765e 100644 --- a/linux/obc/PapbVcInterface.h +++ b/linux/obc/PapbVcInterface.h @@ -5,7 +5,7 @@ #include #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(); diff --git a/linux/obc/PdecConfig.h b/linux/obc/PdecConfig.h index 37dab151..e037dd56 100644 --- a/linux/obc/PdecConfig.h +++ b/linux/obc/PdecConfig.h @@ -3,7 +3,7 @@ #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" /** * @brief This class generates the configuration words for the configuration memory of the PDEC diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 7843ee5c..fcfdd2f4 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -44,37 +44,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(®isterBaseAddress, 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(); } @@ -109,33 +109,33 @@ ReturnValue_t PdecHandler::resetFarStatFlag() { sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value." << " Read value: 0x" << std::hex << static_cast(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; @@ -156,17 +156,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; @@ -317,11 +317,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 @@ -333,7 +333,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; @@ -342,7 +342,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); @@ -369,7 +369,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; @@ -400,7 +400,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) { diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index aeb571fc..2c6a200e 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -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" @@ -33,7 +33,6 @@ */ class PdecHandler : public SystemObject, public ExecutableObjectIF, - public HasReturnvaluesIF, public HasActionsIF { public: /** diff --git a/linux/obc/Ptme.cpp b/linux/obc/Ptme.cpp index 68ba3924..65705c2e 100644 --- a/linux/obc/Ptme.cpp +++ b/linux/obc/Ptme.cpp @@ -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 " diff --git a/linux/obc/Ptme.h b/linux/obc/Ptme.h index cdb2d6c6..f76f7fd1 100644 --- a/linux/obc/Ptme.h +++ b/linux/obc/Ptme.h @@ -8,7 +8,7 @@ #include #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; diff --git a/linux/obc/PtmeConfig.cpp b/linux/obc/PtmeConfig.cpp index 9cbda7a6..589e5e5f 100644 --- a/linux/obc/PtmeConfig.cpp +++ b/linux/obc/PtmeConfig.cpp @@ -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 { diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index d6e35b57..06aff2e2 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -3,7 +3,7 @@ #include "AxiPtmeConfig.h" #include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" #include "linux/obc/PtmeConfig.h" /** @@ -11,7 +11,7 @@ * * @author J. Meier */ -class PtmeConfig : public SystemObject, public HasReturnvaluesIF { +class PtmeConfig : public SystemObject { public: /** * @brief Constructor diff --git a/linux/obc/PtmeIF.h b/linux/obc/PtmeIF.h index 7108df05..44aa39f2 100644 --- a/linux/obc/PtmeIF.h +++ b/linux/obc/PtmeIF.h @@ -1,7 +1,7 @@ #ifndef LINUX_OBC_PTMEIF_H_ #define LINUX_OBC_PTMEIF_H_ -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" /** * @brief Interface class for managing the PTME IP Core implemented in the programmable logic. diff --git a/linux/obc/VcInterfaceIF.h b/linux/obc/VcInterfaceIF.h index 45226e21..de1bb61e 100644 --- a/linux/obc/VcInterfaceIF.h +++ b/linux/obc/VcInterfaceIF.h @@ -3,7 +3,7 @@ #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" /** * @brief Interface class for managing different virtual channels of the PTME IP core implemented diff --git a/linux/utility/utility.h b/linux/utility/utility.h index b4c4fe8b..7f314f88 100644 --- a/linux/utility/utility.h +++ b/linux/utility/utility.h @@ -3,7 +3,7 @@ #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" namespace utility { diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index c97fd21b..c6b3207e 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -6,7 +6,7 @@ AcsController::AcsController(object_id_t objectId) : ExtendedControllerBase(objectId, objects::NO_OBJECT), mgmData(this) {} ReturnValue_t AcsController::handleCommandMessage(CommandMessage *message) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void AcsController::performControlOperation() { @@ -31,7 +31,7 @@ void AcsController::performControlOperation() { { PoolReadGuard pg(&mgmData); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { copyMgmData(); } } @@ -46,7 +46,7 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec); localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus); poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), 5.0}); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } LocalPoolDataSetBase *AcsController::getDataSetHandle(sid_t sid) { @@ -58,37 +58,37 @@ LocalPoolDataSetBase *AcsController::getDataSetHandle(sid_t sid) { ReturnValue_t AcsController::checkModeCommand(Mode_t mode, Submode_t submode, uint32_t *msToReachTheMode) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void AcsController::copyMgmData() { { PoolReadGuard pg(&mgm0Lis3Set); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(mgmData.mgm0Lis3.value, mgm0Lis3Set.fieldStrengths.value, 3 * sizeof(float)); } } { PoolReadGuard pg(&mgm1Rm3100Set); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(mgmData.mgm1Rm3100.value, mgm1Rm3100Set.fieldStrengths.value, 3 * sizeof(float)); } } { PoolReadGuard pg(&mgm2Lis3Set); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(mgmData.mgm2Lis3.value, mgm2Lis3Set.fieldStrengths.value, 3 * sizeof(float)); } } { PoolReadGuard pg(&mgm3Rm3100Set); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(mgmData.mgm3Rm3100.value, mgm3Rm3100Set.fieldStrengths.value, 3 * sizeof(float)); } } { PoolReadGuard pg(&imtqMgmSet); - if (pg.getReadResult() == RETURN_OK) { + if (pg.getReadResult() == returnvalue::OK) { std::memcpy(mgmData.imtqRaw.value, imtqMgmSet.mtmRawNt.value, 3 * sizeof(float)); mgmData.actuationCalStatus.value = imtqMgmSet.coilActuationStatus.value; } diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index abb46f48..4800b969 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -59,7 +59,7 @@ ReturnValue_t ThermalController::initialize() { } ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) { - return RETURN_FAILED; + return returnvalue::FAILED; } void ThermalController::performControlOperation() { @@ -83,19 +83,19 @@ void ThermalController::performControlOperation() { } ReturnValue_t result = sensorTemperatures.read(); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { copySensors(); sensorTemperatures.commit(); } result = susTemperatures.read(); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { copySus(); susTemperatures.commit(); } result = deviceTemperatures.read(); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { copyDevices(); deviceTemperatures.commit(); } @@ -206,7 +206,7 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo subdp::RegularHkPeriodicParams(susTemperatures.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(deviceTemperatures.getSid(), false, 10.0)); - return RETURN_OK; + return returnvalue::OK; } LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) { @@ -230,12 +230,12 @@ ReturnValue_t ThermalController::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; } void ThermalController::copySensors() { PoolReadGuard pg0(&max31865Set0); - if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg0.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value; sensorTemperatures.sensor_ploc_heatspreader.setValid(max31865Set0.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_ploc_heatspreader.isValid()) { @@ -244,7 +244,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg1(&max31865Set1); - if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg1.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value; sensorTemperatures.sensor_ploc_missionboard.setValid(max31865Set1.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_ploc_missionboard.isValid()) { @@ -253,7 +253,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg2(&max31865Set2); - if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg2.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_4k_camera.value = max31865Set2.temperatureCelcius.value; sensorTemperatures.sensor_4k_camera.setValid(max31865Set2.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_4k_camera.isValid()) { @@ -262,7 +262,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg3(&max31865Set3); - if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg3.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value; sensorTemperatures.sensor_dac_heatspreader.setValid(max31865Set3.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_dac_heatspreader.isValid()) { @@ -271,7 +271,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg4(&max31865Set4); - if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg4.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value; sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_startracker.isValid()) { @@ -280,7 +280,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg5(&max31865Set5); - if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg5.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value; sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_rw1.isValid()) { @@ -289,7 +289,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg6(&max31865Set6); - if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg6.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value; sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_dro.isValid()) { @@ -298,7 +298,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg7(&max31865Set7); - if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg7.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value; sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_scex.isValid()) { @@ -307,7 +307,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg8(&max31865Set8); - if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg8.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value; sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_x8.isValid()) { @@ -316,7 +316,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg9(&max31865Set9); - if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg9.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value; sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_hpa.isValid()) { @@ -325,7 +325,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg10(&max31865Set10); - if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg10.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tx_modul.value = max31865Set10.temperatureCelcius.value; sensorTemperatures.sensor_tx_modul.setValid(max31865Set10.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_tx_modul.isValid()) { @@ -334,7 +334,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg11(&max31865Set11); - if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg11.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value; sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_mpa.isValid()) { @@ -343,7 +343,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg12(&max31865Set12); - if (pg12.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg12.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value; sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_acu.isValid()) { @@ -352,7 +352,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg13(&max31865Set13); - if (pg13.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg13.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_plpcdu_heatspreader.value = max31865Set13.temperatureCelcius.value; sensorTemperatures.sensor_plpcdu_heatspreader.setValid( max31865Set13.temperatureCelcius.isValid()); @@ -362,7 +362,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg14(&max31865Set14); - if (pg14.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg14.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tcs_board.value = max31865Set14.temperatureCelcius.value; sensorTemperatures.sensor_tcs_board.setValid(max31865Set14.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_tcs_board.isValid()) { @@ -371,7 +371,7 @@ void ThermalController::copySensors() { } PoolReadGuard pg15(&max31865Set15); - if (pg15.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg15.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value; sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid()); if (not sensorTemperatures.sensor_magnettorquer.isValid()) { @@ -379,7 +379,7 @@ void ThermalController::copySensors() { } } PoolReadGuard pg111(&tmp1075Set1); - if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg1.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tmp1075_1.value = tmp1075Set1.temperatureCelcius.value; sensorTemperatures.sensor_tmp1075_1.setValid(tmp1075Set1.temperatureCelcius.isValid()); if (not tmp1075Set1.temperatureCelcius.isValid()) { @@ -387,7 +387,7 @@ void ThermalController::copySensors() { } } PoolReadGuard pg112(&tmp1075Set2); - if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg2.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tmp1075_2.value = tmp1075Set2.temperatureCelcius.value; sensorTemperatures.sensor_tmp1075_2.setValid(tmp1075Set2.temperatureCelcius.isValid()); if (not tmp1075Set2.temperatureCelcius.isValid()) { @@ -398,7 +398,7 @@ void ThermalController::copySensors() { void ThermalController::copySus() { PoolReadGuard pg0(&susSet0); - if (pg0.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg0.getReadResult() == returnvalue::OK) { susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = susSet0.temperatureCelcius.value; susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.setValid(susSet0.temperatureCelcius.isValid()); if (not susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.isValid()) { @@ -407,7 +407,7 @@ void ThermalController::copySus() { } PoolReadGuard pg1(&susSet1); - if (pg1.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg1.getReadResult() == returnvalue::OK) { susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = susSet1.temperatureCelcius.value; susTemperatures.sus_6_r_loc_xfybzm_pt_xf.setValid(susSet1.temperatureCelcius.isValid()); if (not susTemperatures.sus_6_r_loc_xfybzm_pt_xf.isValid()) { @@ -416,7 +416,7 @@ void ThermalController::copySus() { } PoolReadGuard pg2(&susSet2); - if (pg2.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg2.getReadResult() == returnvalue::OK) { susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = susSet2.temperatureCelcius.value; susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.setValid(susSet2.temperatureCelcius.isValid()); if (not susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.isValid()) { @@ -425,7 +425,7 @@ void ThermalController::copySus() { } PoolReadGuard pg3(&susSet3); - if (pg3.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg3.getReadResult() == returnvalue::OK) { susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = susSet3.temperatureCelcius.value; susTemperatures.sus_7_r_loc_xbybzm_pt_xb.setValid(susSet3.temperatureCelcius.isValid()); if (not susTemperatures.sus_7_r_loc_xbybzm_pt_xb.isValid()) { @@ -434,7 +434,7 @@ void ThermalController::copySus() { } PoolReadGuard pg4(&susSet4); - if (pg4.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg4.getReadResult() == returnvalue::OK) { susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = susSet4.temperatureCelcius.value; susTemperatures.sus_2_n_loc_xfybzb_pt_yb.setValid(susSet4.temperatureCelcius.isValid()); if (not susTemperatures.sus_2_n_loc_xfybzb_pt_yb.isValid()) { @@ -443,7 +443,7 @@ void ThermalController::copySus() { } PoolReadGuard pg5(&susSet5); - if (pg5.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg5.getReadResult() == returnvalue::OK) { susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = susSet5.temperatureCelcius.value; susTemperatures.sus_8_r_loc_xbybzb_pt_yb.setValid(susSet5.temperatureCelcius.isValid()); if (not susTemperatures.sus_8_r_loc_xbybzb_pt_yb.isValid()) { @@ -452,7 +452,7 @@ void ThermalController::copySus() { } PoolReadGuard pg6(&susSet6); - if (pg6.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg6.getReadResult() == returnvalue::OK) { susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = susSet6.temperatureCelcius.value; susTemperatures.sus_3_n_loc_xfybzf_pt_yf.setValid(susSet6.temperatureCelcius.isValid()); if (not susTemperatures.sus_3_n_loc_xfybzf_pt_yf.isValid()) { @@ -461,7 +461,7 @@ void ThermalController::copySus() { } PoolReadGuard pg7(&susSet7); - if (pg7.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg7.getReadResult() == returnvalue::OK) { susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = susSet7.temperatureCelcius.value; susTemperatures.sus_9_r_loc_xbybzb_pt_yf.setValid(susSet7.temperatureCelcius.isValid()); if (not susTemperatures.sus_9_r_loc_xbybzb_pt_yf.isValid()) { @@ -470,7 +470,7 @@ void ThermalController::copySus() { } PoolReadGuard pg8(&susSet8); - if (pg8.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg8.getReadResult() == returnvalue::OK) { susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = susSet8.temperatureCelcius.value; susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.setValid(susSet8.temperatureCelcius.isValid()); if (not susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.isValid()) { @@ -479,7 +479,7 @@ void ThermalController::copySus() { } PoolReadGuard pg9(&susSet9); - if (pg9.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg9.getReadResult() == returnvalue::OK) { susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = susSet9.temperatureCelcius.value; susTemperatures.sus_10_n_loc_xmybzf_pt_zf.setValid(susSet9.temperatureCelcius.isValid()); if (not susTemperatures.sus_10_n_loc_xmybzf_pt_zf.isValid()) { @@ -488,7 +488,7 @@ void ThermalController::copySus() { } PoolReadGuard pg10(&susSet10); - if (pg10.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg10.getReadResult() == returnvalue::OK) { susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = susSet10.temperatureCelcius.value; susTemperatures.sus_5_n_loc_xfymzb_pt_zb.setValid(susSet10.temperatureCelcius.isValid()); if (not susTemperatures.sus_5_n_loc_xfymzb_pt_zb.isValid()) { @@ -497,7 +497,7 @@ void ThermalController::copySus() { } PoolReadGuard pg11(&susSet11); - if (pg11.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (pg11.getReadResult() == returnvalue::OK) { susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = susSet11.temperatureCelcius.value; susTemperatures.sus_11_r_loc_xbymzb_pt_zb.setValid(susSet11.temperatureCelcius.isValid()); if (not susTemperatures.sus_11_r_loc_xbymzb_pt_zb.isValid()) { @@ -509,7 +509,7 @@ void ThermalController::copySus() { void ThermalController::copyDevices() { lp_var_t tempQ7s = lp_var_t(objects::CORE_CONTROLLER, core::PoolIds::TEMPERATURE); ReturnValue_t result = tempQ7s.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl; deviceTemperatures.q7s.setValid(false); deviceTemperatures.q7s = static_cast(INVALID_TEMPERATURE); @@ -518,13 +518,13 @@ void ThermalController::copyDevices() { deviceTemperatures.q7s.setValid(tempQ7s.isValid()); } result = tempQ7s.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t battTemp1 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1); result = battTemp1.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl; deviceTemperatures.batteryTemp1.setValid(false); deviceTemperatures.batteryTemp1 = static_cast(INVALID_TEMPERATURE); @@ -533,13 +533,13 @@ void ThermalController::copyDevices() { deviceTemperatures.batteryTemp1.setValid(battTemp1.isValid()); } result = battTemp1.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t battTemp2 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_2); result = battTemp2.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl; deviceTemperatures.batteryTemp2.setValid(false); deviceTemperatures.batteryTemp2 = static_cast(INVALID_TEMPERATURE); @@ -548,13 +548,13 @@ void ThermalController::copyDevices() { deviceTemperatures.batteryTemp2.setValid(battTemp2.isValid()); } result = battTemp2.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t battTemp3 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_3); result = battTemp3.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl; deviceTemperatures.batteryTemp3.setValid(false); deviceTemperatures.batteryTemp3 = static_cast(INVALID_TEMPERATURE); @@ -563,13 +563,13 @@ void ThermalController::copyDevices() { deviceTemperatures.batteryTemp3.setValid(battTemp3.isValid()); } result = battTemp3.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t battTemp4 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_4); result = battTemp4.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl; deviceTemperatures.batteryTemp4.setValid(false); deviceTemperatures.batteryTemp4 = static_cast(INVALID_TEMPERATURE); @@ -578,12 +578,12 @@ void ThermalController::copyDevices() { deviceTemperatures.batteryTemp4.setValid(battTemp4.isValid()); } result = battTemp4.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempRw1 = lp_var_t(objects::RW1, RwDefinitions::TEMPERATURE_C); result = tempRw1.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl; deviceTemperatures.rw1.setValid(false); deviceTemperatures.rw1 = static_cast(INVALID_TEMPERATURE); @@ -592,12 +592,12 @@ void ThermalController::copyDevices() { deviceTemperatures.rw1 = tempRw1; } result = tempRw1.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempRw2 = lp_var_t(objects::RW2, RwDefinitions::TEMPERATURE_C); result = tempRw2.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl; deviceTemperatures.rw2.setValid(false); deviceTemperatures.rw2 = static_cast(INVALID_TEMPERATURE); @@ -606,12 +606,12 @@ void ThermalController::copyDevices() { deviceTemperatures.rw2 = tempRw2; } result = tempRw2.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempRw3 = lp_var_t(objects::RW3, RwDefinitions::TEMPERATURE_C); result = tempRw3.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl; deviceTemperatures.rw3.setValid(false); deviceTemperatures.rw3 = static_cast(INVALID_TEMPERATURE); @@ -620,12 +620,12 @@ void ThermalController::copyDevices() { deviceTemperatures.rw3 = tempRw3; } result = tempRw3.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempRw4 = lp_var_t(objects::RW4, RwDefinitions::TEMPERATURE_C); result = tempRw4.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl; deviceTemperatures.rw4.setValid(false); deviceTemperatures.rw4 = static_cast(INVALID_TEMPERATURE); @@ -634,13 +634,13 @@ void ThermalController::copyDevices() { deviceTemperatures.rw4 = tempRw4; } result = tempRw4.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempStartracker = lp_var_t(objects::STAR_TRACKER, startracker::MCU_TEMPERATURE); result = tempStartracker.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl; deviceTemperatures.startracker.setValid(false); deviceTemperatures.startracker = static_cast(INVALID_TEMPERATURE); @@ -649,13 +649,13 @@ void ThermalController::copyDevices() { deviceTemperatures.startracker = tempStartracker; } result = tempStartracker.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempSyrlinksPowerAmplifier = lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER); result = tempSyrlinksPowerAmplifier.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" << std::endl; deviceTemperatures.syrlinksPowerAmplifier.setValid(false); @@ -665,13 +665,13 @@ void ThermalController::copyDevices() { deviceTemperatures.syrlinksPowerAmplifier = tempSyrlinksPowerAmplifier; } result = tempSyrlinksPowerAmplifier.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempSyrlinksBasebandBoard = lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD); result = tempSyrlinksBasebandBoard.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" << std::endl; deviceTemperatures.syrlinksBasebandBoard.setValid(false); @@ -681,12 +681,12 @@ void ThermalController::copyDevices() { deviceTemperatures.syrlinksBasebandBoard = tempSyrlinksBasebandBoard; } result = tempSyrlinksBasebandBoard.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempMgt = lp_var_t(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE); result = tempMgt.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl; deviceTemperatures.mgt.setValid(false); deviceTemperatures.mgt = static_cast(INVALID_TEMPERATURE); @@ -695,13 +695,13 @@ void ThermalController::copyDevices() { deviceTemperatures.mgt = tempMgt; } result = tempMgt.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_vec_t tempAcu = lp_vec_t(objects::ACU_HANDLER, P60System::pool::ACU_TEMPERATURES); result = tempAcu.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read ACU temperatures" << std::endl; deviceTemperatures.acu.setValid(false); deviceTemperatures.acu[0] = static_cast(INVALID_TEMPERATURE); @@ -712,13 +712,13 @@ void ThermalController::copyDevices() { deviceTemperatures.acu = tempAcu; } result = tempAcu.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempPdu1 = lp_var_t(objects::PDU1_HANDLER, P60System::pool::PDU_TEMPERATURE); result = tempPdu1.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl; deviceTemperatures.pdu1.setValid(false); deviceTemperatures.pdu1 = static_cast(INVALID_TEMPERATURE); @@ -727,13 +727,13 @@ void ThermalController::copyDevices() { deviceTemperatures.pdu1 = tempPdu1; } result = tempPdu1.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempPdu2 = lp_var_t(objects::PDU2_HANDLER, P60System::pool::PDU_TEMPERATURE); result = tempPdu2.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl; deviceTemperatures.pdu2.setValid(false); deviceTemperatures.pdu2 = static_cast(INVALID_TEMPERATURE); @@ -742,13 +742,13 @@ void ThermalController::copyDevices() { deviceTemperatures.pdu2 = tempPdu1; } result = tempPdu2.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t temp1P60dock = lp_var_t(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_1); result = temp1P60dock.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl; deviceTemperatures.temp1P60dock.setValid(false); deviceTemperatures.temp1P60dock = static_cast(INVALID_TEMPERATURE); @@ -757,13 +757,13 @@ void ThermalController::copyDevices() { deviceTemperatures.temp1P60dock = temp1P60dock; } result = temp1P60dock.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t temp2P60dock = lp_var_t(objects::P60DOCK_HANDLER, P60System::pool::P60DOCK_TEMPERATURE_2); result = temp2P60dock.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl; deviceTemperatures.temp2P60dock.setValid(false); deviceTemperatures.temp2P60dock = static_cast(INVALID_TEMPERATURE); @@ -772,12 +772,12 @@ void ThermalController::copyDevices() { deviceTemperatures.temp2P60dock = temp2P60dock; } result = temp2P60dock.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempGyro0 = lp_var_t(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE); result = tempGyro0.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl; deviceTemperatures.gyro0SideA.setValid(false); deviceTemperatures.gyro0SideA = static_cast(INVALID_TEMPERATURE); @@ -786,12 +786,12 @@ void ThermalController::copyDevices() { deviceTemperatures.gyro0SideA = tempGyro0; } result = tempGyro0.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempGyro1 = lp_var_t(objects::GYRO_1_L3G_HANDLER, L3GD20H::TEMPERATURE); result = tempGyro1.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl; deviceTemperatures.gyro1SideA.setValid(false); deviceTemperatures.gyro1SideA = static_cast(INVALID_TEMPERATURE); @@ -800,12 +800,12 @@ void ThermalController::copyDevices() { deviceTemperatures.gyro1SideA = tempGyro1; } result = tempGyro1.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempGyro2 = lp_var_t(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE); result = tempGyro2.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl; deviceTemperatures.gyro2SideB.setValid(false); deviceTemperatures.gyro2SideB = static_cast(INVALID_TEMPERATURE); @@ -814,12 +814,12 @@ void ThermalController::copyDevices() { deviceTemperatures.gyro2SideB = tempGyro2; } result = tempGyro2.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempGyro3 = lp_var_t(objects::GYRO_3_L3G_HANDLER, L3GD20H::TEMPERATURE); result = tempGyro3.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl; deviceTemperatures.gyro3SideB.setValid(false); deviceTemperatures.gyro3SideB = static_cast(INVALID_TEMPERATURE); @@ -828,13 +828,13 @@ void ThermalController::copyDevices() { deviceTemperatures.gyro3SideB = tempGyro3; } result = tempGyro3.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempMgm0 = lp_var_t(objects::MGM_0_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS); result = tempMgm0.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl; deviceTemperatures.mgm0SideA.setValid(false); deviceTemperatures.mgm0SideA = static_cast(INVALID_TEMPERATURE); @@ -843,13 +843,13 @@ void ThermalController::copyDevices() { deviceTemperatures.mgm0SideA = tempMgm0; } result = tempMgm0.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempMgm2 = lp_var_t(objects::MGM_2_LIS3_HANDLER, MGMLIS3MDL::TEMPERATURE_CELCIUS); result = tempMgm2.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl; deviceTemperatures.mgm2SideB.setValid(false); deviceTemperatures.mgm2SideB = static_cast(INVALID_TEMPERATURE); @@ -858,12 +858,12 @@ void ThermalController::copyDevices() { deviceTemperatures.mgm2SideB = tempMgm2; } result = tempMgm2.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } lp_var_t tempAdcPayloadPcdu = lp_var_t(objects::PLPCDU_HANDLER, plpcdu::TEMP); result = tempAdcPayloadPcdu.read(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl; deviceTemperatures.adcPayloadPcdu.setValid(false); deviceTemperatures.adcPayloadPcdu = static_cast(INVALID_TEMPERATURE); @@ -872,7 +872,7 @@ void ThermalController::copyDevices() { deviceTemperatures.adcPayloadPcdu = tempAdcPayloadPcdu; } result = tempAdcPayloadPcdu.commit(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } } diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index 35f8e2dd..4c711095 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -24,7 +24,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack #if OBSW_VERBOSE_LEVEL >= 1 PoolReadGuard pg0(&auxHk); PoolReadGuard pg1(&coreHk); - if (pg0.getReadResult() != RETURN_OK or pg1.getReadResult() != RETURN_OK) { + if (pg0.getReadResult() != returnvalue::OK or pg1.getReadResult() != returnvalue::OK) { return; } for (size_t idx = 0; idx < 3; idx++) { @@ -53,10 +53,10 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) { PoolReadGuard pg1(&auxHk); auto res0 = pg0.getReadResult(); auto res1 = pg1.getReadResult(); - if (res0 != RETURN_OK) { + if (res0 != returnvalue::OK) { return res0; } - if (res1 != RETURN_OK) { + if (res1 != returnvalue::OK) { return res1; } dataOffset += 12; @@ -135,7 +135,7 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) { dataOffset += 6; coreHk.setValidity(true, true); auxHk.setValidity(true, true); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, @@ -174,7 +174,7 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localData subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void ACUHandler::printChannelStats() { @@ -190,12 +190,12 @@ void ACUHandler::printChannelStats() { void ACUHandler::setDebugMode(bool enable) { this->debugMode = enable; } ReturnValue_t ACUHandler::printStatus(DeviceCommandId_t cmd) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (cmd) { case (GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&coreHk); result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } printChannelStats(); @@ -205,7 +205,7 @@ ReturnValue_t ACUHandler::printStatus(DeviceCommandId_t cmd) { return DeviceHandlerIF::COMMAND_NOT_SUPPORTED; } } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "Reading PDU1 HK table failed!" << std::endl; } return result; diff --git a/mission/devices/BpxBatteryHandler.cpp b/mission/devices/BpxBatteryHandler.cpp index d121fc8c..02eea4fe 100644 --- a/mission/devices/BpxBatteryHandler.cpp +++ b/mission/devices/BpxBatteryHandler.cpp @@ -38,7 +38,7 @@ ReturnValue_t BpxBatteryHandler::buildTransitionDeviceCommand(DeviceCommandId_t* *id = BpxBattery::PING; return buildCommandFromCommand(*id, nullptr, 0); } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void BpxBatteryHandler::fillCommandAndReplyMap() { @@ -136,7 +136,7 @@ ReturnValue_t BpxBatteryHandler::buildCommandFromCommand(DeviceCommandId_t devic this->rawPacket = cmdBuf.data(); lastCmd = deviceCommand; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t BpxBatteryHandler::scanForReply(const uint8_t* start, size_t remainingSize, @@ -182,7 +182,7 @@ ReturnValue_t BpxBatteryHandler::scanForReply(const uint8_t* start, size_t remai } *foundLen = remainingSize; *foundId = lastCmd; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { @@ -194,7 +194,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons PoolReadGuard rg(&hkSet); ReturnValue_t result = hkSet.parseRawHk(packet + 2, 21); hkSet.setValidity(true, true); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } if (debugMode) { @@ -236,7 +236,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons case (BpxBattery::CONFIG_GET): { PoolReadGuard rg(&cfgSet); ReturnValue_t result = cfgSet.parseRawHk(packet + 2, 3); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } cfgSet.setValidity(true, true); @@ -249,7 +249,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t BpxBatteryHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 10000; } @@ -272,7 +272,7 @@ ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(hkSet.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void BpxBatteryHandler::setToGoToNormalMode(bool enable) { diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index ac1f99fa..1bc34959 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -66,7 +66,7 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand(DeviceCommandId_t devi return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, @@ -85,7 +85,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, // The data from the device will generally be read all at once. Therefore, we // can set all field here PoolReadGuard pg(&gpsSet); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg.getReadResult() != returnvalue::OK) { #if FSFW_VERBOSE_LEVEL >= 1 sif::warning << "GPSHyperionHandler::scanForReply: Reading dataset failed" << std::endl; #endif @@ -145,12 +145,12 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, *foundLen = len; *foundId = GpsHyperion::GPS_REPLY; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GPSHyperionHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t GPSHyperionHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { return 5000; } @@ -170,7 +170,7 @@ ReturnValue_t GPSHyperionHandler::initializeLocalDataPool(localpool::DataPool &l localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry()); localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry()); poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), false, 30.0, false); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GPSHyperionHandler::fillCommandAndReplyMap() { @@ -191,7 +191,7 @@ void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t obj ReturnValue_t GPSHyperionHandler::initialize() { ReturnValue_t result = DeviceHandlerBase::initialize(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } // Enable reply immediately for now diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index da54168a..1cf9ea68 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -26,11 +26,11 @@ void GomspaceDeviceHandler::doStartUp() {} void GomspaceDeviceHandler::doShutDown() {} ReturnValue_t GomspaceDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, @@ -40,7 +40,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d switch (deviceCommand) { case (GOMSPACE::PING): { result = generatePingCommand(commandData, commandDataLen); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; @@ -51,21 +51,21 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::PARAM_SET): { result = generateSetParamCommand(commandData, commandDataLen); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::PARAM_GET): { result = generateGetParamCommand(commandData, commandDataLen); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::GNDWDT_RESET): { result = generateResetWatchdogCmd(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; @@ -77,7 +77,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } case (GOMSPACE::REQUEST_HK_TABLE): { result = generateRequestFullHkTableCmd(hkTableReplySize); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; @@ -85,7 +85,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GomspaceDeviceHandler::fillCommandAndReplyMap() { @@ -128,7 +128,7 @@ ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t r default: return IGNORE_REPLY_DATA; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, @@ -153,7 +153,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, size_t size = GOMSPACE::GS_HDR_LENGTH + payloadLength; ReturnValue_t result = cspGetParamReply.deSerialize(&packet, &size, SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to deserialize get parameter" << "reply" << std::endl; return result; @@ -170,7 +170,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, /* When setting a parameter, the p60dock sends back the state of the * operation */ if (*packet != PARAM_SET_OK) { - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } setParamCallback(setParamCacher, true); break; @@ -182,7 +182,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, default: break; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GomspaceDeviceHandler::setNormalDatapoolEntriesInvalid() {} @@ -195,16 +195,16 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm if (setParamCacher.getAddress() == PDU2::CONFIG_ADDRESS_OUT_EN_Q7S and this->getObjectId() == objects::PDU2_HANDLER) { triggerEvent(power::SWITCHING_Q7S_DENIED, 0, 0); - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to deserialize set parameter " "message" << std::endl; return result; } result = setParamCallback(setParamCacher, false); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } /* Get and check address */ @@ -231,7 +231,7 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm result = setParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to serialize command for " << "CspComIF" << std::endl; return result; @@ -246,7 +246,7 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm rawPacketLen = cspPacketLen; rememberRequestedSize = querySize; rememberCommandId = GOMSPACE::PARAM_SET; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* commandData, @@ -255,7 +255,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm /* Unpack the received action message */ GetParamMessageUnpacker getParamMessage; result = getParamMessage.deSerialize(&commandData, &commandDataLen, SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "Failed to deserialize message to extract information " "from get parameter message" << std::endl; @@ -299,7 +299,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm uint8_t* buffer = cspPacket; result = getParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to serialize command to " << "get parameter" << std::endl; } @@ -313,7 +313,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm rawPacketLen = cspPacketLen; rememberRequestedSize = querySize; rememberCommandId = GOMSPACE::PARAM_GET; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::generatePingCommand(const uint8_t* commandData, @@ -323,7 +323,7 @@ ReturnValue_t GomspaceDeviceHandler::generatePingCommand(const uint8_t* commandD uint8_t* buffer = cspPacket; ReturnValue_t result = cspPingCommand.serialize(&buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to serialize ping command" << std::endl; return result; } @@ -334,7 +334,7 @@ ReturnValue_t GomspaceDeviceHandler::generatePingCommand(const uint8_t* commandD rawPacket = cspPacket; rawPacketLen = cspPacketLen; rememberCommandId = GOMSPACE::PING; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GomspaceDeviceHandler::generateRebootCommand() { @@ -355,7 +355,7 @@ ReturnValue_t GomspaceDeviceHandler::childCommandHook(DeviceCommandId_t cmd, ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::initializePduPool( @@ -393,7 +393,7 @@ ReturnValue_t GomspaceDeviceHandler::initializePduPool( localDataPoolMap.emplace(P60System::pool::PDU_WDT_CAN_LEFT, new PoolEntry({0})); localDataPoolMap.emplace(P60System::pool::PDU_WDT_CSP_LEFT1, new PoolEntry({0})); localDataPoolMap.emplace(P60System::pool::PDU_WDT_CSP_LEFT2, new PoolEntry({0})); - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { @@ -402,7 +402,7 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { uint8_t* buffer = cspPacket; ReturnValue_t result = watchdogResetCommand.serialize(&buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler: Failed to serialize watchdog reset " << "command" << std::endl; return result; @@ -412,7 +412,7 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { rememberRequestedSize = 0; // No bytes will be queried with the ground // watchdog command. rememberCommandId = GOMSPACE::GNDWDT_RESET; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTableReplySize) { @@ -424,7 +424,7 @@ ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTa uint8_t* buffer = cspPacket; ReturnValue_t result = requestFullTableCommand.serialize( &buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "GomspaceDeviceHandler::generateRequestFullHkTableCmd Failed to serialize " "full table request command " << std::endl; @@ -434,7 +434,7 @@ ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTa rawPacketLen = cspPacketLen; rememberRequestedSize = querySize; rememberCommandId = GOMSPACE::REQUEST_HK_TABLE; - return RETURN_OK; + return returnvalue::OK; } uint32_t GomspaceDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 0; } @@ -443,7 +443,7 @@ void GomspaceDeviceHandler::setModeNormal() { mode = MODE_NORMAL; } ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) { sif::info << "No printHkTable implementation given.." << std::endl; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU::PduAuxHk& auxHk, @@ -451,10 +451,10 @@ ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU uint16_t dataOffset = 0; PoolReadGuard pg0(&coreHk); PoolReadGuard pg1(&auxHk); - if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or - pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg0.getReadResult() != returnvalue::OK or + pg1.getReadResult() != returnvalue::OK) { sif::warning << "Reading PDU1 datasets failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } /* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table * address. */ @@ -551,5 +551,5 @@ ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU if (not auxHk.isValid()) { auxHk.setValidity(true, true); } - return RETURN_OK; + return returnvalue::OK; } diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index ea09b374..b564abd4 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -21,12 +21,12 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { public: static constexpr uint8_t CLASS_ID = CLASS_ID::GOM_SPACE_HANDLER; - static const ReturnValue_t PACKET_TOO_LONG = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 0); - static const ReturnValue_t INVALID_TABLE_ID = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1); - static const ReturnValue_t INVALID_ADDRESS = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2); - static const ReturnValue_t INVALID_PARAM_SIZE = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3); - static const ReturnValue_t INVALID_PAYLOAD_SIZE = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 4); - static const ReturnValue_t UNKNOWN_REPLY_ID = HasReturnvaluesIF::makeReturnCode(CLASS_ID, 5); + static const ReturnValue_t PACKET_TOO_LONG = returnvalue::makeCode(CLASS_ID, 0); + static const ReturnValue_t INVALID_TABLE_ID = returnvalue::makeCode(CLASS_ID, 1); + static const ReturnValue_t INVALID_ADDRESS = returnvalue::makeCode(CLASS_ID, 2); + static const ReturnValue_t INVALID_PARAM_SIZE = returnvalue::makeCode(CLASS_ID, 3); + static const ReturnValue_t INVALID_PAYLOAD_SIZE = returnvalue::makeCode(CLASS_ID, 4); + static const ReturnValue_t UNKNOWN_REPLY_ID = returnvalue::makeCode(CLASS_ID, 5); /** * @brief Constructor @@ -105,7 +105,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { /** * @brief Can be overriden by child classes to implement device specific commands. * @return Return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED to let this handler handle - * the command or RETURN_OK if the child handles the command + * the command or returnvalue::OK if the child handles the command */ virtual ReturnValue_t childCommandHook(DeviceCommandId_t cmd, const uint8_t *commandData, size_t commandDataLen); diff --git a/mission/devices/GyroADIS1650XHandler.cpp b/mission/devices/GyroADIS1650XHandler.cpp index 3e798f04..5ff84a96 100644 --- a/mission/devices/GyroADIS1650XHandler.cpp +++ b/mission/devices/GyroADIS1650XHandler.cpp @@ -87,10 +87,10 @@ ReturnValue_t GyroADIS1650XHandler::buildTransitionDeviceCommand(DeviceCommandId sif::debug << "GyroADIS16507Handler::buildTransitionDeviceCommand: " "Unknown internal state!" << std::endl; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GyroADIS1650XHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, @@ -178,7 +178,7 @@ ReturnValue_t GyroADIS1650XHandler::buildCommandFromCommand(DeviceCommandId_t de #endif /* OBSW_VERBOSE_LEVEL >= 1 */ } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GyroADIS1650XHandler::fillCommandAndReplyMap() { @@ -198,7 +198,7 @@ ReturnValue_t GyroADIS1650XHandler::scanForReply(const uint8_t *start, size_t re *foundId = this->getPendingCommand(); *foundLen = this->rawPacketLen; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GyroADIS1650XHandler::interpretDeviceReply(DeviceCommandId_t id, @@ -215,7 +215,7 @@ ReturnValue_t GyroADIS1650XHandler::interpretDeviceReply(DeviceCommandId_t id, } warningSwitch = false; #endif - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } PoolReadGuard rg(&configDataset); configDataset.diagStatReg.value = packet[2] << 8 | packet[3]; @@ -232,7 +232,7 @@ ReturnValue_t GyroADIS1650XHandler::interpretDeviceReply(DeviceCommandId_t id, return handleSensorData(packet); } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) { @@ -243,7 +243,7 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) { sif::warning << "GyroADIS1650XHandler::interpretDeviceReply: Analysis with BURST_SEL1" " not implemented!" << std::endl; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (BurstModes::BURST_16_BURST_SEL_0): { uint16_t checksum = packet[20] << 8 | packet[21]; @@ -258,11 +258,11 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) { "Invalid checksum detected!" << std::endl; #endif - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } ReturnValue_t result = configDataset.diagStatReg.read(); - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { configDataset.diagStatReg.value = packet[2] << 8 | packet[3]; configDataset.diagStatReg.setValid(true); } @@ -322,7 +322,7 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) { break; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t GyroADIS1650XHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 6000; } @@ -365,7 +365,7 @@ ReturnValue_t GyroADIS1650XHandler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(ADIS1650X::DEC_RATE_REGISTER, new PoolEntry()); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(primaryDataset.getSid(), false, 5.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } GyroADIS1650XHandler::BurstModes GyroADIS1650XHandler::getBurstMode() { @@ -396,7 +396,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie * if (handler == nullptr) { sif::error << "GyroADIS16507Handler::spiSendCallback: Passed handler pointer is invalid!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } DeviceCommandId_t currentCommand = handler->getPendingCommand(); switch (currentCommand) { @@ -405,13 +405,13 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie * } case (ADIS1650X::READ_OUT_CONFIG): default: { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = returnvalue::OK; int retval = 0; // Prepare transfer int fileDescriptor = 0; std::string device = comIf->getSpiDev(); UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage"); - if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + if (fileHelper.getOpenResult() != returnvalue::OK) { return SpiComIF::OPENING_FILE_FAILED; } spi::SpiModes spiMode = spi::SpiModes::MODE_0; @@ -432,13 +432,13 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie * sif::warning << "GyroADIS16507Handler::spiSendCallback: " "Mutex or GPIO interface invalid" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; #endif } if (gpioId != gpio::NO_GPIO) { result = mutex->lockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl; #endif @@ -486,7 +486,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie * } } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void GyroADIS1650XHandler::setToGoToNormalModeImmediately() { goToNormalMode = true; } diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 6953dc54..3c25eb6a 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -52,17 +52,17 @@ ReturnValue_t HeaterHandler::performOperation(uint8_t operationCode) { "Out of range error | " << e.what() << std::endl; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t HeaterHandler::initialize() { ReturnValue_t result = SystemObject::initialize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } result = initializeHeaterMap(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -73,35 +73,35 @@ ReturnValue_t HeaterHandler::initialize() { } result = actionHelper.initialize(commandQueue); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t HeaterHandler::initializeHeaterMap() { for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) { heaterVec.push_back(HeaterWrapper(helper.heaters[switchNr], SwitchState::OFF)); } - return RETURN_OK; + return returnvalue::OK; } void HeaterHandler::readCommandQueue() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; CommandMessage command; do { result = commandQueue->receiveMessage(&command); if (result == MessageQueueIF::EMPTY) { break; - } else if (result != RETURN_OK) { + } else if (result != returnvalue::OK) { sif::warning << "HeaterHandler::readCommandQueue: Message reception error" << std::endl; } result = actionHelper.handleActionMessage(&command); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { continue; } - } while (result == RETURN_OK); + } while (result == returnvalue::OK); } ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, @@ -147,7 +147,7 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t heater.action = action; heater.cmdActive = true; heater.replyQueue = commandedBy; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) { @@ -172,12 +172,12 @@ ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t o } result = ipcStore->addData(&storeAddress, commandData, sizeof(commandData)); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { CommandMessage message; ActionMessage::setCommand(&message, SWITCH_HEATER, storeAddress); /* Send heater command to own command queue */ result = commandQueue->sendMessage(commandQueue->getId(), &message, 0); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "HeaterHandler::sendSwitchCommand: Failed to send switch" << "message" << std::endl; } @@ -217,7 +217,7 @@ void HeaterHandler::handleSwitchHandling() { } void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; auto& heater = heaterVec.at(heaterIdx); /* Check if command waits for main switch being set on and whether the timeout has expired */ if (heater.waitMainSwitchOn && heater.mainSwitchCountdown.hasTimedOut()) { @@ -239,7 +239,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) { if (checkSwitchState(heaterIdx) == SwitchState::OFF) { gpioId_t gpioId = heater.gpioId; result = gpioInterface->pullHigh(gpioId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "HeaterHandler::handleSwitchOnCommand: Failed to pull gpio with id " << gpioId << " high" << std::endl; triggerEvent(GPIO_PULL_HIGH_FAILED, result); @@ -253,7 +253,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) { // There is no need to send action finish replies if the sender was the // HeaterHandler itself if (heater.replyQueue != commandQueue->getId()) { - if (result == RETURN_OK) { + if (result == returnvalue::OK) { actionHelper.finish(true, heater.replyQueue, heater.action, result); } else { actionHelper.finish(false, heater.replyQueue, heater.action, result); @@ -279,20 +279,20 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) { } void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; auto& heater = heaterVec.at(heaterIdx); // Check whether switch is already off if (checkSwitchState(heaterIdx)) { gpioId_t gpioId = heater.gpioId; result = gpioInterface->pullLow(gpioId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "HeaterHandler::handleSwitchOffCommand: Failed to pull gpio with id" << gpioId << " low" << std::endl; triggerEvent(GPIO_PULL_LOW_FAILED, result); } else { auto result = heaterMutex->lockMutex(); heater.switchState = OFF; - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { heaterMutex->unlockMutex(); } triggerEvent(HEATER_WENT_OFF, heaterIdx, 0); @@ -307,7 +307,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) { } if (heater.replyQueue != NO_COMMANDER) { // Report back switch command reply if necessary - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { actionHelper.finish(true, heater.replyQueue, heater.action, result); } else { actionHelper.finish(false, heater.replyQueue, heater.action, result); @@ -333,7 +333,7 @@ bool HeaterHandler::allSwitchesOff() { MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } -ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; } +ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; } ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch); @@ -341,7 +341,7 @@ ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return PowerSwitchIF::SWITCH_OFF; } if (switchNr > 7) { - return PowerSwitchIF::RETURN_FAILED; + return returnvalue::FAILED; } if (checkSwitchState(static_cast(switchNr)) == SwitchState::ON) { return PowerSwitchIF::SWITCH_ON; diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 0f4420b4..75badf91 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 0d1f72db..52df8c97 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -76,48 +76,48 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma commandBuffer[1] = IMTQ::SELF_TEST_AXIS::X_POSITIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::NEG_X_SELF_TEST): { commandBuffer[0] = IMTQ::CC::SELF_TEST_CMD; commandBuffer[1] = IMTQ::SELF_TEST_AXIS::X_NEGATIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::POS_Y_SELF_TEST): { commandBuffer[0] = IMTQ::CC::SELF_TEST_CMD; commandBuffer[1] = IMTQ::SELF_TEST_AXIS::Y_POSITIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::NEG_Y_SELF_TEST): { commandBuffer[0] = IMTQ::CC::SELF_TEST_CMD; commandBuffer[1] = IMTQ::SELF_TEST_AXIS::Y_NEGATIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::POS_Z_SELF_TEST): { commandBuffer[0] = IMTQ::CC::SELF_TEST_CMD; commandBuffer[1] = IMTQ::SELF_TEST_AXIS::Z_POSITIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::NEG_Z_SELF_TEST): { commandBuffer[0] = IMTQ::CC::SELF_TEST_CMD; commandBuffer[1] = IMTQ::SELF_TEST_AXIS::Z_NEGATIVE; rawPacket = commandBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::GET_SELF_TEST_RESULT): { commandBuffer[0] = IMTQ::CC::GET_SELF_TEST_RESULT; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::START_ACTUATION_DIPOLE): { /* IMTQ expects low byte first */ @@ -135,42 +135,42 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma commandBuffer[8] = commandData[6]; rawPacket = commandBuffer; rawPacketLen = 9; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::GET_ENG_HK_DATA): { commandBuffer[0] = IMTQ::CC::GET_ENG_HK_DATA; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::GET_COMMANDED_DIPOLE): { commandBuffer[0] = IMTQ::CC::GET_COMMANDED_DIPOLE; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::START_MTM_MEASUREMENT): { commandBuffer[0] = IMTQ::CC::START_MTM_MEASUREMENT; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::GET_CAL_MTM_MEASUREMENT): { commandBuffer[0] = IMTQ::CC::GET_CAL_MTM_MEASUREMENT; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } case (IMTQ::GET_RAW_MTM_MEASUREMENT): { commandBuffer[0] = IMTQ::CC::GET_RAW_MTM_MEASUREMENT; rawPacket = commandBuffer; rawPacketLen = 1; - return RETURN_OK; + return returnvalue::OK; } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void IMTQHandler::fillCommandAndReplyMap() { @@ -198,7 +198,7 @@ void IMTQHandler::fillCommandAndReplyMap() { ReturnValue_t IMTQHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (*start) { case (IMTQ::CC::START_ACTUATION_DIPOLE): @@ -243,11 +243,11 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t* start, size_t remainingSi } ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = parseStatusByte(packet); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } @@ -283,7 +283,7 @@ ReturnValue_t IMTQHandler::interpretDeviceReply(DeviceCommandId_t id, const uint } } - return RETURN_OK; + return returnvalue::OK; } void IMTQHandler::setNormalDatapoolEntriesInvalid() {} @@ -608,7 +608,7 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat subdp::DiagnosticsHkPeriodicParams(calMtmMeasurementSet.getSid(), false, 10.0)); poolManager.subscribeForDiagPeriodicPacket( subdp::DiagnosticsHkPeriodicParams(rawMtmMeasurementSet.getSid(), false, 10.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t IMTQHandler::getSelfTestCommandId(DeviceCommandId_t* id) { @@ -627,14 +627,14 @@ ReturnValue_t IMTQHandler::getSelfTestCommandId(DeviceCommandId_t* id) { << "command" << std::endl; return UNEXPECTED_SELF_TEST_REPLY; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t IMTQHandler::parseStatusByte(const uint8_t* packet) { uint8_t cmdErrorField = *(packet + 1) & 0xF; switch (cmdErrorField) { case 0: - return RETURN_OK; + return returnvalue::OK; case 1: sif::error << "IMTQHandler::parseStatusByte: Command rejected without reason" << std::endl; return REJECTED_WITHOUT_REASON; @@ -728,7 +728,7 @@ void IMTQHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCom } ReturnValue_t result = actionHelper.reportData(queueId, replyId, data, dataSize); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "IMTQHandler::handleDeviceTM: Failed to report data" << std::endl; return; } @@ -787,22 +787,22 @@ void IMTQHandler::fillRawMtmDataset(const uint8_t* packet) { uint32_t coilActStatus = 0; auto res = SerializeAdapter::deSerialize(&xRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE); - if (res != HasReturnvaluesIF::RETURN_OK) { + if (res != returnvalue::OK) { return; } res = SerializeAdapter::deSerialize(&yRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE); - if (res != HasReturnvaluesIF::RETURN_OK) { + if (res != returnvalue::OK) { return; } res = SerializeAdapter::deSerialize(&zRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE); - if (res != HasReturnvaluesIF::RETURN_OK) { + if (res != returnvalue::OK) { return; } res = SerializeAdapter::deSerialize(&coilActStatus, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE); - if (res != HasReturnvaluesIF::RETURN_OK) { + if (res != returnvalue::OK) { return; } rawMtmMeasurementSet.mtmRawNt[0] = xRaw * 7.5; @@ -2229,7 +2229,7 @@ ReturnValue_t IMTQHandler::getSwitches(const uint8_t** switches, uint8_t* number if (switcher != power::NO_SWITCH) { *numberOfSwitches = 1; *switches = &switcher; - return RETURN_OK; + return returnvalue::OK; } return DeviceHandlerBase::NO_SWITCH; } diff --git a/mission/devices/Max31865EiveHandler.cpp b/mission/devices/Max31865EiveHandler.cpp index 7ad15670..8858cf38 100644 --- a/mission/devices/Max31865EiveHandler.cpp +++ b/mission/devices/Max31865EiveHandler.cpp @@ -86,7 +86,7 @@ ReturnValue_t Max31865EiveHandler::buildCommandFromCommand(DeviceCommandId_t dev default: return NOTHING_TO_SEND; } - return RETURN_OK; + return returnvalue::OK; } void Max31865EiveHandler::setInstantNormal(bool instantNormal) { @@ -135,14 +135,14 @@ ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t rem } *foundId = EiveMax31855::RtdCommands::EXCHANGE_SET_ID; *foundLen = remainingSize; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { size_t deserTmp = structLen; auto result = exchangeStruct.deSerialize(&packet, &deserTmp, SerializeIF::Endianness::MACHINE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } if (mode == _MODE_TO_NORMAL and exchangeStruct.active and state == InternalState::ACTIVE) { @@ -157,10 +157,10 @@ ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id, float approxTemp = exchangeStruct.adcCode / 32.0 - 256.0; PoolReadGuard pg(&sensorDataset); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg.getReadResult() != returnvalue::OK) { sif::warning << "Max31865EiveHandler: Failed to read sensor dataset" << std::endl; sensorDataset.temperatureCelcius.setValid(false); - return RETURN_OK; + return returnvalue::OK; } sensorDataset.temperatureCelcius = approxTemp; sensorDataset.temperatureCelcius.setValid(true); @@ -171,7 +171,7 @@ ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id, << " | R[Ohm] " << rtdValue << " Ohms | Approx T[C]: " << approxTemp << std::endl; } } - return RETURN_OK; + return returnvalue::OK; } uint32_t Max31865EiveHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 2000; } @@ -186,7 +186,7 @@ ReturnValue_t Max31865EiveHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap.emplace(static_cast(PoolIds::FAULT_BYTE), new PoolEntry({0})); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0)); - return RETURN_OK; + return returnvalue::OK; } void Max31865EiveHandler::setDeviceInfo(uint8_t idx_, std::string location_) { diff --git a/mission/devices/Max31865PT1000Handler.cpp b/mission/devices/Max31865PT1000Handler.cpp index a5f6aa4f..30e19d0e 100644 --- a/mission/devices/Max31865PT1000Handler.cpp +++ b/mission/devices/Max31865PT1000Handler.cpp @@ -148,7 +148,7 @@ ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand(DeviceCommandI #else sif::printError("Max31865PT1000Handler: Invalid internal state\n"); #endif - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } } @@ -163,7 +163,7 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d currentCfg = commandData[0]; DeviceHandlerBase::rawPacketLen = 2; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } else { return DeviceHandlerIF::NO_COMMAND_DATA; } @@ -173,14 +173,14 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[1] = currentCfg | MAX31865::CLEAR_FAULT_BIT_VAL; DeviceHandlerBase::rawPacketLen = 2; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::REQUEST_CONFIG): { commandBuffer[0] = static_cast(MAX31865::REQUEST_CONFIG); commandBuffer[1] = 0x00; // dummy byte DeviceHandlerBase::rawPacketLen = 2; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::WRITE_HIGH_THRESHOLD): { commandBuffer[0] = static_cast(MAX31865::WRITE_HIGH_THRESHOLD); @@ -188,7 +188,7 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[2] = static_cast(HIGH_THRESHOLD & 0xFF); DeviceHandlerBase::rawPacketLen = 3; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::REQUEST_HIGH_THRESHOLD): { commandBuffer[0] = static_cast(MAX31865::REQUEST_HIGH_THRESHOLD); @@ -196,7 +196,7 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[2] = 0x00; // dummy byte DeviceHandlerBase::rawPacketLen = 3; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::WRITE_LOW_THRESHOLD): { commandBuffer[0] = static_cast(MAX31865::WRITE_LOW_THRESHOLD); @@ -204,7 +204,7 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[2] = static_cast(LOW_THRESHOLD & 0xFF); DeviceHandlerBase::rawPacketLen = 3; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::REQUEST_LOW_THRESHOLD): { commandBuffer[0] = static_cast(MAX31865::REQUEST_LOW_THRESHOLD); @@ -212,7 +212,7 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[2] = 0x00; // dummy byte DeviceHandlerBase::rawPacketLen = 3; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::REQUEST_RTD): { commandBuffer[0] = static_cast(MAX31865::REQUEST_RTD); @@ -221,14 +221,14 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(DeviceCommandId_t d commandBuffer[2] = 0x00; DeviceHandlerBase::rawPacketLen = 3; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (MAX31865::REQUEST_FAULT_BYTE): { commandBuffer[0] = static_cast(MAX31865::REQUEST_FAULT_BYTE); commandBuffer[1] = 0x00; DeviceHandlerBase::rawPacketLen = 2; DeviceHandlerBase::rawPacket = commandBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } default: // Unknown DeviceCommand @@ -256,7 +256,7 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t r if (remainingSize == rtdReplySize and internalState == InternalState::RUNNING) { *foundId = MAX31865::REQUEST_RTD; *foundLen = rtdReplySize; - return RETURN_OK; + return returnvalue::OK; } if (remainingSize == 3) { @@ -265,27 +265,27 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t r *foundLen = 3; *foundId = MAX31865::WRITE_HIGH_THRESHOLD; commandExecuted = true; - return RETURN_OK; + return returnvalue::OK; } case (InternalState::REQUEST_HIGH_THRESHOLD): { *foundLen = 3; *foundId = MAX31865::REQUEST_HIGH_THRESHOLD; - return RETURN_OK; + return returnvalue::OK; } case (InternalState::CONFIG_LOW_THRESHOLD): { *foundLen = 3; *foundId = MAX31865::WRITE_LOW_THRESHOLD; commandExecuted = true; - return RETURN_OK; + return returnvalue::OK; } case (InternalState::REQUEST_LOW_THRESHOLD): { *foundLen = 3; *foundId = MAX31865::REQUEST_LOW_THRESHOLD; - return RETURN_OK; + return returnvalue::OK; } default: { sif::debug << "Max31865PT1000Handler::scanForReply: Unknown internal state" << std::endl; - return RETURN_OK; + return returnvalue::OK; } } } @@ -313,7 +313,7 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, size_t r } } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, @@ -332,7 +332,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, #endif warningSwitch = false; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } // set to true for invalid configs too for now. if (internalState == InternalState::REQUEST_CONFIG) { @@ -415,7 +415,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, } PoolReadGuard pg(&sensorDataset); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg.getReadResult() != returnvalue::OK) { // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex @@ -469,7 +469,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, PoolReadGuard pg(&sensorDataset); auto result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex @@ -494,7 +494,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id, default: break; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t Max31865PT1000Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { @@ -516,7 +516,7 @@ ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(static_cast(PoolIds::FAULT_BYTE), new PoolEntry({0})); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void Max31865PT1000Handler::setInstantNormal(bool instantNormal) { diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index f059a1d7..4c00d09b 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -33,8 +33,8 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) { uint16_t dataOffset = 0; PoolReadGuard pg0(&coreHk); PoolReadGuard pg1(&auxHk); - if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or - pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg0.getReadResult() != returnvalue::OK or + pg1.getReadResult() != returnvalue::OK) { coreHk.setValidity(false, true); auxHk.setValidity(false, true); return; @@ -229,37 +229,37 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &local subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (cmd) { case (GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg0(&coreHk); PoolReadGuard pg1(&auxHk); - if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or - pg1.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg0.getReadResult() != returnvalue::OK or + pg1.getReadResult() != returnvalue::OK) { break; } printHkTableSwitchIV(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case (GOMSPACE::PRINT_LATCHUPS): { PoolReadGuard pg(&auxHk); result = pg.getReadResult(); printHkTableLatchups(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } default: { return DeviceHandlerIF::COMMAND_NOT_SUPPORTED; } } sif::warning << "Reading P60 Dock HK table failed" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void P60DockHandler::printHkTableSwitchIV() { diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 70952cea..8dc78137 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -26,9 +26,9 @@ PCDUHandler::~PCDUHandler() {} ReturnValue_t PCDUHandler::performOperation(uint8_t counter) { if (counter == DeviceHandlerIF::PERFORM_OPERATION) { readCommandQueue(); - return RETURN_OK; + return returnvalue::OK; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PCDUHandler::initialize() { @@ -40,7 +40,7 @@ ReturnValue_t PCDUHandler::initialize() { } result = poolManager.initialize(commandQueue); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } @@ -49,12 +49,12 @@ ReturnValue_t PCDUHandler::initialize() { ObjectManager::instance()->get(objects::PDU2_HANDLER); if (pdu2Handler == nullptr) { sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( static_cast(P60System::SetIds::PDU_2_CORE), this->getObjectId(), commandQueue->getId(), true); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU2Handler" << std::endl; return result; @@ -65,18 +65,18 @@ ReturnValue_t PCDUHandler::initialize() { ObjectManager::instance()->get(objects::PDU1_HANDLER); if (pdu1Handler == nullptr) { sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( static_cast(P60System::SetIds::PDU_1_CORE), this->getObjectId(), commandQueue->getId(), true); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU1Handler" << std::endl; return result; } - return RETURN_OK; + return returnvalue::OK; } void PCDUHandler::initializeSwitchStates() { @@ -95,13 +95,13 @@ void PCDUHandler::initializeSwitchStates() { } void PCDUHandler::readCommandQueue() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; CommandMessage command; - for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; + for (result = commandQueue->receiveMessage(&command); result == returnvalue::OK; result = commandQueue->receiveMessage(&command)) { result = poolManager.handleHousekeepingMessage(&command); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { continue; } } @@ -131,18 +131,18 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet const uint8_t* packet_ptr = nullptr; size_t size = 0; result = IPCStore->getData(storeId, &packet_ptr, &size); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PCDUHandler::updateHkTableDataset: Failed to get data from IPCStore." << std::endl; } result = packetUpdate.deSerialize(&packet_ptr, &size, SerializeIF::Endianness::MACHINE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PCDUHandler::updateHkTableDataset: Failed to deserialize received packet " "in hk table dataset" << std::endl; } result = IPCStore->deleteData(storeId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "PCDUHandler::updateHkTableDataset: Failed to delete data in IPCStore" << std::endl; } @@ -153,7 +153,7 @@ void PCDUHandler::updatePdu2SwitchStates() { using namespace PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; PoolReadGuard rg0(&switcherSet); - if (rg0.getReadResult() == RETURN_OK) { + if (rg0.getReadResult() == returnvalue::OK) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { switcherSet.pdu2Switches[idx] = pdu2CoreHk.outputEnables[idx]; } @@ -189,7 +189,7 @@ void PCDUHandler::updatePdu1SwitchStates() { using namespace PDU1; PoolReadGuard rg0(&switcherSet); GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1; - if (rg0.getReadResult() == RETURN_OK) { + if (rg0.getReadResult() == returnvalue::OK) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { switcherSet.pdu1Switches[idx] = pdu1CoreHk.outputEnables[idx]; } @@ -277,7 +277,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO } // This is a dangerous command. Reject/Igore it for now case pcdu::PDU2_CH0_Q7S: { - return RETURN_FAILED; + return returnvalue::FAILED; // memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_Q7S; // pdu = ObjectManager::instance()->get(objects::PDU2_HANDLER); // break; @@ -325,7 +325,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO default: { sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } } @@ -338,7 +338,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO break; default: sif::error << "PCDUHandler::sendSwitchCommand: Invalid state commanded" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } GomspaceSetParamMessage setParamMessage(memoryAddress, ¶meterValue, parameterValueSize); @@ -356,7 +356,7 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO ActionMessage::setCommand(&message, GOMSPACE::PARAM_SET, storeAddress); result = commandQueue->sendMessage(pdu->getCommandQueue(), &message, 0); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "PCDUHandler::sendSwitchCommand: Failed to send message to PDU Handler" << std::endl; } else { @@ -366,12 +366,12 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO return result; } -ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; } +ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; } ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { if (switchNr >= pcdu::NUMBER_OF_SWITCHES) { sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } pwrMutex->lockMutex(); uint8_t currentState = switchStates[switchNr]; @@ -383,7 +383,7 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const { } } -ReturnValue_t PCDUHandler::getFuseState(uint8_t fuseNr) const { return RETURN_OK; } +ReturnValue_t PCDUHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; } uint32_t PCDUHandler::getSwitchDelayMs(void) const { return 20000; } @@ -396,7 +396,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(switcherSet.getSid(), false, 5.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t PCDUHandler::initializeAfterTaskCreation() { @@ -407,7 +407,7 @@ ReturnValue_t PCDUHandler::initializeAfterTaskCreation() { initializeSwitchStates(); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t PCDUHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; } diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 9c2f845c..04ed10ca 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -34,7 +34,7 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, using namespace PDU1; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1; if (not afterExecution) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) { switch (unpacker.getAddress()) { @@ -76,7 +76,7 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, } } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void PDU1Handler::parseHkTableReply(const uint8_t *packet) { @@ -90,7 +90,7 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDat subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) { @@ -103,12 +103,12 @@ LocalPoolDataSetBase *PDU1Handler::getDataSetHandle(sid_t sid) { } ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (cmd) { case (GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&coreHk); result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } printHkTableSwitchVI(); @@ -117,7 +117,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { case (GOMSPACE::PRINT_LATCHUPS): { PoolReadGuard pg(&auxHk); result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } printHkTableLatchups(); @@ -127,7 +127,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { return DeviceHandlerIF::COMMAND_NOT_SUPPORTED; } } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "Reading PDU1 HK table failed!" << std::endl; } return result; diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 073ccb23..2a593237 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -53,16 +53,16 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDat subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (cmd) { case (GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&coreHk); result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } printHkTableSwitchVI(); @@ -71,7 +71,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { case (GOMSPACE::PRINT_LATCHUPS): { PoolReadGuard pg(&auxHk); result = pg.getReadResult(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { break; } printHkTableLatchups(); @@ -81,7 +81,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { return DeviceHandlerIF::COMMAND_NOT_SUPPORTED; } } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "Reading PDU1 HK table failed!" << std::endl; } return result; @@ -134,7 +134,7 @@ ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, using namespace PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; if (not afterExecution) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) { switch (unpacker.getAddress()) { @@ -176,5 +176,5 @@ ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, } } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index d45b2c95..e643a945 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -75,7 +75,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF" << "detected" << std::endl; setMode(MODE_OFF); - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } if (state == States::POWER_CHANNELS_ON) { #if OBSW_VERBOSE_LEVEL >= 1 @@ -146,7 +146,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_ if (doFinish) { setMode(MODE_NORMAL, submode); } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { @@ -226,7 +226,7 @@ ReturnValue_t PayloadPcduHandler::buildCommandFromCommand(DeviceCommandId_t devi return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t PayloadPcduHandler::scanForReply(const uint8_t* start, size_t remainingSize, @@ -234,7 +234,7 @@ ReturnValue_t PayloadPcduHandler::scanForReply(const uint8_t* start, size_t rema // SPI is full duplex *foundId = getPendingCommand(); *foundLen = remainingSize; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id, @@ -255,7 +255,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id, } case (READ_CMD): { PoolReadGuard pg(&adcSet); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg.getReadResult() != returnvalue::OK) { return pg.getReadResult(); } handleExtConvRead(packet); @@ -266,7 +266,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id, } case (READ_WITH_TEMP_EXT): { PoolReadGuard pg(&adcSet); - if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { + if (pg.getReadResult() != returnvalue::OK) { return pg.getReadResult(); } handleExtConvRead(packet); @@ -282,7 +282,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id, break; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { @@ -297,7 +297,7 @@ ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& l localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC); poolManager.subscribeForDiagPeriodicPacket( subdp::DiagnosticsHkPeriodicParams(adcSet.getSid(), false, 5.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void PayloadPcduHandler::setToGoToNormalModeImmediately(bool enable) { @@ -563,7 +563,7 @@ ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t (1 << DRO_ON) | (1 << SOLID_STATE_RELAYS_ADC_ON))))) { return TRANS_NOT_ALLOWED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } return DeviceHandlerBase::isModeCombinationValid(mode, submode); } @@ -635,7 +635,7 @@ ReturnValue_t PayloadPcduHandler::getParameter(uint8_t domainId, uint8_t uniqueI startAtIndex); } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void PayloadPcduHandler::handleFailureInjection(std::string output, Event event) { @@ -655,7 +655,7 @@ ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key, const ParameterWrapper* newValues) { double newValue = 0.0; ReturnValue_t result = newValues->getElement(&newValue, 0, 0); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } params.setValue(key, newValue); @@ -673,7 +673,7 @@ ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCooki if (handler == nullptr) { sif::error << "GyroADIS16507Handler::spiSendCallback: Passed handler pointer is invalid!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } DeviceCommandId_t currentCommand = handler->getPendingCommand(); switch (currentCommand) { @@ -687,18 +687,18 @@ ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCooki return comIf->performRegularSendOperation(cookie, sendData, sendLen); } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData, size_t sendLen, bool tempOnly) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = returnvalue::OK; int retval = 0; // Prepare transfer int fileDescriptor = 0; UnixFileGuard fileHelper(comIf->getSpiDev(), &fileDescriptor, O_RDWR, "SpiComIF::sendMessage"); - if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + if (fileHelper.getOpenResult() != returnvalue::OK) { return SpiComIF::OPENING_FILE_FAILED; } spi::SpiModes spiMode = spi::SpiModes::MODE_0; @@ -722,14 +722,14 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook sif::warning << "GyroADIS16507Handler::spiSendCallback: " "Mutex or GPIO interface invalid" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; #endif } if (gpioId != gpio::NO_GPIO) { cookie->getMutexParams(timeoutType, timeoutMs); result = mutex->lockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl; #endif @@ -792,7 +792,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook if (gpioId != gpio::NO_GPIO) { mutex->unlockMutex(); } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } #endif diff --git a/mission/devices/RadiationSensorHandler.cpp b/mission/devices/RadiationSensorHandler.cpp index 716b54a5..bc11bb45 100644 --- a/mission/devices/RadiationSensorHandler.cpp +++ b/mission/devices/RadiationSensorHandler.cpp @@ -43,7 +43,7 @@ ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(DeviceCommandId_t default: { sif::debug << "RadiationSensorHandler::buildNormalDeviceCommand: Unknown communication " << "step" << std::endl; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } } return buildCommandFromCommand(*id, nullptr, 0); @@ -67,11 +67,11 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t rawPacket = cmdBuffer; rawPacketLen = 1; internalState = InternalState::CONFIGURED; - return RETURN_OK; + return returnvalue::OK; } case (RAD_SENSOR::START_CONVERSION): { ReturnValue_t result = gpioIF->pullHigh(gpioIds::ENABLE_RADFET); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::warning << "RadiationSensorHandler::buildCommandFromCommand; Pulling RADFET Enale pin " "high failed" @@ -83,29 +83,29 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(DeviceCommandId_t cmdBuffer[1] = RAD_SENSOR::CONVERSION_DEFINITION; rawPacket = cmdBuffer; rawPacketLen = 2; - return RETURN_OK; + return returnvalue::OK; } case (RAD_SENSOR::READ_CONVERSIONS): { cmdBuffer[0] = RAD_SENSOR::DUMMY_BYTE; std::memset(cmdBuffer, RAD_SENSOR::DUMMY_BYTE, RAD_SENSOR::READ_SIZE); rawPacket = cmdBuffer; rawPacketLen = RAD_SENSOR::READ_SIZE; - return RETURN_OK; + return returnvalue::OK; } case RAD_SENSOR::ENABLE_DEBUG_OUTPUT: { printPeriodicData = true; rawPacketLen = 0; - return RETURN_OK; + return returnvalue::OK; } case RAD_SENSOR::DISABLE_DEBUG_OUTPUT: { rawPacketLen = 0; printPeriodicData = false; - return RETURN_OK; + return returnvalue::OK; } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void RadiationSensorHandler::fillCommandAndReplyMap() { @@ -128,7 +128,7 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t return IGNORE_REPLY_DATA; case RAD_SENSOR::READ_CONVERSIONS: { ReturnValue_t result = gpioIF->pullLow(gpioIds::ENABLE_RADFET); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::warning << "RadiationSensorHandler::scanForReply; Pulling RADFET Enale pin " "low failed" @@ -147,7 +147,7 @@ ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start, size_t *foundLen = remainingSize; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id, @@ -188,7 +188,7 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id, return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { @@ -206,7 +206,7 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry({0})); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(dataset.getSid(), false, 20.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void RadiationSensorHandler::setToGoToNormalModeImmediately() { this->goToNormalMode = true; } diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 44dbac0d..b7e26123 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -27,14 +27,14 @@ RwHandler::~RwHandler() {} void RwHandler::doStartUp() { internalState = InternalState::GET_RESET_STATUS; - if (gpioComIF->pullHigh(enableGpio) != RETURN_OK) { + if (gpioComIF->pullHigh(enableGpio) != returnvalue::OK) { sif::debug << "RwHandler::doStartUp: Failed to pull enable gpio to high"; } setMode(_MODE_TO_ON); } void RwHandler::doShutDown() { - if (gpioComIF->pullLow(enableGpio) != RETURN_OK) { + if (gpioComIF->pullLow(enableGpio) != returnvalue::OK) { sif::debug << "RwHandler::doStartUp: Failed to pull enable gpio to low"; } setMode(_MODE_POWER_DOWN); @@ -73,28 +73,28 @@ ReturnValue_t RwHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; switch (deviceCommand) { case (RwDefinitions::RESET_MCU): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::GET_LAST_RESET_STATUS): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::CLEAR_LAST_RESET_STATUS): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::GET_RW_STATUS): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::INIT_RW_CONTROLLER): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::SET_SPEED): { if (commandDataLen != 6) { @@ -103,7 +103,7 @@ ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand return SET_SPEED_COMMAND_INVALID_LENGTH; } result = checkSpeedAndRampTime(commandData, commandDataLen); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } prepareSetSpeedCmd(commandData, commandDataLen); @@ -111,16 +111,16 @@ ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand } case (RwDefinitions::GET_TEMPERATURE): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (RwDefinitions::GET_TM): { prepareSimpleCommand(deviceCommand); - return RETURN_OK; + return returnvalue::OK; } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void RwHandler::fillCommandAndReplyMap() { @@ -183,13 +183,13 @@ ReturnValue_t RwHandler::scanForReply(const uint8_t* start, size_t remainingSize default: { sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; *foundLen = remainingSize; - return RETURN_FAILED; + return returnvalue::FAILED; } } sizeOfReply = *foundLen; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t RwHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { @@ -236,7 +236,7 @@ ReturnValue_t RwHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_ } } - return RETURN_OK; + return returnvalue::OK; } uint32_t RwHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } @@ -283,7 +283,7 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP subdp::RegularHkPeriodicParams(tmDataset.getSid(), false, 30.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(lastResetStatusSet.getSid(), false, 30.0)); - return RETURN_OK; + return returnvalue::OK; } void RwHandler::prepareSimpleCommand(DeviceCommandId_t id) { @@ -311,7 +311,7 @@ ReturnValue_t RwHandler::checkSpeedAndRampTime(const uint8_t* commandData, size_ return INVALID_RAMP_TIME; } - return RETURN_OK; + return returnvalue::OK; } void RwHandler::prepareSetSpeedCmd(const uint8_t* commandData, size_t commandDataLen) { diff --git a/mission/devices/RwHandler.h b/mission/devices/RwHandler.h index ed5e957c..008d5746 100644 --- a/mission/devices/RwHandler.h +++ b/mission/devices/RwHandler.h @@ -109,7 +109,7 @@ class RwHandler : public DeviceHandlerBase { /** * @brief This function checks if the receiced speed and ramp time to set are in a valid * range. - * @return RETURN_OK if successful, otherwise error code. + * @return returnvalue::OK if successful, otherwise error code. */ ReturnValue_t checkSpeedAndRampTime(const uint8_t* commandData, size_t commandDataLen); diff --git a/mission/devices/SolarArrayDeploymentHandler.cpp b/mission/devices/SolarArrayDeploymentHandler.cpp index 2b24ba07..c4e9a43b 100644 --- a/mission/devices/SolarArrayDeploymentHandler.cpp +++ b/mission/devices/SolarArrayDeploymentHandler.cpp @@ -28,14 +28,14 @@ SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() {} ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) { if (operationCode == DeviceHandlerIF::PERFORM_OPERATION) { handleStateMachine(); - return RETURN_OK; + return returnvalue::OK; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t SolarArrayDeploymentHandler::initialize() { ReturnValue_t result = SystemObject::initialize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -46,7 +46,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { } result = gpioInterface->addGpios(dynamic_cast(gpioCookie)); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::error << "SolarArrayDeploymentHandler::initialize: Failed to initialize Gpio interface" << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; @@ -63,11 +63,11 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { } result = actionHelper.initialize(commandQueue); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } - return RETURN_OK; + return returnvalue::OK; } void SolarArrayDeploymentHandler::handleStateMachine() { @@ -119,9 +119,9 @@ void SolarArrayDeploymentHandler::performWaitOn8VActions() { } void SolarArrayDeploymentHandler::switchDeploymentTransistors() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; result = gpioInterface->pullHigh(deplSA1); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" " array deployment switch 1 high " << std::endl; @@ -133,7 +133,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() { mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); } result = gpioInterface->pullHigh(deplSA2); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" " array deployment switch 2 high " << std::endl; @@ -147,17 +147,17 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() { } void SolarArrayDeploymentHandler::handleDeploymentFinish() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; if (deploymentCountdown.hasTimedOut()) { - actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK); + actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, returnvalue::OK); result = gpioInterface->pullLow(deplSA1); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" " array deployment switch 1 low " << std::endl; } result = gpioInterface->pullLow(deplSA2); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" " array deployment switch 2 low " << std::endl; @@ -171,12 +171,12 @@ void SolarArrayDeploymentHandler::handleDeploymentFinish() { void SolarArrayDeploymentHandler::readCommandQueue() { CommandMessage command; ReturnValue_t result = commandQueue->receiveMessage(&command); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return; } result = actionHelper.handleActionMessage(&command); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { return; } } @@ -197,7 +197,7 @@ ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId, } else { stateMachine = SWITCH_8V_ON; rememberCommanderId = commandedBy; - result = RETURN_OK; + result = returnvalue::OK; } return result; } diff --git a/mission/devices/SolarArrayDeploymentHandler.h b/mission/devices/SolarArrayDeploymentHandler.h index d66a0509..691bdf77 100644 --- a/mission/devices/SolarArrayDeploymentHandler.h +++ b/mission/devices/SolarArrayDeploymentHandler.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -21,7 +21,6 @@ */ class SolarArrayDeploymentHandler : public ExecutableObjectIF, public SystemObject, - public HasReturnvaluesIF, public HasActionsIF { public: static const DeviceCommandId_t DEPLOY_SOLAR_ARRAYS = 0x5; diff --git a/mission/devices/SusHandler.cpp b/mission/devices/SusHandler.cpp index 102613c7..73a8344f 100644 --- a/mission/devices/SusHandler.cpp +++ b/mission/devices/SusHandler.cpp @@ -127,7 +127,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void SusHandler::fillCommandAndReplyMap() { @@ -144,7 +144,7 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSiz DeviceCommandId_t *foundId, size_t *foundLen) { *foundId = this->getPendingCommand(); *foundLen = remainingSize; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { @@ -153,10 +153,10 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 if (mode == _MODE_START_UP) { commandExecuted = true; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case SUS::START_INT_TIMED_CONVERSIONS: { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } case SUS::READ_INT_TIMED_CONVERSIONS: { PoolReadGuard readSet(&dataset); @@ -193,7 +193,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8 return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 3000; } @@ -204,7 +204,7 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec); poolManager.subscribeForDiagPeriodicPacket( subdp::DiagnosticsHkPeriodicParams(dataset.getSid(), false, 5.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; } diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index 67a015ec..1b4af19f 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -99,86 +99,86 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic switch (deviceCommand) { case (syrlinks::RESET_UNIT): { prepareCommand(resetCommand, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::SET_TX_MODE_STANDBY): { prepareCommand(setTxModeStandby, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::SET_TX_MODE_MODULATION): { prepareCommand(setTxModeModulation, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::SET_TX_MODE_CW): { prepareCommand(setTxModeCw, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::WRITE_LCL_CONFIG): { prepareCommand(writeLclConfig, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_RX_STATUS_REGISTERS): { prepareCommand(readRxStatusRegCommand, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_LCL_CONFIG): { prepareCommand(readLclConfig, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_TX_STATUS): { prepareCommand(readTxStatus, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_TX_WAVEFORM): { prepareCommand(readTxWaveform, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_TX_AGC_VALUE_HIGH_BYTE): { prepareCommand(readTxAgcValueHighByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::READ_TX_AGC_VALUE_LOW_BYTE): { prepareCommand(readTxAgcValueLowByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE): { prepareCommand(tempPowerAmpBoardHighByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE): { prepareCommand(tempPowerAmpBoardLowByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE): { prepareCommand(tempBasebandBoardHighByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE): { prepareCommand(tempBasebandBoardLowByte, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::CONFIG_BPSK): { prepareCommand(configBPSK, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::CONFIG_OQPSK): { prepareCommand(configOQPSK, deviceCommand); - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::ENABLE_DEBUG): { debugMode = true; rawPacketLen = 0; - return RETURN_OK; + return returnvalue::OK; } case (syrlinks::DISABLE_DEBUG): { debugMode = false; rawPacketLen = 0; - return RETURN_OK; + return returnvalue::OK; } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void SyrlinksHkHandler::fillCommandAndReplyMap() { @@ -222,7 +222,7 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() { ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; if (*start != '<') { sif::warning << "SyrlinksHkHandler::scanForReply: Missing start frame character" << std::endl; @@ -257,7 +257,7 @@ ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t* } *numberOfSwitches = 1; *switches = &powerSwitch; - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { @@ -266,21 +266,21 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons switch (id) { case (syrlinks::ACK_REPLY): { result = verifyReply(packet, syrlinks::ACK_SIZE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgment reply has " "invalid crc" << std::endl; return CRC_FAILURE; } result = handleAckReply(packet); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } break; } case (syrlinks::READ_RX_STATUS_REGISTERS): { result = verifyReply(packet, syrlinks::RX_STATUS_REGISTERS_REPLY_SIZE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read rx status registers reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -290,7 +290,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::READ_LCL_CONFIG): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read config lcl reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -300,7 +300,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::READ_TX_STATUS): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx status reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -310,7 +310,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::READ_TX_WAVEFORM): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx waveform reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -320,7 +320,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::READ_TX_AGC_VALUE_HIGH_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC high byte reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -330,7 +330,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::READ_TX_AGC_VALUE_LOW_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read tx AGC low byte reply " << "has invalid crc" << std::endl; return CRC_FAILURE; @@ -340,7 +340,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::TEMP_BASEBAND_BOARD_HIGH_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board " << "high byte reply has invalid crc" << std::endl; return CRC_FAILURE; @@ -352,7 +352,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::TEMP_BASEBAND_BOARD_LOW_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature baseband board" " low byte reply has invalid crc" << std::endl; @@ -371,7 +371,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::TEMP_POWER_AMPLIFIER_HIGH_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier " << "board high byte reply has invalid crc" << std::endl; return CRC_FAILURE; @@ -384,7 +384,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (syrlinks::TEMP_POWER_AMPLIFIER_LOW_BYTE): { result = verifyReply(packet, syrlinks::READ_ONE_REGISTER_REPLY_SIE); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "SyrlinksHkHandler::interpretDeviceReply: Read temperature power amplifier" << " board low byte reply has invalid crc" << std::endl; return CRC_FAILURE; @@ -406,7 +406,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons } } - return RETURN_OK; + return returnvalue::OK; } LocalPoolDataSetBase* SyrlinksHkHandler::getDataSetHandle(sid_t sid) { @@ -469,7 +469,7 @@ uint32_t SyrlinksHkHandler::convertHexStringToUint32(const char* characters, ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { switch (*status) { case '0': - return RETURN_OK; + return returnvalue::OK; case '1': sif::debug << "SyrlinksHkHandler::parseReplyStatus: Uart framing or parity error" << std::endl; @@ -494,7 +494,7 @@ ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { default: sif::debug << "SyrlinksHkHandler::parseReplyStatus: Status reply contains an invalid " << "status id" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } } @@ -513,9 +513,9 @@ ReturnValue_t SyrlinksHkHandler::verifyReply(const uint8_t* packet, uint8_t size result = recalculatedCrc.compare(replyCrc); if (result != 0) { - return RETURN_FAILED; + return returnvalue::FAILED; } - return RETURN_OK; + return returnvalue::OK; } void SyrlinksHkHandler::parseRxStatusRegistersReply(const uint8_t* packet) { @@ -627,7 +627,7 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo subdp::DiagnosticsHkPeriodicParams(rxDataset.getSid(), false, 5.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(temperatureSet.getSid(), false, 10.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void SyrlinksHkHandler::setModeNormal() { mode = MODE_NORMAL; } @@ -637,9 +637,9 @@ float SyrlinksHkHandler::calcTempVal(uint16_t raw) { return 0.126984 * raw - 67. ReturnValue_t SyrlinksHkHandler::handleAckReply(const uint8_t* packet) { ReturnValue_t result = parseReplyStatus(reinterpret_cast(packet + syrlinks::MESSAGE_HEADER_SIZE)); - if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result != RETURN_OK) { + if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result != returnvalue::OK) { startupState = StartupState::OFF; - } else if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result == RETURN_OK) { + } else if (rememberCommandId == syrlinks::WRITE_LCL_CONFIG and result == returnvalue::OK) { startupState = StartupState::DONE; } return result; diff --git a/mission/devices/SyrlinksHkHandler.h b/mission/devices/SyrlinksHkHandler.h index e21cfd3a..44b154f6 100644 --- a/mission/devices/SyrlinksHkHandler.h +++ b/mission/devices/SyrlinksHkHandler.h @@ -172,7 +172,7 @@ class SyrlinksHkHandler : public DeviceHandlerBase { * @param size Size of the whole packet including the crc and the packet termination * character '>'. * - * @return RETURN_OK if successful, otherwise RETURN_FAILED. + * @return returnvalue::OK if successful, otherwise returnvalue::FAILED. */ ReturnValue_t verifyReply(const uint8_t* packet, uint8_t size); diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index 995b4f81..83a4643b 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -29,11 +29,11 @@ ReturnValue_t Tmp1075Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) { communicationStep = CommunicationStep::START_ADC_CONVERSION; return buildCommandFromCommand(*id, NULL, 0); } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t Tmp1075Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t Tmp1075Handler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, @@ -45,7 +45,7 @@ ReturnValue_t Tmp1075Handler::buildCommandFromCommand(DeviceCommandId_t deviceCo prepareAdcConversionCommand(); rawPacket = cmdBuffer; rawPacketLen = TMP1075::CFGR_CMD_SIZE; - return RETURN_OK; + return returnvalue::OK; } case (TMP1075::GET_TEMP): { std::memset(cmdBuffer, 0, sizeof(cmdBuffer)); @@ -53,12 +53,12 @@ ReturnValue_t Tmp1075Handler::buildCommandFromCommand(DeviceCommandId_t deviceCo rawPacket = cmdBuffer; rawPacketLen = TMP1075::POINTER_REG_SIZE; rememberCommandId = TMP1075::GET_TEMP; - return RETURN_OK; + return returnvalue::OK; } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } void Tmp1075Handler::fillCommandAndReplyMap() { @@ -77,7 +77,7 @@ ReturnValue_t Tmp1075Handler::scanForReply(const uint8_t *start, size_t remainin default: return IGNORE_REPLY_DATA; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { @@ -91,7 +91,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, const u << ": Temperature: " << tempValue << " °C" << std::endl; #endif ReturnValue_t result = dataset.read(); - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { dataset.temperatureCelcius = tempValue; dataset.setValidity(true, true); dataset.commit(); @@ -105,7 +105,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, const u return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void Tmp1075Handler::setNormalDatapoolEntriesInvalid() {} @@ -125,5 +125,5 @@ ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &local localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry({0.0})); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(dataset.getSid(), false, 30.0)); - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h index 54d4e1f8..eb19529b 100644 --- a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h +++ b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h @@ -133,43 +133,43 @@ class BpxBatteryHk : public StaticLocalDataSet { size_t remSize = size; ReturnValue_t result = chargeCurrent.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = dischargeCurrent.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = heaterCurrent.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = battVoltage.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = battTemp1.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = battTemp2.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = battTemp3.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = battTemp4.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = rebootCounter.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = bootcause.deSerialize(&data, &remSize, SerializeIF::Endianness::NETWORK); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } return result; @@ -225,7 +225,7 @@ class BpxBatteryCfg : public StaticLocalDataSet { battheatermode.value = data[0]; battheaterLow.value = data[1]; battheaterHigh.value = data[2]; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } //! Mode for battheater [0=OFF,1=Auto] diff --git a/mission/devices/devicedefinitions/SpBase.h b/mission/devices/devicedefinitions/SpBase.h index ef1f70b8..2bcaa1dc 100644 --- a/mission/devices/devicedefinitions/SpBase.h +++ b/mission/devices/devicedefinitions/SpBase.h @@ -54,7 +54,7 @@ class SpTcBase { return SerializeIF::BUFFER_TOO_SHORT; } - return result::OK; + return returnvalue::OK; } ReturnValue_t serializeHeader() { @@ -65,7 +65,7 @@ class SpTcBase { ReturnValue_t checkSizeAndSerializeHeader() { ReturnValue_t result = checkPayloadLen(); - if (result != result::OK) { + if (result != returnvalue::OK) { return result; } return serializeHeader(); @@ -108,9 +108,9 @@ class SpTmReader : public SpacePacketReader { ReturnValue_t checkCrc() { if (CRC::crc16ccitt(getFullData(), getFullPacketLen()) != 0) { - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } }; diff --git a/mission/devices/devicedefinitions/payloadPcduDefinitions.h b/mission/devices/devicedefinitions/payloadPcduDefinitions.h index ab387fc7..2730d1cb 100644 --- a/mission/devices/devicedefinitions/payloadPcduDefinitions.h +++ b/mission/devices/devicedefinitions/payloadPcduDefinitions.h @@ -195,7 +195,7 @@ class PlPcduParameter : public NVMParameterBase { ReturnValue_t initialize(std::string mountPrefix) { setFullName(mountPrefix + "/conf/plpcdu.json"); ReturnValue_t result = readJsonFile(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { // File does not exist or reading JSON failed for various reason. Rewrite the JSON file #if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Creating PL PCDU JSON file at " << getFullName() << std::endl; @@ -203,7 +203,7 @@ class PlPcduParameter : public NVMParameterBase { resetValues(); writeJsonFile(); } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void resetValues() { insertValue(PARAM_KEY_MAP[SSR_TO_DRO_WAIT_TIME], DFT_SSR_TO_DRO_WAIT_TIME); diff --git a/mission/memory/NVMParameterBase.cpp b/mission/memory/NVMParameterBase.cpp index 78f40525..38fa45bb 100644 --- a/mission/memory/NVMParameterBase.cpp +++ b/mission/memory/NVMParameterBase.cpp @@ -15,9 +15,9 @@ ReturnValue_t NVMParameterBase::readJsonFile() { i >> json; } catch (nlohmann::json::exception& e) { sif::warning << "Reading JSON file failed with error " << e.what() << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } return HasFileSystemIF::FILE_DOES_NOT_EXIST; } @@ -28,9 +28,9 @@ ReturnValue_t NVMParameterBase::writeJsonFile() { o << std::setw(4) << json << std::endl; } catch (nlohmann::json::exception& e) { sif::warning << "Writing JSON file failed with error " << e.what() << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void NVMParameterBase::setFullName(std::string fullName) { this->fullName = fullName; } diff --git a/mission/memory/NVMParameterBase.h b/mission/memory/NVMParameterBase.h index eb839905..4f644fcc 100644 --- a/mission/memory/NVMParameterBase.h +++ b/mission/memory/NVMParameterBase.h @@ -5,9 +5,9 @@ #include #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" -class NVMParameterBase : public HasReturnvaluesIF { +class NVMParameterBase { public: virtual ~NVMParameterBase() {} @@ -16,7 +16,7 @@ class NVMParameterBase : public HasReturnvaluesIF { bool getJsonFileExists(); /** - * Returns RETURN_OK on successfull read and HasFileSystemIF::FILE_DOES_NOT_EXIST if + * Returns returnvalue::OK on successfull read and HasFileSystemIF::FILE_DOES_NOT_EXIST if * file does not exist yet. * @return */ @@ -57,13 +57,13 @@ inline ReturnValue_t NVMParameterBase::insertValue(std::string key, T value) { keys.push_back(key); } json[key] = value; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } template inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) { json[key] = value; - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } template @@ -72,7 +72,7 @@ inline ReturnValue_t NVMParameterBase::getValue(std::string key, T& value) const return KEY_NOT_EXISTS; } value = json[key]; - return RETURN_OK; + return returnvalue::OK; } #endif /* BSP_Q7S_CORE_NVMPARAMS_NVMPARAMIF_H_ */ diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/AcsBoardAssembly.cpp index 5e9076b2..6a59183c 100644 --- a/mission/system/AcsBoardAssembly.cpp +++ b/mission/system/AcsBoardAssembly.cpp @@ -35,7 +35,7 @@ AcsBoardAssembly::AcsBoardAssembly(object_id_t objectId, object_id_t parentId, ReturnValue_t AcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode) { using namespace duallane; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; refreshHelperModes(); // Initialize the mode table to ensure all devices are in a defined state modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF); @@ -75,14 +75,14 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ helper.gpsMode != MODE_ON) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } - return RETURN_OK; + return returnvalue::OK; } else if (wantedSubmode == B_SIDE) { if ((helper.gyro2SideBMode != wantedMode and helper.gyro3SideBMode != wantedMode) or (helper.mgm2SideBMode != wantedMode and helper.mgm3SideBMode != wantedMode) or helper.gpsMode != MODE_ON) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } - return RETURN_OK; + return returnvalue::OK; } else if (wantedSubmode == DUAL_MODE) { if ((helper.gyro0SideAMode != wantedMode and helper.gyro1SideAMode != wantedMode and helper.gyro2AdisIdSideB != wantedMode and helper.gyro3SideBMode != wantedMode) or @@ -94,16 +94,16 @@ ReturnValue_t AcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ triggerEvent(NOT_ENOUGH_DEVICES_DUAL_MODE, 0, 0); dualModeErrorSwitch = false; } - return RETURN_OK; + return returnvalue::OK; } - return RETURN_OK; + return returnvalue::OK; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { using namespace duallane; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; bool needsSecondStep = false; auto cmdSeq = [&](object_id_t objectId, Mode_t devMode, ModeTableIdx tableIdx) { if (mode == devMode) { @@ -190,7 +190,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.gyro3L3gIdSideB, helper.gyro3SideBMode, ModeTableIdx::GYRO_3_B); cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); - ReturnValue_t status = RETURN_OK; + ReturnValue_t status = returnvalue::OK; if (gpsUsable) { gpioHandler(gpioIds::GNSS_0_NRESET, true, "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" @@ -203,7 +203,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s } else { status = gpioIF->pullHigh(gpioIds::GNSS_SELECT); } - if (status != HasReturnvaluesIF::RETURN_OK) { + if (status != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select to" "default side for dual mode" @@ -232,13 +232,13 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) { if (submode != Submodes::DUAL_MODE) { return; } - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; if (side == Submodes::A_SIDE) { result = gpioIF->pullLow(gpioIds::GNSS_SELECT); } else { result = gpioIF->pullHigh(gpioIds::GNSS_SELECT); } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << "AcsBoardAssembly::switchGpsInDualMode: Switching GPS failed" << std::endl; #endif @@ -246,13 +246,13 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) { } void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; if (high) { result = gpioIF->pullHigh(gpio); } else { result = gpioIF->pullLow(gpio); } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if OBSW_VERBOSE_LEVEL >= 1 sif::error << error << std::endl; #endif @@ -277,39 +277,39 @@ void AcsBoardAssembly::refreshHelperModes() { ReturnValue_t AcsBoardAssembly::initialize() { ReturnValue_t result = registerChild(helper.gyro0AdisIdSideA); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.gyro1L3gIdSideA); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.gyro2AdisIdSideB); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.gyro3L3gIdSideB); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.mgm0Lis3IdSideA); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.mgm1Rm3100IdSideA); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.mgm2Lis3IdSideB); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.mgm3Rm3100IdSideB); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = registerChild(helper.gpsId); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } return AssemblyBase::initialize(); diff --git a/mission/system/DualLaneAssemblyBase.cpp b/mission/system/DualLaneAssemblyBase.cpp index 020ce1ff..f9ca44fe 100644 --- a/mission/system/DualLaneAssemblyBase.cpp +++ b/mission/system/DualLaneAssemblyBase.cpp @@ -68,7 +68,7 @@ ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() { OpCodes opCode = pwrStateMachine.fsm(); if (customRecoveryStates == RecoveryCustomStates::IDLE) { if (opCode == OpCodes::NONE) { - return RETURN_OK; + return returnvalue::OK; } else if (opCode == OpCodes::TO_OFF_DONE) { // Will be called for transitions to MODE_OFF, where everything is done after power switching finishModeOp(); @@ -85,17 +85,17 @@ ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() { sif::warning << "Timeout occured in power state machine" << std::endl; #endif triggerEvent(pwrTimeoutEvent, 0, 0); - return RETURN_FAILED; + return returnvalue::FAILED; } } } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_t submode) { using namespace duallane; if (submode != A_SIDE and submode != B_SIDE and submode != DUAL_MODE) { - return HasReturnvaluesIF::RETURN_FAILED; + return returnvalue::FAILED; } if (sideSwitchTransition(mode, submode)) { // I could implement this but this would increase the already high complexity. This is not @@ -104,7 +104,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_ triggerEvent(SIDE_SWITCH_TRANSITION_NOT_ALLOWED_ID, 0, 0); return TRANS_NOT_ALLOWED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } void DualLaneAssemblyBase::handleModeReached() { diff --git a/mission/system/DualLanePowerStateMachine.cpp b/mission/system/DualLanePowerStateMachine.cpp index 5669ef7d..2af2fc38 100644 --- a/mission/system/DualLanePowerStateMachine.cpp +++ b/mission/system/DualLanePowerStateMachine.cpp @@ -11,8 +11,8 @@ DualLanePowerStateMachine::DualLanePowerStateMachine(power::Switch_t switchA, power::OpCodes DualLanePowerStateMachine::fsm() { using namespace duallane; - ReturnValue_t switchStateA = RETURN_OK; - ReturnValue_t switchStateB = RETURN_OK; + ReturnValue_t switchStateA = returnvalue::OK; + ReturnValue_t switchStateB = returnvalue::OK; if (state == power::States::IDLE or state == power::States::MODE_COMMANDING) { return opResult; } diff --git a/mission/system/PowerStateMachineBase.h b/mission/system/PowerStateMachineBase.h index 3adeebb6..12e72b60 100644 --- a/mission/system/PowerStateMachineBase.h +++ b/mission/system/PowerStateMachineBase.h @@ -7,7 +7,7 @@ #include "definitions.h" -class PowerStateMachineBase : public HasReturnvaluesIF { +class PowerStateMachineBase { public: PowerStateMachineBase(PowerSwitchIF* pwrSwitcher, dur_millis_t checkTimeout); diff --git a/mission/system/RwAssembly.cpp b/mission/system/RwAssembly.cpp index 7149747e..6e393034 100644 --- a/mission/system/RwAssembly.cpp +++ b/mission/system/RwAssembly.cpp @@ -31,7 +31,7 @@ void RwAssembly::performChildOperation() { } ReturnValue_t RwAssembly::commandChildren(Mode_t mode, Submode_t submode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; modeTransitionFailedSwitch = true; // Initialize the mode table to ensure all devices are in a defined state for (uint8_t idx = 0; idx < NUMBER_RWS; idx++) { @@ -67,12 +67,12 @@ ReturnValue_t RwAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t want } return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t RwAssembly::isModeCombinationValid(Mode_t mode, Submode_t submode) { if (mode == MODE_ON or mode == MODE_OFF or mode == DeviceHandlerIF::MODE_NORMAL) { - return RETURN_OK; + return returnvalue::OK; } return HasModesIF::INVALID_MODE; } @@ -112,7 +112,7 @@ void RwAssembly::handleChildrenLostMode(ReturnValue_t result) { } ReturnValue_t RwAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; bool needsSecondStep = false; Mode_t devMode = 0; object_id_t objId = 0; @@ -168,10 +168,10 @@ bool RwAssembly::isUseable(object_id_t object, Mode_t mode) { } ReturnValue_t RwAssembly::initialize() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; for (const auto& obj : helper.rwIds) { result = registerChild(obj); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } } diff --git a/mission/system/SusAssembly.cpp b/mission/system/SusAssembly.cpp index 56b0dba8..472a6580 100644 --- a/mission/system/SusAssembly.cpp +++ b/mission/system/SusAssembly.cpp @@ -18,7 +18,7 @@ SusAssembly::SusAssembly(object_id_t objectId, object_id_t parentId, PowerSwitch } ReturnValue_t SusAssembly::commandChildren(Mode_t mode, Submode_t submode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; refreshHelperModes(); // Initialize the mode table to ensure all devices are in a defined state for (uint8_t idx = 0; idx < NUMBER_SUN_SENSORS; idx++) { @@ -38,7 +38,7 @@ ReturnValue_t SusAssembly::commandChildren(Mode_t mode, Submode_t submode) { ReturnValue_t SusAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { using namespace duallane; - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; bool needsSecondStep = false; auto cmdSeq = [&](object_id_t objectId, Mode_t devMode, uint8_t tableIdx) { if (mode == devMode) { @@ -104,28 +104,28 @@ ReturnValue_t SusAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wan return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } } - return RETURN_OK; + return returnvalue::OK; } else if (wantedSubmode == B_SIDE) { for (uint8_t idx = NUMBER_SUN_SENSORS_ONE_SIDE; idx < NUMBER_SUN_SENSORS; idx++) { if (helper.susModes[idx] != wantedMode) { return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } } - return RETURN_OK; + return returnvalue::OK; } else { // Trigger event if devices are faulty? This is the last fallback mode, returning // a failure here would trigger a transition to MODE_OFF unless handleModeTransitionFailed // is overriden - return RETURN_OK; + return returnvalue::OK; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t SusAssembly::initialize() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; for (const auto& id : helper.susIds) { result = registerChild(id); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } } diff --git a/mission/system/TcsBoardAssembly.cpp b/mission/system/TcsBoardAssembly.cpp index f973335e..c753504b 100644 --- a/mission/system/TcsBoardAssembly.cpp +++ b/mission/system/TcsBoardAssembly.cpp @@ -36,7 +36,7 @@ void TcsBoardAssembly::performChildOperation() { } ReturnValue_t TcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; // Initialize the mode table to ensure all devices are in a defined state for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) { modeTable[idx].setMode(MODE_OFF); @@ -80,21 +80,21 @@ ReturnValue_t TcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_ warningSwitch = false; } } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t TcsBoardAssembly::isModeCombinationValid(Mode_t mode, Submode_t submode) { if (mode == MODE_ON or mode == MODE_OFF or mode == DeviceHandlerIF::MODE_NORMAL) { - return RETURN_OK; + return returnvalue::OK; } return HasModesIF::INVALID_MODE; } ReturnValue_t TcsBoardAssembly::initialize() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; for (const auto& obj : helper.rtdInfos) { result = registerChild(obj.first); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } } @@ -119,7 +119,7 @@ void TcsBoardAssembly::startTransition(Mode_t mode, Submode_t submode) { } ReturnValue_t TcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; bool needsSecondStep = false; Mode_t devMode = 0; object_id_t objId = 0; diff --git a/mission/system/fdir/GomspacePowerFdir.cpp b/mission/system/fdir/GomspacePowerFdir.cpp index f7475491..5d35ca24 100644 --- a/mission/system/fdir/GomspacePowerFdir.cpp +++ b/mission/system/fdir/GomspacePowerFdir.cpp @@ -14,9 +14,9 @@ GomspacePowerFdir::GomspacePowerFdir(object_id_t devId, object_id_t parentId) ReturnValue_t GomspacePowerFdir::eventReceived(EventMessage* event) { if (isFdirInActionOrAreWeFaulty(event)) { - return RETURN_OK; + return returnvalue::OK; } - ReturnValue_t result = RETURN_FAILED; + ReturnValue_t result = returnvalue::FAILED; switch (event->getEvent()) { case HasModesIF::MODE_TRANSITION_FAILED: case HasModesIF::OBJECT_IN_INVALID_MODE: @@ -42,7 +42,7 @@ ReturnValue_t GomspacePowerFdir::eventReceived(EventMessage* event) { // The two above should never be confirmed. case DeviceHandlerIF::DEVICE_MISSED_REPLY: result = sendConfirmationRequest(event); - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { break; } // else @@ -67,7 +67,7 @@ ReturnValue_t GomspacePowerFdir::eventReceived(EventMessage* event) { case PowerSwitchIF::SWITCH_WENT_OFF: if (powerConfirmation != MessageQueueIF::NO_QUEUE) { result = sendConfirmationRequest(event, powerConfirmation); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { setFdirState(DEVICE_MIGHT_BE_OFF); } } @@ -102,9 +102,9 @@ ReturnValue_t GomspacePowerFdir::eventReceived(EventMessage* event) { // break; default: // We don't know the event, someone else should handle it. - return RETURN_FAILED; + return returnvalue::FAILED; } - return RETURN_OK; + return returnvalue::OK; } void GomspacePowerFdir::eventConfirmed(EventMessage* event) { diff --git a/mission/system/fdir/SyrlinksFdir.cpp b/mission/system/fdir/SyrlinksFdir.cpp index c35427db..524a94f6 100644 --- a/mission/system/fdir/SyrlinksFdir.cpp +++ b/mission/system/fdir/SyrlinksFdir.cpp @@ -14,9 +14,9 @@ SyrlinksFdir::SyrlinksFdir(object_id_t syrlinksId) ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { if (isFdirInActionOrAreWeFaulty(event)) { - return RETURN_OK; + return returnvalue::OK; } - ReturnValue_t result = RETURN_FAILED; + ReturnValue_t result = returnvalue::FAILED; switch (event->getEvent()) { case HasModesIF::MODE_TRANSITION_FAILED: case HasModesIF::OBJECT_IN_INVALID_MODE: @@ -42,7 +42,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { // The two above should never be confirmed. case DeviceHandlerIF::DEVICE_MISSED_REPLY: result = sendConfirmationRequest(event); - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { break; } // else @@ -67,7 +67,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { case PowerSwitchIF::SWITCH_WENT_OFF: if (powerConfirmation != MessageQueueIF::NO_QUEUE) { result = sendConfirmationRequest(event, powerConfirmation); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { setFdirState(DEVICE_MIGHT_BE_OFF); } } @@ -102,9 +102,9 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { // break; default: // We don't know the event, someone else should handle it. - return RETURN_FAILED; + return returnvalue::FAILED; } - return RETURN_OK; + return returnvalue::OK; } void SyrlinksFdir::eventConfirmed(EventMessage* event) { diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index 43cdc2bc..06499ff6 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -38,7 +38,7 @@ ReturnValue_t CCSDSHandler::performOperation(uint8_t operationCode) { handleTelemetry(); handleTelecommands(); checkTxTimer(); - return RETURN_OK; + return returnvalue::OK; } void CCSDSHandler::handleTelemetry() { @@ -51,7 +51,7 @@ void CCSDSHandler::handleTelemetry() { void CCSDSHandler::handleTelecommands() {} ReturnValue_t CCSDSHandler::initialize() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; PtmeIF* ptme = ObjectManager::instance()->get(ptmeId); if (ptme == nullptr) { sif::warning << "Invalid PTME object" << std::endl; @@ -70,19 +70,19 @@ ReturnValue_t CCSDSHandler::initialize() { tcDistributorQueueId = tcDistributor->getRequestQueue(); result = parameterHelper.initialize(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } result = actionHelper.initialize(commandQueue); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } VirtualChannelMapIter iter; for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) { result = iter->second->initialize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } iter->second->setPtmeObject(ptme); @@ -96,7 +96,7 @@ ReturnValue_t CCSDSHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } result = manager->registerListener(eventQueue->getId()); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "CCSDSHandler::initialize: Failed to register CCSDS handler as event " "listener" @@ -108,7 +108,7 @@ ReturnValue_t CCSDSHandler::initialize() { result = manager->subscribeToEventRange(eventQueue->getId(), event::getEventId(PdecHandler::CARRIER_LOCK), event::getEventId(PdecHandler::BIT_LOCK_PDEC)); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "CCSDSHandler::initialize: Failed to subscribe to events from PDEC " "handler" @@ -117,11 +117,11 @@ ReturnValue_t CCSDSHandler::initialize() { return result; } result = ptmeConfig->initialize(); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -138,16 +138,16 @@ ReturnValue_t CCSDSHandler::initialize() { void CCSDSHandler::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 = parameterHelper.handleParameterMessage(&commandMessage); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { return; } result = actionHelper.handleActionMessage(&commandMessage); - if (result == RETURN_OK) { + if (result == returnvalue::OK) { return; } CommandMessage reply; @@ -200,7 +200,7 @@ MessageQueueId_t CCSDSHandler::getReportReceptionQueue(uint8_t virtualChannel) { ReturnValue_t CCSDSHandler::getParameter(uint8_t domainId, uint8_t uniqueIdentifier, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) { - return RETURN_OK; + return returnvalue::OK; } uint16_t CCSDSHandler::getIdentifier() { return 0; } @@ -212,7 +212,7 @@ MessageQueueId_t CCSDSHandler::getRequestQueue() { ReturnValue_t CCSDSHandler::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 SET_LOW_RATE: { result = ptmeConfig->setRate(RATE_100KBPS); @@ -255,7 +255,7 @@ ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId, MessageQueueId_t default: return COMMAND_NOT_IMPLEMENTED; } - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } return EXECUTION_FINISHED; @@ -263,7 +263,7 @@ ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId, MessageQueueId_t void CCSDSHandler::checkEvents() { 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: diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index c8afa69a..31a546b5 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -10,7 +10,7 @@ #include "fsfw/events/EventMessage.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/parameters/ParameterHelper.h" -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/timemanager/Countdown.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" @@ -32,7 +32,6 @@ class CCSDSHandler : public SystemObject, public ExecutableObjectIF, public AcceptsTelemetryIF, public AcceptsTelecommandsIF, - public HasReturnvaluesIF, public ReceivesParameterMessagesIF, public HasActionsIF { public: diff --git a/mission/tmtc/TmFunnel.cpp b/mission/tmtc/TmFunnel.cpp index c23da16d..f3543404 100644 --- a/mission/tmtc/TmFunnel.cpp +++ b/mission/tmtc/TmFunnel.cpp @@ -32,16 +32,16 @@ MessageQueueId_t TmFunnel::getReportReceptionQueue(uint8_t virtualChannel) { ReturnValue_t TmFunnel::performOperation(uint8_t operationCode) { TmTcMessage currentMessage; ReturnValue_t status = tmQueue->receiveMessage(¤tMessage); - while (status == HasReturnvaluesIF::RETURN_OK) { + while (status == returnvalue::OK) { status = handlePacket(¤tMessage); - if (status != HasReturnvaluesIF::RETURN_OK) { + if (status != returnvalue::OK) { break; } status = tmQueue->receiveMessage(¤tMessage); } if (status == MessageQueueIF::EMPTY) { - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } else { return status; } @@ -51,13 +51,13 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { uint8_t* packetData = nullptr; size_t size = 0; ReturnValue_t result = tmStore->modifyData(message->getStorageId(), &packetData, &size); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } PusTmZeroCopyWriter packet(timeReader, packetData, size); result = packet.parseDataWithoutCrcCheck(); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { return result; } packet.setSequenceCount(sourceSequenceCount++); @@ -65,7 +65,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { packet.updateErrorControl(); result = tmQueue->sendToDefault(message); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { tmStore->deleteData(message->getStorageId()); sif::error << "TmFunnel::handlePacket: Error sending to downlink " "handler" @@ -75,7 +75,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { if (storageDestination != objects::NO_OBJECT) { result = storageQueue->sendToDefault(message); - if (result != HasReturnvaluesIF::RETURN_OK) { + if (result != returnvalue::OK) { tmStore->deleteData(message->getStorageId()); sif::error << "TmFunnel::handlePacket: Error sending to storage " "handler" diff --git a/mission/tmtc/VirtualChannel.cpp b/mission/tmtc/VirtualChannel.cpp index 9d413ca7..46ba3fe3 100644 --- a/mission/tmtc/VirtualChannel.cpp +++ b/mission/tmtc/VirtualChannel.cpp @@ -18,21 +18,21 @@ ReturnValue_t VirtualChannel::initialize() { tmStore = ObjectManager::instance()->get(objects::TM_STORE); if (tmStore == nullptr) { sif::error << "VirtualChannel::initialize: Failed to get tm store" << std::endl; - return RETURN_FAILED; + return returnvalue::FAILED; } - return RETURN_OK; + return returnvalue::OK; } ReturnValue_t VirtualChannel::performOperation() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; TmTcMessage message; - while (tmQueue->receiveMessage(&message) == RETURN_OK) { + while (tmQueue->receiveMessage(&message) == returnvalue::OK) { store_address_t storeId = message.getStorageId(); const uint8_t* data = nullptr; size_t size = 0; result = tmStore->getData(storeId, &data, &size); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "VirtualChannel::performOperation: Failed to read data from IPC store" << std::endl; tmStore->deleteData(storeId); @@ -45,7 +45,7 @@ ReturnValue_t VirtualChannel::performOperation() { tmStore->deleteData(storeId); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { return result; } } diff --git a/mission/tmtc/VirtualChannel.h b/mission/tmtc/VirtualChannel.h index 229bcc40..a47a3d59 100644 --- a/mission/tmtc/VirtualChannel.h +++ b/mission/tmtc/VirtualChannel.h @@ -5,7 +5,7 @@ #include #include "OBSWConfig.h" -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" class StorageManagerIF; @@ -16,7 +16,7 @@ class StorageManagerIF; * * @author J. Meier */ -class VirtualChannel : public AcceptsTelemetryIF, public HasReturnvaluesIF { +class VirtualChannel : public AcceptsTelemetryIF { public: /** * @brief Constructor diff --git a/mission/utility/Timestamp.cpp b/mission/utility/Timestamp.cpp index 095bd28c..030be5c6 100644 --- a/mission/utility/Timestamp.cpp +++ b/mission/utility/Timestamp.cpp @@ -4,7 +4,7 @@ Timestamp::Timestamp() { ReturnValue_t result = Clock::getDateAndTime(&time); - if (result != RETURN_OK) { + if (result != returnvalue::OK) { sif::warning << "Timestamp::Timestamp: Failed to get time" << std::endl; } } diff --git a/mission/utility/Timestamp.h b/mission/utility/Timestamp.h index 4f783437..a83ef34c 100644 --- a/mission/utility/Timestamp.h +++ b/mission/utility/Timestamp.h @@ -5,7 +5,7 @@ #include #include -#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/timemanager/Clock.h" /** @@ -13,7 +13,7 @@ * * @author J. Meier */ -class Timestamp : public HasReturnvaluesIF { +class Timestamp { public: Timestamp(); virtual ~Timestamp(); diff --git a/test/gpio/DummyGpioIF.cpp b/test/gpio/DummyGpioIF.cpp index 3938f711..f9c28bf2 100644 --- a/test/gpio/DummyGpioIF.cpp +++ b/test/gpio/DummyGpioIF.cpp @@ -4,13 +4,13 @@ DummyGpioIF::DummyGpioIF() {} DummyGpioIF::~DummyGpioIF() {} -ReturnValue_t DummyGpioIF::addGpios(GpioCookie* cookie) { return RETURN_OK; } +ReturnValue_t DummyGpioIF::addGpios(GpioCookie* cookie) { return returnvalue::OK; } -ReturnValue_t DummyGpioIF::pullHigh(gpioId_t gpioId) { return RETURN_OK; } +ReturnValue_t DummyGpioIF::pullHigh(gpioId_t gpioId) { return returnvalue::OK; } -ReturnValue_t DummyGpioIF::pullLow(gpioId_t gpioId) { return RETURN_OK; } +ReturnValue_t DummyGpioIF::pullLow(gpioId_t gpioId) { return returnvalue::OK; } ReturnValue_t DummyGpioIF::readGpio(gpioId_t gpioId, gpio::Levels& gpioState) { gpioState = gpio::Levels::LOW; - return RETURN_OK; + return returnvalue::OK; } diff --git a/test/testtasks/PusTcInjector.cpp b/test/testtasks/PusTcInjector.cpp index 82b1cb1c..c0bff957 100644 --- a/test/testtasks/PusTcInjector.cpp +++ b/test/testtasks/PusTcInjector.cpp @@ -37,7 +37,7 @@ PusTcInjector::~PusTcInjector() {} // // Send TC packet. // TmTcMessage tcMessage(tcPacket.getStoreAddress()); // ReturnValue_t result = injectionQueue->sendToDefault(&tcMessage); -// if(result != HasReturnvaluesIF::RETURN_OK) { +// if(result != returnvalue::OK) { // sif::warning << "PusTcInjector: Sending TMTC message failed!" << std::endl; // } // return result; @@ -61,5 +61,5 @@ ReturnValue_t PusTcInjector::initialize() { sif::error << "PusTcInjector: TC Store not initialized!" << std::endl; return ObjectManagerIF::CHILD_INIT_FAILED; } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } diff --git a/test/testtasks/PusTcInjector.h b/test/testtasks/PusTcInjector.h index 4d1cea7e..217f3b59 100644 --- a/test/testtasks/PusTcInjector.h +++ b/test/testtasks/PusTcInjector.h @@ -27,7 +27,7 @@ class PusTcInjector : public SystemObject { /** * This has to be called before using the PusTcInjector. * Call Not necessary when using a factory and the object manager. - * @return -@c RETURN_OK for successfull init + * @return -@c returnvalue::OK for successfull init * -@c ObjectManagerIF::CHILD_INIT_FAILED otherwise */ ReturnValue_t initialize() override; diff --git a/test/testtasks/TestTask.cpp b/test/testtasks/TestTask.cpp index 911767af..634fdd0d 100644 --- a/test/testtasks/TestTask.cpp +++ b/test/testtasks/TestTask.cpp @@ -18,7 +18,7 @@ EiveTestTask::EiveTestTask(object_id_t objectId_) : TestTask(objectId_), testMod EiveTestTask::~EiveTestTask() {} ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; if (oneShotAction) { /* Add code here which should only be run once */ @@ -76,22 +76,22 @@ ReturnValue_t EiveTestTask::performOneShotAction() { #if OBSW_ADD_TEST_CODE == 1 // performLwgpsTest(); #endif - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } ReturnValue_t EiveTestTask::performPeriodicAction() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; return result; } ReturnValue_t EiveTestTask::performActionA() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; /* Add periodically executed code here */ return result; } ReturnValue_t EiveTestTask::performActionB() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = returnvalue::OK; /* Add periodically executed code here */ return result; } diff --git a/unittest/controller/testThermalController.cpp b/unittest/controller/testThermalController.cpp index c54892e1..a65ec69b 100644 --- a/unittest/controller/testThermalController.cpp +++ b/unittest/controller/testThermalController.cpp @@ -19,14 +19,14 @@ TEST_CASE("Thermal Controller", "[ThermalController]") { ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT); ReturnValue_t result = controller.initialize(); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + REQUIRE(result == returnvalue::OK); PeriodicTaskIF* thermalTask = TaskFactory::instance()->createPeriodicTask( "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); result = thermalTask->addComponent(THERMAL_CONTROLLER_ID); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + REQUIRE(result == returnvalue::OK); - REQUIRE(controller.initializeAfterTaskCreation() == HasReturnvaluesIF::RETURN_OK); + REQUIRE(controller.initializeAfterTaskCreation() == returnvalue::OK); testEnvironment::eventManager->clearEventList(); @@ -42,7 +42,7 @@ TEST_CASE("Thermal Controller", "[ThermalController]") { commandQueue->sendMessage(controllerQueue, &modeMessage); - REQUIRE(controller.performOperation(0) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(controller.performOperation(0) == returnvalue::OK); REQUIRE(testEnvironment::eventManager->isEventInEventList( THERMAL_CONTROLLER_ID, HasModesIF::MODE_INFO, ControllerBase::MODE_NORMAL, diff --git a/unittest/mocks/EventManagerMock.cpp b/unittest/mocks/EventManagerMock.cpp index 6956c516..383c755b 100644 --- a/unittest/mocks/EventManagerMock.cpp +++ b/unittest/mocks/EventManagerMock.cpp @@ -5,16 +5,16 @@ EventManagerMock::EventManagerMock() : EventManager(objects::EVENT_MANAGER) {} ReturnValue_t EventManagerMock::performOperation(uint8_t opCode) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - while (result == HasReturnvaluesIF::RETURN_OK) { + ReturnValue_t result = returnvalue::OK; + while (result == returnvalue::OK) { EventMessage message; result = eventReportQueue->receiveMessage(&message); - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == returnvalue::OK) { notifyListeners(&message); eventList.emplace_back(message); } } - return HasReturnvaluesIF::RETURN_OK; + return returnvalue::OK; } const std::list* EventManagerMock::getEventList() {