From 88f229cef924fcb45c46b8d6e002c3d8142f60d8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 23 Apr 2020 15:03:55 +0200 Subject: [PATCH 01/21] fifo enhancement --- container/FIFO.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/container/FIFO.h b/container/FIFO.h index 134da9b8..889d2ade 100644 --- a/container/FIFO.h +++ b/container/FIFO.h @@ -3,6 +3,11 @@ #include +/** + * @brief Simple First-In-First-Out data structure + * @tparam T Entry Type + * @tparam capacity Maximum capacity + */ template class FIFO { private: @@ -54,6 +59,26 @@ public: return HasReturnvaluesIF::RETURN_OK; } } + + ReturnValue_t peek(T * value) { + if(empty()) { + return EMPTY; + } else { + *value = data[readIndex]; + return HasReturnvaluesIF::RETURN_OK; + } + } + + ReturnValue_t pop() { + if(empty()) { + return EMPTY; + } else { + readIndex = next(readIndex); + --currentSize; + return HasReturnvaluesIF::RETURN_OK; + } + } + static const uint8_t INTERFACE_ID = CLASS_ID::FIFO_CLASS; static const ReturnValue_t FULL = MAKE_RETURN_CODE(1); static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(2); From 504c8177e8b428818108b57e091b77ee1e0155a8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 24 Apr 2020 17:05:34 +0200 Subject: [PATCH 02/21] uninitialized variable --- parameters/ParameterWrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameters/ParameterWrapper.cpp b/parameters/ParameterWrapper.cpp index 8f661bb3..1dac7075 100644 --- a/parameters/ParameterWrapper.cpp +++ b/parameters/ParameterWrapper.cpp @@ -91,7 +91,7 @@ template ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, uint32_t* size, const uint32_t max_size, bool bigEndian) const { const T *element = (const T*) readonlyData; - ReturnValue_t result; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; uint16_t dataSize = columns * rows; while (dataSize != 0) { result = SerializeAdapter::serialize(element, buffer, size, max_size, From 1825924b7bf46d65fc163ac89921d9d70ddbe33b Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 10:16:16 +0200 Subject: [PATCH 03/21] abbreviation for resultIF --- returnvalues/HasReturnvaluesIF.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/returnvalues/HasReturnvaluesIF.h b/returnvalues/HasReturnvaluesIF.h index d84fc757..964d081f 100644 --- a/returnvalues/HasReturnvaluesIF.h +++ b/returnvalues/HasReturnvaluesIF.h @@ -18,4 +18,6 @@ public: }; +using ResultIF = HasReturnvaluesIF; + #endif /* HASRETURNVALUESIF_H_ */ From c05b9cbd01b490046f6d7881bf4ff62f7e2a63c2 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 14:07:27 +0200 Subject: [PATCH 04/21] reverted ResultIF. for now, keep using HasReturnvaluesIF --- returnvalues/HasReturnvaluesIF.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/returnvalues/HasReturnvaluesIF.h b/returnvalues/HasReturnvaluesIF.h index 964d081f..9bbaf601 100644 --- a/returnvalues/HasReturnvaluesIF.h +++ b/returnvalues/HasReturnvaluesIF.h @@ -13,11 +13,7 @@ class HasReturnvaluesIF { public: static const ReturnValue_t RETURN_OK = 0; static const ReturnValue_t RETURN_FAILED = 0xFFFF; - virtual ~HasReturnvaluesIF() { - } - + virtual ~HasReturnvaluesIF() {} }; -using ResultIF = HasReturnvaluesIF; - #endif /* HASRETURNVALUESIF_H_ */ From 5b933dfe3d922e7f60ee0c3109b602a2b8331188 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:28:50 +0200 Subject: [PATCH 05/21] also added additonal time check for freeRTOS --- osal/FreeRTOS/FixedTimeslotTask.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/osal/FreeRTOS/FixedTimeslotTask.cpp index 413d7596..e621d312 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.cpp +++ b/osal/FreeRTOS/FixedTimeslotTask.cpp @@ -57,12 +57,18 @@ ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { - if (objectManager->get(componentId) != NULL) { + if (objectManager->get(componentId) != nullptr) { + if(slotTimeMs == 0) { + // TODO: FreeRTOS throws errors for zero values. + // maybe there is a better solution than this. + slotTimeMs = 1; + } pst.addSlot(componentId, slotTimeMs, executionStep, this); return HasReturnvaluesIF::RETURN_OK; } - error << "Component " << std::hex << componentId << " not found, not adding it to pst" << std::endl; + error << "Component " << std::hex << componentId << + " not found, not adding it to pst" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } From 736a69795dd3aec0cc9441209c04a2acda770f2d Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:32:50 +0200 Subject: [PATCH 06/21] change ported to linux and rtems --- osal/linux/FixedTimeslotTask.cpp | 10 ++++++++-- osal/rtems/PollingTask.cpp | 15 ++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/osal/linux/FixedTimeslotTask.cpp b/osal/linux/FixedTimeslotTask.cpp index 99cbf818..29eb37e7 100644 --- a/osal/linux/FixedTimeslotTask.cpp +++ b/osal/linux/FixedTimeslotTask.cpp @@ -40,8 +40,14 @@ uint32_t FixedTimeslotTask::getPeriodMs() const { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { - pst.addSlot(componentId, slotTimeMs, executionStep, this); - return HasReturnvaluesIF::RETURN_OK; + if (objectManager->get(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; } ReturnValue_t FixedTimeslotTask::checkSequence() const { diff --git a/osal/rtems/PollingTask.cpp b/osal/rtems/PollingTask.cpp index c2dc629b..7409a6b8 100644 --- a/osal/rtems/PollingTask.cpp +++ b/osal/rtems/PollingTask.cpp @@ -66,12 +66,17 @@ 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 Polling::addSlot(object_id_t componentId, + uint32_t slotTimeMs, int8_t executionStep) { + if (objectManager->get(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 { return pst.getLengthMs(); } From f3dca8044e8c4ee7bdd08a3bcd5034beb4e2d2a5 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:34:04 +0200 Subject: [PATCH 07/21] typo --- osal/rtems/PollingTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/rtems/PollingTask.cpp b/osal/rtems/PollingTask.cpp index 7409a6b8..4a70a1ed 100644 --- a/osal/rtems/PollingTask.cpp +++ b/osal/rtems/PollingTask.cpp @@ -66,7 +66,7 @@ ReturnValue_t PollingTask::startTask() { } } -ReturnValue_t Polling::addSlot(object_id_t componentId, +ReturnValue_t PollingTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { if (objectManager->get(componentId) != nullptr) { pst.addSlot(componentId, slotTimeMs, executionStep, this); From f1a0bb9dc3ece68f16a42eca68218c807efa1bd7 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:36:18 +0200 Subject: [PATCH 08/21] whitespace --- osal/rtems/PollingTask.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/osal/rtems/PollingTask.cpp b/osal/rtems/PollingTask.cpp index 4a70a1ed..03ba0951 100644 --- a/osal/rtems/PollingTask.cpp +++ b/osal/rtems/PollingTask.cpp @@ -77,6 +77,7 @@ ReturnValue_t PollingTask::addSlot(object_id_t componentId, " not found, not adding it to pst" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } + uint32_t PollingTask::getPeriodMs() const { return pst.getLengthMs(); } From bc17b5a907ca3fe2ead9829a1a582bedc84389b1 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:43:28 +0200 Subject: [PATCH 09/21] resolved conflict --- osal/linux/FixedTimeslotTask.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/osal/linux/FixedTimeslotTask.cpp b/osal/linux/FixedTimeslotTask.cpp index 2775e4f6..098753a7 100644 --- a/osal/linux/FixedTimeslotTask.cpp +++ b/osal/linux/FixedTimeslotTask.cpp @@ -42,25 +42,14 @@ uint32_t FixedTimeslotTask::getPeriodMs() const { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { -<<<<<<< HEAD - if (!objectManager->get(componentId)) { - sif::error << "Component " << std::hex << componentId - << " not found, not adding it to pst" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - - pst.addSlot(componentId, slotTimeMs, executionStep, this); - return HasReturnvaluesIF::RETURN_OK; -======= if (objectManager->get(componentId) != nullptr) { pst.addSlot(componentId, slotTimeMs, executionStep, this); return HasReturnvaluesIF::RETURN_OK; } - error << "Component " << std::hex << componentId << + sif::error << "Component " << std::hex << componentId << " not found, not adding it to pst" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; ->>>>>>> luz_FixedTimeslotTask_ExistenceCheck } ReturnValue_t FixedTimeslotTask::checkSequence() const { From 160a09790e112fdd6cc40cbb75b502c9ca057fd8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:53:25 +0200 Subject: [PATCH 10/21] removed c omment for now --- devicehandlers/FixedSlotSequence.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 466d846f..aa0df9cb 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -90,10 +90,6 @@ 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); } // Iterate through slotList and check successful creation. From 75da7a4c500e343b559406ecb1877d7ec750fd29 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:55:05 +0200 Subject: [PATCH 11/21] comment moved to header --- devicehandlers/FixedSlotSequence.cpp | 1 - devicehandlers/FixedSlotSequence.h | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index a65dd929..9ff5a140 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -89,7 +89,6 @@ uint32_t FixedSlotSequence::getLengthMs() const { } ReturnValue_t FixedSlotSequence::checkSequence() const { - //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; diff --git a/devicehandlers/FixedSlotSequence.h b/devicehandlers/FixedSlotSequence.h index f8fd9a36..1da9d350 100644 --- a/devicehandlers/FixedSlotSequence.h +++ b/devicehandlers/FixedSlotSequence.h @@ -97,6 +97,11 @@ public: */ std::list::iterator current; + /** + * 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: From a6b3cee898a8be16658cda04153e11829a5db372 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:56:45 +0200 Subject: [PATCH 12/21] class comment formatting --- devicehandlers/FixedSlotSequence.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/devicehandlers/FixedSlotSequence.h b/devicehandlers/FixedSlotSequence.h index 1da9d350..64c68aea 100644 --- a/devicehandlers/FixedSlotSequence.h +++ b/devicehandlers/FixedSlotSequence.h @@ -6,15 +6,21 @@ #include /** - * \brief This class is the representation of a Polling Sequence Table in software. + * @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: From 432dbbd26eca201025d5d064425881f8b3f40222 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:57:30 +0200 Subject: [PATCH 13/21] removed sif --- devicehandlers/FixedSlotSequence.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 9ff5a140..bf9ff4fd 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -89,6 +89,10 @@ uint32_t FixedSlotSequence::getLengthMs() const { } ReturnValue_t FixedSlotSequence::checkSequence() const { + if(slotList.empty()) { + error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; + std::exit(0); + } auto slotIt = slotList.begin(); uint32_t count = 0; uint32_t time = 0; From 98e505c9ab3fc42513390e859bc98df201fe3cc0 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:03:00 +0200 Subject: [PATCH 14/21] todo removed --- osal/FreeRTOS/FixedTimeslotTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/osal/FreeRTOS/FixedTimeslotTask.cpp index e621d312..74ce9b78 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.cpp +++ b/osal/FreeRTOS/FixedTimeslotTask.cpp @@ -59,8 +59,8 @@ ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { if (objectManager->get(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); From df9e66834e5ccb7d7d81a07b199baaebd4f6826c Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:07:11 +0200 Subject: [PATCH 15/21] pop() better --- container/FIFO.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/container/FIFO.h b/container/FIFO.h index 889d2ade..f70c78b0 100644 --- a/container/FIFO.h +++ b/container/FIFO.h @@ -70,13 +70,8 @@ public: } ReturnValue_t pop() { - if(empty()) { - return EMPTY; - } else { - readIndex = next(readIndex); - --currentSize; - return HasReturnvaluesIF::RETURN_OK; - } + T value; + return this->retrieve(&value); } static const uint8_t INTERFACE_ID = CLASS_ID::FIFO_CLASS; From f09836a9eb4aeb561ae1e6fa13e20c0aa0fc01cf Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:30:03 +0200 Subject: [PATCH 16/21] removed exit for empty psremoved exit for empty pstt --- devicehandlers/FixedSlotSequence.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index aa0df9cb..00020d68 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -90,7 +90,6 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { sif::error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; - std::exit(0); } // Iterate through slotList and check successful creation. // Checks if timing is ok (must be ascending) and if all handlers were found. From c4486e79eca8fa258b744bf27cf364b5258fc2ba Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:30:26 +0200 Subject: [PATCH 17/21] removed exit for empty pst --- devicehandlers/FixedSlotSequence.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index bf9ff4fd..61959ac0 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -91,7 +91,6 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; - std::exit(0); } auto slotIt = slotList.begin(); uint32_t count = 0; From 119455f3fd7f65ebd4559c14e8e5a763a2870936 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:33:06 +0200 Subject: [PATCH 18/21] replaced exit by returning failed --- devicehandlers/FixedSlotSequence.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 61959ac0..dae62bdd 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -91,6 +91,7 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; } auto slotIt = slotList.begin(); uint32_t count = 0; From cc0469fef6031ebde23583f958fcf1c0b1e5ef3e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 20:09:42 +0200 Subject: [PATCH 19/21] return failed insteead of exiting --- devicehandlers/FixedSlotSequence.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 00020d68..860a643b 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -90,6 +90,7 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { 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. From e950051b4ab7edcc6919af226f3c7a1eae63602e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 6 May 2020 14:35:30 +0200 Subject: [PATCH 20/21] some object managerIF security measures objectmanager get function checks whether global object manager was initialized now. New returnvalues, which are also used for local pool init --- devicehandlers/FixedSlotSequence.cpp | 8 -------- devicehandlers/FixedSlotSequence.h | 16 +-------------- objectmanager/ObjectManagerIF.h | 29 ++++++++++++++++++---------- storagemanager/LocalPool.tpp | 6 +++--- storagemanager/StorageManagerIF.h | 1 + 5 files changed, 24 insertions(+), 36 deletions(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 6db7ee43..8974510e 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -89,17 +89,9 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { -<<<<<<< HEAD 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. -======= - error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } ->>>>>>> master auto slotIt = slotList.begin(); uint32_t count = 0; uint32_t time = 0; diff --git a/devicehandlers/FixedSlotSequence.h b/devicehandlers/FixedSlotSequence.h index 65ad3451..dd9636c1 100644 --- a/devicehandlers/FixedSlotSequence.h +++ b/devicehandlers/FixedSlotSequence.h @@ -12,16 +12,6 @@ using SlotListIter = std::multiset::iterator; /** * @brief This class is the representation of a Polling Sequence Table in software. - * -<<<<<<< HEAD - * @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. @@ -35,7 +25,6 @@ using SlotListIter = std::multiset::iterator; * 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. ->>>>>>> master */ class FixedSlotSequence { public: @@ -128,16 +117,13 @@ public: */ SlotListIter current; -<<<<<<< HEAD - 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; ->>>>>>> master + protected: /** diff --git a/objectmanager/ObjectManagerIF.h b/objectmanager/ObjectManagerIF.h index 1d7674c6..3a23e339 100644 --- a/objectmanager/ObjectManagerIF.h +++ b/objectmanager/ObjectManagerIF.h @@ -12,6 +12,7 @@ #include #include #include +#include /** * @brief This class provides an interface to the global object manager. @@ -24,9 +25,12 @@ */ class ObjectManagerIF : public HasReturnvaluesIF { public: - static const uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF; - static const ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 ); - static const ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 ); + static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF; + static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 ); + static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 ); + static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 ); + static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 ); + protected: /** * @brief This method is used to hide the template-based get call from @@ -79,16 +83,21 @@ public: }; -/*Documentation can be found in the class method declaration above.*/ -template -T* ObjectManagerIF::get( object_id_t id ) { - SystemObjectIF* temp = this->getSystemObject(id); - return dynamic_cast(temp); -} - /** * @brief This is the forward declaration of the global objectManager instance. */ extern ObjectManagerIF *objectManager; +/*Documentation can be found in the class method declaration above.*/ +template +T* ObjectManagerIF::get( object_id_t id ) { + if(objectManager == nullptr) { + sif::error << "ObjectManagerIF: Global object manager has not " + "been initialized yet!" << std::endl; + std::exit(0); + } + SystemObjectIF* temp = this->getSystemObject(id); + return dynamic_cast(temp); +} + #endif /* OBJECTMANAGERIF_H_ */ diff --git a/storagemanager/LocalPool.tpp b/storagemanager/LocalPool.tpp index 5cead166..c46e1a8d 100644 --- a/storagemanager/LocalPool.tpp +++ b/storagemanager/LocalPool.tpp @@ -242,8 +242,8 @@ inline ReturnValue_t LocalPool::initialize() { } internalErrorReporter = objectManager->get( objects::INTERNAL_ERROR_REPORTER); - if (internalErrorReporter == NULL){ - return RETURN_FAILED; + if (internalErrorReporter == nullptr){ + return ObjectManagerIF::INTERNAL_ERR_REPORTER_UNINIT; } //Check if any pool size is large than the maximum allowed. @@ -251,7 +251,7 @@ inline ReturnValue_t LocalPool::initialize() { if (element_sizes[count] >= STORAGE_FREE) { sif::error << "LocalPool::initialize: Pool is too large! " "Max. allowed size is: " << (STORAGE_FREE - 1) << std::endl; - return RETURN_FAILED; + return StorageManagerIF::POOL_TOO_LARGE; } } return RETURN_OK; diff --git a/storagemanager/StorageManagerIF.h b/storagemanager/StorageManagerIF.h index d85fe86f..d1f9cde5 100644 --- a/storagemanager/StorageManagerIF.h +++ b/storagemanager/StorageManagerIF.h @@ -71,6 +71,7 @@ public: static const ReturnValue_t ILLEGAL_STORAGE_ID = MAKE_RETURN_CODE(3); //!< This return code indicates that data was requested with an illegal storage ID. static const ReturnValue_t DATA_DOES_NOT_EXIST = MAKE_RETURN_CODE(4); //!< This return code indicates that the requested ID was valid, but no data is stored there. static const ReturnValue_t ILLEGAL_ADDRESS = MAKE_RETURN_CODE(5); + static const ReturnValue_t POOL_TOO_LARGE = MAKE_RETURN_CODE(6); //!< Pool size too large on initialization. static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::OBSW; static const Event GET_DATA_FAILED = MAKE_EVENT(0, SEVERITY::LOW); From b016f2995a00a3a5183794bb576820d17b6f078b Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 6 May 2020 16:34:43 +0200 Subject: [PATCH 21/21] added default vlaue for init function --- action/ActionHelper.cpp | 10 ++++++---- action/ActionHelper.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index ef9f06a9..19a84d82 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -1,9 +1,9 @@ #include #include #include + ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : - owner(setOwner), queueToUse(useThisQueue), ipcStore( - NULL) { + owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) { } ActionHelper::~ActionHelper() { @@ -22,10 +22,12 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) { ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { ipcStore = objectManager->get(objects::IPC_STORE); - if (ipcStore == NULL) { + if (ipcStore == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } - setQueueToUse(queueToUse_); + if(queueToUse_ != nullptr) { + setQueueToUse(queueToUse_); + } return HasReturnvaluesIF::RETURN_OK; } diff --git a/action/ActionHelper.h b/action/ActionHelper.h index 6ba6dd89..3d8351d6 100644 --- a/action/ActionHelper.h +++ b/action/ActionHelper.h @@ -38,7 +38,7 @@ public: * @param queueToUse_ Pointer to the messageQueue to be used * @return Returns RETURN_OK if successful */ - ReturnValue_t initialize(MessageQueueIF* queueToUse_); + ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr); /** * Function to be called from the owner to send a step message. Success or failure will be determined by the result value. *