unittesting a skeleton controller, still withouth fsfw
This commit is contained in:
parent
d9badee18f
commit
f9721eb1ae
@ -263,6 +263,7 @@ endif()
|
||||
|
||||
target_link_libraries(${UNITTEST_NAME} PRIVATE
|
||||
Catch2
|
||||
${LIB_EIVE_MISSION}
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
add_subdirectory(controller)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(utility)
|
||||
|
3
mission/controller/CMakeLists.txt
Normal file
3
mission/controller/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
target_sources(${LIB_EIVE_MISSION} PRIVATE
|
||||
ThermalController.cpp
|
||||
)
|
@ -1,42 +1,7 @@
|
||||
#include "ThermalController.h"
|
||||
|
||||
#include <mission/devices/devicedefinitions/ThermalSensorPacket.h>
|
||||
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<HasLocalDataPoolIF>(
|
||||
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;
|
||||
}
|
@ -3,29 +3,13 @@
|
||||
|
||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||
|
||||
#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_ */
|
||||
|
@ -1,7 +1,13 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <mission/controller/ThermalController.h>
|
||||
|
||||
TEST_CASE( "Thermal Controller" , "[ThermalController]") {
|
||||
bool test = true;
|
||||
REQUIRE( test == true);
|
||||
|
||||
ThermalController controller(123);
|
||||
|
||||
REQUIRE(controller.perform() == HasReturnvaluesIF::RETURN_OK);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user