2020-10-20 17:38:41 +02:00
|
|
|
#include "PollingSequenceFactory.h"
|
|
|
|
|
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
2022-02-02 10:29:30 +01:00
|
|
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
2020-10-20 17:38:41 +02:00
|
|
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
#include "tests/TestsConfig.h"
|
|
|
|
|
|
|
|
ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence) {
|
|
|
|
/* Length of a communication cycle */
|
|
|
|
uint32_t length = thisSequence->getPeriodMs();
|
2020-10-20 17:38:41 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
/* Add polling sequence table here */
|
|
|
|
thisSequence->addSlot(objects::TEST_DEVICE, 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
|
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.3, DeviceHandlerIF::SEND_WRITE);
|
|
|
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length, DeviceHandlerIF::GET_WRITE);
|
|
|
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length, DeviceHandlerIF::SEND_READ);
|
|
|
|
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length, DeviceHandlerIF::GET_READ);
|
2020-10-20 17:38:41 +02:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
} else {
|
2021-07-30 14:18:47 +02:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED
|
2022-02-02 10:29:30 +01:00
|
|
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
|
2021-07-30 14:18:47 +02:00
|
|
|
#else
|
2022-02-02 10:29:30 +01:00
|
|
|
sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!");
|
2021-01-03 13:58:18 +01:00
|
|
|
#endif
|
2022-02-02 10:29:30 +01:00
|
|
|
return HasReturnvaluesIF::RETURN_FAILED;
|
|
|
|
}
|
2020-10-20 17:38:41 +02:00
|
|
|
}
|