Merge remote-tracking branch 'upstream/master' into front_branch

This commit is contained in:
Robin Müller 2020-05-08 18:41:07 +02:00
commit d35a6e6c14
5 changed files with 42 additions and 31 deletions

View File

@ -89,15 +89,9 @@ uint32_t FixedSlotSequence::getLengthMs() const {
ReturnValue_t FixedSlotSequence::checkSequence() const {
if(slotList.empty()) {
sif::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);
sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
// 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;
uint32_t time = 0;

View File

@ -13,13 +13,19 @@ using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
/**
* @brief This class is the representation of a Polling Sequence Table in software.
*
* @details The FixedSlotSequence object maintains the dynamic execution of device handler objects.
* The main idea is to create a list of device handlers, to announce all handlers to the
* polling sequence and to maintain a list of polling slot objects. This slot list represents the
* Polling Sequence Table in software. Each polling slot contains information to indicate when and
* which device handler shall be executed within a given polling period.
* The sequence is then executed by iterating through this slot list.
* Handlers are invoking by calling a certain function stored in the handler list.
* @details
* The FixedSlotSequence object maintains the dynamic execution of
* device handler objects.
*
* The main idea is to create a list of device handlers, to announce all
* handlers to thepolling sequence and to maintain a list of
* polling slot objects. This slot list represents the Polling Sequence Table
* in software.
*
* Each polling slot contains information to indicate when and
* which device handler shall be executed within a given polling period.
* The sequence is then executed by iterating through this slot list.
* Handlers are invoking by calling a certain function stored in the handler list.
*/
class FixedSlotSequence {
public:
@ -112,7 +118,12 @@ public:
*/
SlotListIter current;
virtual ReturnValue_t checkSequence() const;
/**
* Iterate through slotList and check successful creation.
* Checks if timing is ok (must be ascending) and if all handlers were found.
* @return
*/
ReturnValue_t checkSequence() const;
protected:
/**

View File

@ -57,18 +57,18 @@ ReturnValue_t FixedTimeslotTask::startTask() {
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
uint32_t slotTimeMs, int8_t executionStep) {
if (objectManager->get<ExecutableObjectIF>(componentId) != NULL) {
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
if(slotTimeMs == 0) {
// TODO: FreeRTOS throws errors for zero values.
// maybe there is a better solution than this.
// FreeRTOS throws a sanity error for zero values, so we set
// the time to one millisecond.
slotTimeMs = 1;
}
pst.addSlot(componentId, slotTimeMs, executionStep, this);
return HasReturnvaluesIF::RETURN_OK;
}
sif::error << "Component " << std::hex << componentId
<< " not found, not adding it to pst" << std::endl;
sif::error << "Component " << std::hex << componentId <<
" not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -42,14 +42,14 @@ uint32_t FixedTimeslotTask::getPeriodMs() const {
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
uint32_t slotTimeMs, int8_t executionStep) {
if (!objectManager->get<ExecutableObjectIF>(componentId)) {
sif::error << "Component " << std::hex << componentId
<< " not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
pst.addSlot(componentId, slotTimeMs, executionStep, this);
return HasReturnvaluesIF::RETURN_OK;
}
pst.addSlot(componentId, slotTimeMs, executionStep, this);
return HasReturnvaluesIF::RETURN_OK;
sif::error << "Component " << std::hex << componentId <<
" not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
ReturnValue_t FixedTimeslotTask::checkSequence() const {

View File

@ -66,10 +66,16 @@ ReturnValue_t PollingTask::startTask() {
}
}
ReturnValue_t PollingTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
int8_t executionStep) {
pst.addSlot(componentId, slotTimeMs, executionStep, this);
return HasReturnvaluesIF::RETURN_OK;
ReturnValue_t PollingTask::addSlot(object_id_t componentId,
uint32_t slotTimeMs, int8_t executionStep) {
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
pst.addSlot(componentId, slotTimeMs, executionStep, this);
return HasReturnvaluesIF::RETURN_OK;
}
error << "Component " << std::hex << componentId <<
" not found, not adding it to pst" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
uint32_t PollingTask::getPeriodMs() const {