fixed slot sequence safety check added

This commit is contained in:
Robin Müller 2020-04-16 13:17:26 +02:00
parent 21650b064d
commit f45a8cc171
3 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,6 @@
#include <framework/devicehandlers/FixedSlotSequence.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <cstdlib>
FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) :
slotLengthMs(setLengthMs) {
@ -87,7 +88,15 @@ uint32_t FixedSlotSequence::getLengthMs() const {
}
ReturnValue_t FixedSlotSequence::checkSequence() const {
// Iterate through slotList and check successful creation.
if(slotList.empty()) {
error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
// does check sequence have to be const?
// if I want to check a class, I need the ability to set
// internal class states.
//isEmpty = true;
std::exit(0);
}
// Iterate through slotList and check successful creation.
// Checks if timing is ok (must be ascending) and if all handlers were found.
auto slotIt = slotList.begin();
uint32_t count = 0;

View File

@ -3,6 +3,7 @@
#include <framework/devicehandlers/FixedSequenceSlot.h>
#include <framework/objectmanager/SystemObject.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <list>
#include <set>
@ -23,7 +24,6 @@ using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
class FixedSlotSequence {
public:
/**
* @brief The constructor of the FixedSlotSequence object.
*
@ -127,6 +127,8 @@ protected:
SlotList slotList;
uint32_t slotLengthMs;
bool isEmpty = false;
};
#endif /* FIXEDSLOTSEQUENCE_H_ */

View File

@ -112,7 +112,6 @@ void FixedTimeslotTask::taskFunctionality() {
vTaskDelayUntil(&xLastWakeTime, interval);
//TODO deadline missed check
}
}
}