eive-obsw/test/testtasks/TestTask.cpp

66 lines
1.6 KiB
C++
Raw Normal View History

2020-09-16 16:22:36 +02:00
#include <test/testtasks/TestTask.h>
2020-09-16 16:32:17 +02:00
#include <fsfw/objectmanager/frameworkObjects.h>
2020-09-16 16:22:36 +02:00
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
2020-09-16 16:32:17 +02:00
#include <fsfw/objectmanager/ObjectManagerIF.h>
2020-09-16 16:22:36 +02:00
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw/globalfunctions/arrayprinter.h>
2020-09-16 16:32:17 +02:00
2020-09-16 16:22:36 +02:00
#include <array>
#include <cstring>
TestTask::TestTask(object_id_t objectId_):
SystemObject(objectId_), testMode(testModes::A) {
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
}
TestTask::~TestTask() {
}
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
2021-02-22 18:46:45 +01:00
2020-09-16 16:22:36 +02:00
if(oneShotAction) {
2021-02-22 18:46:45 +01:00
/* Add code here which should only be run once */
2020-09-16 16:22:36 +02:00
performOneShotAction();
oneShotAction = false;
}
2021-02-22 18:46:45 +01:00
/* Add code here which should only be run once per performOperation */
2020-09-16 16:22:36 +02:00
performPeriodicAction();
2021-02-22 18:46:45 +01:00
/* Add code here which should only be run on alternating cycles. */
2020-09-16 16:22:36 +02:00
if(testMode == testModes::A) {
performActionA();
testMode = testModes::B;
}
else if(testMode == testModes::B) {
performActionB();
testMode = testModes::A;
}
return result;
}
ReturnValue_t TestTask::performOneShotAction() {
2021-02-22 18:46:45 +01:00
/* Everything here will only be performed once. */
2020-09-16 16:22:36 +02:00
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t TestTask::performPeriodicAction() {
ReturnValue_t result = RETURN_OK;
return result;
}
ReturnValue_t TestTask::performActionA() {
ReturnValue_t result = RETURN_OK;
2021-02-22 18:46:45 +01:00
/* Add periodically executed code here */
2020-09-16 16:22:36 +02:00
return result;
}
ReturnValue_t TestTask::performActionB() {
ReturnValue_t result = RETURN_OK;
2021-02-22 18:46:45 +01:00
/* Add periodically executed code here */
2020-09-16 16:22:36 +02:00
return result;
}