skeleton controller now unittested including fsfw. Still dirty WIP
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Ulrich Mohr 2022-02-10 18:54:09 +01:00
parent f9721eb1ae
commit f1249392cf
6 changed files with 78 additions and 4 deletions

View File

@ -1,7 +1,20 @@
#include "ThermalController.h" #include "ThermalController.h"
ThermalController::ThermalController(object_id_t objectId) {} ThermalController::ThermalController(object_id_t objectId) :ExtendedControllerBase(objectId, 0) {}
ReturnValue_t ThermalController::perform() { ReturnValue_t ThermalController::perform() { return HasReturnvaluesIF::RETURN_FAILED; }
return HasReturnvaluesIF::RETURN_FAILED;
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
return RETURN_FAILED;
}
void ThermalController::performControlOperation() {}
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
return RETURN_OK;
}
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) { return nullptr; }
ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
return RETURN_FAILED;
} }

View File

@ -5,11 +5,22 @@
class ThermalController { class ThermalController : public ExtendedControllerBase {
public: public:
ThermalController(object_id_t objectId); ThermalController(object_id_t objectId);
ReturnValue_t perform(); ReturnValue_t perform();
protected:
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
virtual void performControlOperation() override;
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
// Mode abstract functions
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
}; };
#endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */ #endif /* MISSION_CONTROLLER_THERMALCONTROLLER_H_ */

View File

@ -3,4 +3,5 @@ add_subdirectory(controller)
target_sources(${UNITTEST_NAME} PRIVATE target_sources(${UNITTEST_NAME} PRIVATE
main.cpp main.cpp
printChar.cpp
) )

View File

@ -1,6 +1,38 @@
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <mission/controller/ThermalController.h> #include <mission/controller/ThermalController.h>
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
/* This is configured for linux without CR */
#ifdef PLATFORM_UNIX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR");
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
#include <fsfw/ipc/FwMessageTypes.h>
namespace messagetypes {
enum MESSAGE_TYPE {
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
};
void clearMissionMessage(CommandMessage* message);
} // namespace messagetypes
void messagetypes::clearMissionMessage(CommandMessage* message) {
}
TEST_CASE( "Thermal Controller" , "[ThermalController]") { TEST_CASE( "Thermal Controller" , "[ThermalController]") {
bool test = true; bool test = true;

11
unittest/printChar.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "printChar.h"
#include <cstdio>
void printChar(const char* character, bool errStream) {
if (errStream) {
std::putc(*character, stderr);
return;
}
std::putc(*character, stdout);
}

6
unittest/printChar.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef FSFW_UNITTEST_CORE_PRINTCHAR_H_
#define FSFW_UNITTEST_CORE_PRINTCHAR_H_
extern "C" void printChar(const char*, bool errStream);
#endif /* FSFW_UNITTEST_CORE_PRINTCHAR_H_ */