diff --git a/CMakeLists.txt b/CMakeLists.txt index 9144f27d..0c160fe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,6 +263,7 @@ endif() target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 + ${LIB_EIVE_MISSION} ) diff --git a/mission/CMakeLists.txt b/mission/CMakeLists.txt index b0fc4d00..7fa8fe56 100644 --- a/mission/CMakeLists.txt +++ b/mission/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(controller) add_subdirectory(core) add_subdirectory(devices) add_subdirectory(utility) diff --git a/mission/controller/CMakeLists.txt b/mission/controller/CMakeLists.txt new file mode 100644 index 00000000..2b0bac62 --- /dev/null +++ b/mission/controller/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_EIVE_MISSION} PRIVATE + ThermalController.cpp +) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index cd8c8b22..610cae0a 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1,42 +1,7 @@ #include "ThermalController.h" -#include +ThermalController::ThermalController(object_id_t objectId) {} -ThermalController::ThermalController(object_id_t objectId) - : ExtendedControllerBase(objectId, objects::NO_OBJECT), thermalControllerSet(objectId) {} - -ReturnValue_t ThermalController::handleCommandMessage(CommandMessage *message) { - return HasReturnvaluesIF::RETURN_OK; -} - -void ThermalController::performControlOperation() {} - -void ThermalController::handleChangedDataset(sid_t sid, store_address_t storeId) { - if (sid == sid_t(TSensorDefinitions::ObjIds::TEST_HKB_HANDLER, - TSensorDefinitions::THERMAL_SENSOR_SET_ID)) { - sif::info << "Update registered!" << std::endl; - } -} - -ReturnValue_t ThermalController::initializeAfterTaskCreation() { - ReturnValue_t result = ExtendedControllerBase::initializeAfterTaskCreation(); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "ThermalController::initializeAfterTaskCreation: Base" - << " class initialization failed!" << std::endl; - } - HasLocalDataPoolIF *testHkbHandler = ObjectManager::instance()->get( - TSensorDefinitions::ObjIds::TEST_HKB_HANDLER); - if (testHkbHandler == nullptr) { - sif::warning << "ThermalController::initializeAfterTaskCreation: Test" - << " HKB Handler invalid!" << std::endl; - } - // Test normal notifications without data packet first. - testHkbHandler->getHkManagerHandle()->subscribeForSetUpdateMessages( - TSensorDefinitions::THERMAL_SENSOR_SET_ID, this->getObjectId(), commandQueue->getId(), false); - return result; -} - -ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t *msToReachTheMode) { - return HasReturnvaluesIF::RETURN_OK; -} +ReturnValue_t ThermalController::perform() { + return HasReturnvaluesIF::RETURN_FAILED; +} \ No newline at end of file diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 2d76ce8d..52279261 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -3,29 +3,13 @@ #include -#include "ctrldefinitions/ThermalCtrlPackets.h" -class ThermalController : public ExtendedControllerBase { + +class ThermalController { public: ThermalController(object_id_t objectId); - private: - // TODO: Add stubs for thermal components. Each device / assembly with one - // or multiple redundant sensors will have a thermal component. - - /** ExtendedControllerBase overrides */ - virtual ReturnValue_t handleCommandMessage(CommandMessage *message) override; - - virtual void performControlOperation() override; - - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t *msToReachTheMode) override; - - ReturnValue_t initializeAfterTaskCreation() override; - - void handleChangedDataset(sid_t sid, store_address_t storeId) override; - - ThermalCtrl::ThermalControllerTemperatureSet thermalControllerSet; + ReturnValue_t perform(); }; #endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */ diff --git a/unittest/controller/testThermalController.cpp b/unittest/controller/testThermalController.cpp index c7a5953f..a5b23b26 100644 --- a/unittest/controller/testThermalController.cpp +++ b/unittest/controller/testThermalController.cpp @@ -1,7 +1,13 @@ #include +#include + TEST_CASE( "Thermal Controller" , "[ThermalController]") { bool test = true; REQUIRE( test == true); + ThermalController controller(123); + + REQUIRE(controller.perform() == HasReturnvaluesIF::RETURN_OK); + } \ No newline at end of file